[root@redhat7_6 ~]# /etc/init.d/mongodb mongod1 restart
[root@redhat7_6 ~]# /etc/init.d/mongodb mongod2 restart
[root@redhat7_6 ~]# /etc/init.d/mongodb mongod3 restart
[root@redhat7_6 ~]# /etc/init.d/mongodb mongod4 restart
[root@redhat7_6 ~]# mongo --port 27017
kgcrs:PRIMARY> use admin
kgcrs:PRIMARY> db.auth("root","123")
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx