码迷,mamicode.com
首页 > 数据库 > 详细

mongodb4.2.2 centos 单机安装

时间:2019-12-16 22:41:16      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:round   init   data   lib   tasksmax   tab   tar   x86   style   

下载 rpm包

wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/RPMS/mongodb-org-server-4.2.2-1.el7.x86_64.rpm
wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/RPMS/mongodb-org-mongos-4.2.2-1.el7.x86_64.rpm
wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/RPMS/mongodb-org-tools-4.2.2-1.el7.x86_64.rpm
wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/RPMS/mongodb-org-shell-4.2.2-1.el7.x86_64.rpm

安装

yum -y install mongodb-org-*

修改mogod.service

cd /usr/lib/systemd/system

修改内容

[root@localhost system]# cat mongod.service 
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network.target

[Service]
User=mongod
Group=mongod
Environment="OPTIONS=-f /etc/mongod.conf"
EnvironmentFile=-/etc/sysconfig/mongod
ExecStart=/usr/bin/mongod $OPTIONS
ExecStartPre=/usr/bin/chown -R  mongod:mongod /var/lib/mongo
ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
ExecStartPre=/usr/bin/chown -R  mongod:mongod /var/run/mongodb
ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
PermissionsStartOnly=true
PIDFile=/var/run/mongodb/mongod.pid
Type=forking
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

[Install]
WantedBy=multi-user.target

注意红色的地方是比默认文件多的地方, 否则可能会出现启动失败的问题

如果启动失败,可以查看mongo的日志

cd /var/log/mongodb
[root@localhost mongodb]# ll
total 68
-rw-r-----. 1 mongod mongod 65917 Dec 17 05:20 mongod.log
[root@localhost mongodb]# 

mongodb4.2.2 centos 单机安装

标签:round   init   data   lib   tasksmax   tab   tar   x86   style   

原文地址:https://www.cnblogs.com/xiaojf/p/12051527.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!