How to maintain mongodb config file?
I want to use mongod --dbpath with setParameter but I cannot because I can not stop mongodb on digitalocean. How can I do it?
I want to use mongod --dbpath with setParameter but I cannot because I can not stop mongodb on digitalocean. How can I do it?
You can set the parameter while MongoDB is still running. Connect to MongoDB as an admin user and run the following command:
db.getSiblingDB('admin').runCommand( { setParameter: 1, failIndexKeyTooLong: false } );
You might also need to add it to /etc/mongod.conf
or /etc/mongodb.conf
(the filename is different depending on what version of mongodb you are running):
setParameter=failIndexKeyTooLong=false
I had the respect the YAML formatting in /etc/mongodb.conf:
setParameter:
failIndexKeyTooLong: false
You can use
"service mongod stop" or
"service mongo stop" or
/etc/init.d/mongo stop or
/etc/init.d/mongod stop or
check the mongod process & kill it with below command
Killing the existing Mongo processesfor i in ps -ef | egrep 'shardsvr|configsvr|replSet|configdb' | grep -v egrep | awk -F" " '{print $2}'
; do kill -9 $i; done
Please refer to my script at http://dbversity.com/mongodb-shard-creation-script/
I need to use this parameter: "mongod --setParameter failIndexKeyTooLong=false"
But without stoping mongodb I can not do it. Else I need mongodb to use my path to DB, it uses /var/lib/mongodb, and doesn't allow me to change path with mongod --dbpath
How to turn mongodb off?