How To Set Mongodb To A Different Replica (Backup) Server?: Products
How To Set Mongodb To A Different Replica (Backup) Server?: Products
Page 1 of 2
Description
How to set MongoDB to a different replica (backup) server? The main server went down.
Resolution
Please review the online help.
A couple of the key consideration:
• Recommended to have at least 3 nods for MongoDB clustering
• Recommended to use the same machine for Syracuse and MongoDB
• Recommended to use a different server farm for ElasticSearch as it is memory-hungry
• The MongoDB cluster provides inbuilt automatic failover, you do not have to set this up externally
• Replicasets
◦ Install MongoDB on different physical machines
◦ Open relevent ports for the cluster
◦ Services should use the .conf file
◦ Edit mongodb.conf file: Add a section called replication and a parameter replSetName
replication:
replSetName: “ReplicaName”
• Configure the replicaset:
◦ from the command prompt, launch the mongo tool. Enter the following:
rs.initiate() // initialize replicaset
rs.add(my.second.node.com:port) // add second nodes to replicaset
rs.add(my.third.node.com:port) // add third node to replicaset
• Check replicaset configuration and status:
rs.conf() // returns replicaset configuration
rs.status() // returns replicaset status
The same procedure applies to converting an existing standalone database except that the
commands must be run from the existing initial server
• Syracuse will work as a cluster simply as soon as all web servers share the same MongoDB cluster
◦ Option 1: Each Syracuse server is set up on a the same server as MongoDB which is also set
up in cluster. For each Syracuse server choose Existing MongoDB when installing – this will
use the MongoDB instance that is on the same machine.
◦ Option 2: Set up the Syracuse server and then edit the nodelocal.js file to define the
connection URL with the MongoDB servers in the cluster.
◦ In all cases the following options must be defined in nodelocal.js for each Syracuse server
https://support.na.sage.com/selfservice/viewContent.do?externalId=92186&sliceId=1 11/27/2018
How to set MongoDB to a different replica (backup) server? Page 2 of 2
config: {
collaboration: { connectionString: “host1:port1,host2:port2,…” },
mongodb: {
options: {
db: { w: 1 },
server: {},
replSet: { rs_name: “replica_name” },
mongos: {}
}
}
• Syracuse Load Balancer
◦ Option 1: Internal Load balancer Automatically manages balancing between machines. Does
not provide any DNS switch in case of server failure.
◦ Option 2: External Load Balancer Use the internal load balancer to manage several Node child
processes within a single server, on the local machine and an external load balancer to
manage balancing between machines. DNS switch, machine auto start/stop and all relevant
parameters need to be set in nodelocal.js
config.hosting.localBalancer: true ;
• Clustering ElasticSearch
◦ Modify the configuration to set up parameter cluster.name to the desired value for all
ElasticSearch nodes.
◦ Syracuse will be set up to reference one of the ElasticSearch nodes. There is no automatic
switchover if that node fails.
Additional information
X3-105117
Category
Configuration
Out of the box setup, configuration, and modifications. Does not include customizations.
Settings and preferences
application options and setup that must be completed before using the application, including company
information, chart of accounts, sales taxes, inventory items, user profiles, groups, etc.
Entitlement
Open
ID:92186 Last modified:8-17-2018
https://support.na.sage.com/selfservice/viewContent.do?externalId=92186&sliceId=1 11/27/2018