Visit the official Paxata Documentation portal for all of your doc needs.

Configure Mongo Replicaset

Overview

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.


Server Setup

Three Mongo Servers

mongo1.mycompany.com:27107
mongo2.mycompany.com:27107
mongo3.mycompany.com:27107

Enable Replication in Mongod.conf 

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


Start MongoDB Service

In all mongo servers,

service mongod restart


Initiate the replica set.

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

}

Verify the initial replica set configuration.

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")

}

}

Add the remaining members to the replica set.

rs.add("mongo2.mycompany.com:27107")

rs.add("mongo3.mycompany.com:27107")

 

Check the status of the replica set.

rs.status()

Query from SECONDARY MEMBER

rs.slaveOk()

Paxata Core Server setup

vi /usr/local/paxata/server/config/database.properties

mongo.hosts=mongo1.mycompany.com:27107,mongo2.mycompany.com:27107,mongo3.mycompany.com:27107

Sign In or Register to comment.