MongoDB Installation On CentOS7
# add yum-source
vim /etc/yum.repos.d/mongodb-org-4.0.repo
i # into insert mode
[Esc] # quit insert mode
:wq # save file
# mongodb-org-4.0.repo
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
# install mongodb
yum install mongodb-org
# remove yum-source
rm -rf /etc/yum.repos.d/mongodb-org-4.0.repo
# config mongodb
vim /etc/mongod.conf
bindIp: 127.0.0.1 ==> bindIp: 0.0.0.0
# start mongo server
systemctl enable mongod # auto start while booting
systemctl start mongod[.service] # start mongo server
systemctl stop mongod[.service]
systemctl status mongod[.service]
systemctl stop firewalld.service # stop firewall
systemctl disable firewalld.service # disable firewall while booting
whereis mongod
# start mongo client
mongo
# quit mongo client
quit()
# MongoDB的账号密码不是全局的, 而是每个库都要单独设置, 暂不设置
本文标题:MongoDB Installation On CentOS7
本文链接:https://www.haomeiwen.com/subject/gqhyxctx.html
网友评论