armdev / new-mongo-cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New MongoDB Cluster Replica - MongoDB 7

Preconditions:

  1. Operating System: Linux

    • Ensure Docker and Docker Compose are installed.
    • Install Java JDK 21 and Apache Maven 3.9.5.
  2. Database User Setup:

    • Configure the script/init.js file to add a new MongoDB user with a specified password.
  3. Docker Network Configuration:

    • Set the Docker network name to clusternet.
  4. Cluster Initialization:

    • Run:
      ./init_mongo_cluster.sh
      Custom volumes are mounted:
      • Primary Node: ~/volumes/mongo7/primary:/data/db
      • Secondary Node: ~/volumes/mongo7/secondary:/data/db
  5. Running the Cluster:

    • Subsequently, run:
      ./run_mongo.sh
  6. Microservice Deployment:

    • Run:
      ./run.sh
      This will build and deploy the People microservice using Docker Compose.
  7. API Access:

  8. Data Generation:

    • Trigger data generation with:
      curl http://localhost:7025/api/v2/people/generate/new/data
  9. Benchmarking:

    • Conduct benchmarking using Apache Benchmark:
      ab -n 100 -c 10 http://localhost:7025/api/v2/people/generate/new/data
  10. Concurrency Configuration:

    • Spring Boot is configured with virtual threads for enhanced performance.
  11. Database Inspection:

    • View the MongoDB instances using:
      ./look.sh mongo1
      or
      ./look.sh mongo2
  12. Microservice Restart:

    • Restart the People microservice with:
      ./restart people
  13. Performance Tuning:

    • The Dockerfile is tuned for high performance, aiming for optimal production deployment.
  14. Deployment:

    • Push the code to production confidently!
  15. Collaboration:

    • Feel free to send a pull request for improvements. Contributions are highly appreciated!

About


Languages

Language:Java 77.9%Language:Shell 11.4%Language:Dockerfile 9.3%Language:JavaScript 1.4%