mongodb-安装配置

Packages

Package NameDescription
mongodb-orgmetapackage that will automatically install the four component packages listed below.
mongodb-org-serverContains 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-mongosContains the mongos daemon.
mongodb-org-shellContains the mongo shell.
mongodb-org-toolsContains the following MongoDB tools: mongoimport bsondumpmongodumpmongoexportmongofilesmongorestoremongostat, 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

  

 

 

    原文作者:MongoDB
    原文地址: https://www.cnblogs.com/jabbok/p/10072477.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞