mongodb-安装配置
Packages
Package Name | Description |
---|---|
mongodb-org |
A metapackage that will automatically install the four component packages listed below. |
mongodb-org-server |
Contains the mongod daemon, associated init script, and a configuration file(/etc/mongod.conf ). You can use the initialization script to start mongod with the configuration file. For details, see Run MongoDB Community Edition. |
mongodb-org-mongos |
Contains the mongos daemon. |
mongodb-org-shell |
Contains the mongo shell. |
mongodb-org-tools |
Contains the following MongoDB tools: mongoimport bsondump , mongodump , mongoexport , mongofiles , mongorestore , mongostat , and mongotop . |
rpm安装启动
yum localinstall mongodb-org-server-4.0.4-1.el7.x86_64.rpm rpm -ivh mongodb-org-4.0.4-1.el7.x86_64.rpm mongodb-org-mongos-4.0.4-1.el7.x86_64.rpm mongodb-org-shell-4.0.4-1.el7.x86_64.rpm mongodb-org-tools-4.0.4-1.el7.x86_64.rpm systemctl start mongod [root@VM_0_3_centos ~]# netstat -lntp|grep mongod tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 5286/mongod
源码包启动
[root@webmaster mongodb]# ./bin/mongod --config ./mongodb.conf about to fork child process, waiting until server is ready for connections. forked process: 119286 child process started successfully, parent exiting
关闭服务
> use admin switched to db admin > db.shutdownServer() server should be down... #进入shell关闭服务,不要用kill -9,会导致数据混乱
配置优化
echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled