Posts

Showing posts with the label Replica Set

MongoDB tip: Apply authentication option to a replica set, issue encountered and fix

Assuming we have a replicate set started as such, please refer to article 1  or article 2 to see how to configure a replica set if you haven't already done so and still have issues. Output of ps -ef | grep mongod root     20706     1  0 15:09 ?        00:00:01 mongod --port 31111 --replSet biDemo --dbpath /data/mongodb/demo1 --logpath /data/mongodb/demolog/1.log --fork  root     20943     1  0 15:10 ?        00:00:01 mongod --port 31112 --replSet biDemo --dbpath /data/mongodb/demo2 --logpath /data/mongodb/demolog/2.log --fork root     21101     1  0 15:11 ?        00:00:01 mongod --port 31113 --replSet biDemo --dbpath /data/mongodb/demo3 --logpath /data/mongodb/demolog/3.log --fork  Log into primary and add user, you will need at least one admin user to start and administer mongod with authentication enabled MongoDB Ente...

MongoDB tip: MongoDB 3.4, creating replica set using config file

In my previous post,  MongoDB tip: MongoDB 3.4, adding replica set members, issue/resolution , we created the replica set using rs.add(), in this post, I am going to use the config file option to achieve the same result. First, let's spin up 3 mongod instances. This can be done in single servers or multiple servers, doesn't really matter, as long as for multiple servers, they can resolve the IP/hostname and communicate with one another. I edited the /etc/hosts to make sure the hostname can be resolved 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain 10.155.208.169  demo2.net demo2 10.155.228.75   demo3.net demo3 10.155.208.207  demo1.net demo1 To validate, same ping from one of the servers to the other two by, assuming from demo3 ping demo1 ping demo2 On all servers, start the mongod process as # assign ownership of /data/demo to user mongod chown -R mongod. /data/demo # this starts mongod process as user mongo...

MongoDB tip: MongoDB 3.4, adding replica set members, issue/resolution

In this post I am working with mongodb 3.4.6 on Redhat 7.x This was supposed to be a super straight forward exercise for me as I had done it a few times in the past and I'd never really encountered any issue until today. I started the mongod service as such, and I verified the process is running Note: every node in this exercise started the same way, same data mount, log mount, same port, etc. [root@msdlva-dsnopm02 apps]# mongod --port 30000 --dbpath /apps/data --logpath /apps/log/appDBlog.log & [root@msdlva-dsnopm02 apps]# ps -ef | grep mongod root 12854 23282 6 08:31 pts/0 00:00:00 mongod --port 30000 --dbpath /apps/data --logpath /apps/log/appDBlog.log root 12880 23282 0 08:32 pts/0 00:00:00 grep --color=auto mongod Then I logged into this node by issuing and started working on adding replica set member [root@msdlva-dsnopm02 apps]# mongo --port 30000 MongoDB shell version v3.4.6 connecting to: mongodb://127.0.0.1:30000/ MongoDB server version: 3....