Installing Percona MongoDB 3 Node Cluster

Percona Server for MongoDB features enterprise-grade functionalities and runs on monitoring tools like Percona Monitoring and Management. It is 100% free and open source!

Here is a step by step installation process of Percona MongoDB Node Cluster:

First spin up 3 identical servers, I’m going to be working with CentOS 7 servers.

Step #1 Setting up mongodb on all the 3 servers.

Follow these steps on each server:

  1. SSH into the server.
  2. Install percona server for MongoDB 4.4 (follow these instructions).
  3. Edit configuration file by running vi
    • Change the bindIp under network interfaces

4. Start mongo  

5. Verify installation

6. Connect

7. Create the database user :



8. Exit mongo by typing exit or Ctrl+C

9. Log in as a new user :

10. Test DB by creating sample data 

11. Exit mongo 
12. Edit configuration file  

  • uncommented replication and add under it replSetName: <repl_name>

13. Restart mongo service  

Step #2 Creating a KeyFile for replicaSet

1. SSH into the master server.

2. Switch to root

3. Run

4. Generate key by running:

5. Run
6. Run

7. Print out the key

8. Copy the key and run the following on the other 2 servers:
     a. 
     b.
     c. Paste the key
     d.
     e.

9. On all servers add keyFile to the configuration file

10. Restart mongo on all servers

 

11. Exit sudo exit

Step #3 Initiate replica set

On the master server:

  1. Login to mongo shell with admin user 
  1. Run