Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

setup one member mongodb replica set

$
0
0

I want to convert a standalone machine into one member replica set by configuring the same in /etc/init.d/mongodb.

I came across the below command to do the same

sudo mongod --port 27017 --dbpath /srv/mongodb/db0 --replSet rs0

But its not working out. My mongo is configured to run on autostart. I ran the following command to stop the running instance before running with the --replSet option.

sudo service mongod stop

Both commands above run without any output/error but when I run rs.initiate(), I get the error below

{
    "ok" : 0,
    "errmsg" : "not authorized on admin to execute command { replSetInitiate: undefined }",
    "code" : 13
}

From the error message it looks like the issue seems to be of access. Can anybody give any pointers?

Also, If I succeed with above command, will I need to make any changes to /etc/mongod.conf or /etc/init.d/mongodb so that the instance continues to run as a one node replica?


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>