MongoDB Master Slave Setup

Resource https://www.mongodb.com/docs/v2.4/core/master-slave/ IMPORTANT If stuck, first check netstat -tulnp and mongod -f config.conf to see if it is running or not. Make sure both are on same VPC with security groups configured. Use mongod -f config_file.conf to start with forked processes to run them. Here is SECONDARY node config file slave.conf storage: dbPath: /usr/local/var/mongodb/slave net: bindIp: 0.0.0.0 port: 27017 security: authorization: enabled keyFile: /usr/local/var/mongodb/pki/replicaset-keyfile systemLog: destination: file path: /usr/local/var/log/mongodb/slave/mongod.log logAppend: true processManagement: fork: true replication: replSetName: master-slave BindIp means it is listening to IP addresses mentioned. Here 0.0.0.0 means all of them, 127.0.0.1 is same as localhost only. It must listen at 0.0.0.0 to listen to all connections as slave. ...

September 14, 2024 · 3 min