Reputation: 18629
I am trying to setup a shard and replica set.
My assumption procedure be like this :
mongo
then initiate replicasharding
via mongo
What i did :
mongod --replSet rs0 --dbpath data/rs0-0 --unixSocketPrefix data/rs0-0
mongo
then rs.initiate()
mongod --configsvr --dbpath data/rs0-0 --unixSocketPrefix data/rs0-0
-- now stucked at step 3.
Error i find is
2017-05-22T20:00:13.857+0530 [initandlisten] exception in initAndListen: 10310 Unable to lock file: data/rs0-0/mongod.lock. Is a mongod instance already running?, terminating
What i have tried :
i have tried with different directories for --unixSocketPrefix options, but each time it hits data/rs0-0/mongod.lock
the same file. So it did not worked
It seems simple issue but unable to figure out how the lock file is shared among the various mongods (whether it be config server, or replica set, or shard server)
I am on mongodb 2.6.12
Upvotes: 0
Views: 208
Reputation: 4435
You need to start mongod
and config server
with different dbpath options.
You can follow the following steps:
mongod --replSet rs0 --dbpath data/rs0-0 --unixSocketPrefix data/rs0-0
or
mongod --replSet rs0 --dbpath data/rs0-0
mongo
then rs.initiate()
mkdir -p /data/configdb
(grant required permission recursively)
mongod --configsvr --dbpath /data/configdb --port 27019
Upvotes: 2