亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

nosql - 如何使用bash腳本安全關(guān)閉mongodb服務(wù)的進(jìn)程?
巴扎黑
巴扎黑 2017-04-21 10:57:16
0
4
813

我直接kill掉mongodb的服務(wù)進(jìn)程,下一次啟動(dòng)的時(shí)候就會(huì)出現(xiàn)unclean shutdown的提示。
我知道進(jìn)入mongo程序進(jìn)入mongo自己的shell可以關(guān)閉服務(wù),不過如果我要使用bash將如何實(shí)現(xiàn)呢?
我知道m(xù)ongo有一個(gè)--eval參數(shù),可以直接運(yùn)行命令,但如果我直接--eval "db.shutdownServer()"的話老是出現(xiàn)讓我use admin的提示,但是如果我--eval "use admin;db.shutdownServer()"的話呢又說我語(yǔ)法錯(cuò)誤,真不知道要怎么弄才能對(duì)

巴扎黑
巴扎黑

reply all(4)
Peter_Zhu

I found the answer to this question myself:

./mongo admin --eval "shutdownServer()"

That’s it. Of course, if you have a port or password, please add the corresponding parameters. The format can be seen in ./mongo --help
The reason why I have been asking this question before is because --help says that adding a username requires -u username, which is similar to mysql, but I have tried it

-u admin --eval "db.shutdownServer()"

Still not working, I don’t know if it’s a bug

阿神

Please try to use the kill -2 command to close the corresponding mongod process

劉奇

./mongo ip:port/admin --eval "db.shutdownServer()"

PHPzhong
mongo -u zhangsan -p 123456  127.0.0.1:27277/admin --eval "db.shutdownServer()"
使用這個(gè)命令,配合supervisor簡(jiǎn)直是爽到爆
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template