Posts

Showing posts with the label rs.status()

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: issue with specifying localhost in replica set configuration

Often time when we want to quickly spin up a demo mongodb replica set, we would simply use the localhost:port to specify the nodes assuming all members are on the same server. Here is an quick example why that's not a good practice Here is the output of my current rs.status() MongoDB Enterprise biDemo:PRIMARY> conf= rs.conf() {         "_id" : "biDemo",         "version" : 5,         "protocolVersion" : NumberLong(1),         "members" : [                 {                         "_id" : 0,                         "host" : "localhost:31111",                         "arbiterOnly" : false,                         "b...

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....