In this article, you will learn how to configure three-node MongoDB replicaset and how to configure Paxata Core Server to communicate with the MongoDB replicaset for metadata storage.
Three Mongo Servers
mongo1.mycompany.com:27107
mongo2.mycompany.com:27107
mongo3.mycompany.com:27107
In all mongo server, In /etc/mongod.conf, set the following (bold fields are changed from default values):
# Where and how to store data.
storage:
dbPath: /usr/local/paxata/mongo
journal:
enabled: true
engine: wiredTiger
...
# network interfaces
net:
port: 27017
# bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
replication:
replSetName: rs_paxata
In all mongo servers,
service mongod restart
Go to Mongo Shell in mongo1.mycompany.com only. Initiate RS.
On mongo1.mycompany.com
# mongo
> rs.initiate()
{
"info2" : "no configuration specified. Using a default configuration for the set",
"me" : "mongo1.mycompany.com:27107",
"ok" : 1
}
rs_paxata:SECONDARY> rs.conf()
{
"_id" : "rs_paxata",
"version" : 1,
"protocolVersion" : NumberLong(1),
"members" : [
{
"_id" : 0,
"host" : "mongo1.mycompany.com:27107",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
}
],
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"getLastErrorModes" : {
},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
},
"replicaSetId" : ObjectId("590a63a5891b438519ce4c71")
}
}
rs.add("mongo2.mycompany.com:27107")
rs.add("mongo3.mycompany.com:27107")
rs.status()
rs.slaveOk()
vi /usr/local/paxata/server/config/database.properties
mongo.hosts=mongo1.mycompany.com:27107,mongo2.mycompany.com:27107,mongo3.mycompany.com:27107