配置MongoDb配置文件

编程入门 行业动态 更新时间:2024-10-13 06:19:46

配置MongoDb<a href=https://www.elefans.com/category/jswz/34/1770506.html style=配置文件"/>

配置MongoDb配置文件

一、配置MongoDb配置文件

[root@lgy conf]# vim /opt/mongodb/conf/mongo.conf
systemLog:					#系统日志destination: file		#日志保存类型path: "/opt/mongodb/log/mongod.log"	#日志保存路径logAppend: true			#如果为 true,当 mongod/mongos 重启后,将在现有日志的尾部继续添加日志。否则,将会备份当前日志文件,然后创建一个新的日志文件;默认为 false。
storage:							#存储dbPath: "/opt/mongodb/data/"		#数据存储目录journal:enabled: true
processManagement:fork: true				#后台运行
net:bindIp: 127.0.0.1,10.0.0.169		#绑定的ipport: 27017				#端口

启动命令:

[root@lgy opt]# mongod -f /opt/mongodb/conf/mongod.conf --fork

二、配置mongodb使用systemd管理

[root@lgy conf]# cat > /etc/systemd/system/mongod.service <<EOF
[Unit]
Description=mongodb 
After=network.target remote-fs.target nss-lookup.target
[Service]
User=mongod
Type=forking
ExecStart=/opt/mongodb/bin/mongod --config /opt/mongodb/conf/mongo.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/opt/mongodb/bin/mongod --config /opt/mongodb/conf/mongo.conf --shutdown
PrivateTmp=true  
[Install]
WantedBy=multi-user.target
EOF[root@lgy opt]# systemctl daemon-reload
[root@lgy opt]# systemctl restart mongod
[root@lgy opt]# systemctl stop mongod
[root@lgy opt]# systemctl start mongod

更多推荐

配置MongoDb配置文件

本文发布于:2024-02-25 00:58:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1697263.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:配置文件   MongoDb

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!