Mongdb安装部署
作者:互联网
Mongdb安装部署手册
–version v5.0.6
1、下载二进制包软件
https://www.mongodb.com/try/download/community
https://www.mongodb.com/try/download/database-tools
4.4以上的版本对程序和工具进行了功能拆分,除了下载程序,还要下载工具:
把软件上传到服务器并解压,最终程序和工具可以放在同一个目录下,比如/www/server/mongodb。
2、安装前准备工作
默认情况下 MongoDB 启动后会初始化以下两个目录:
数据存储目录:/var/lib/mongo
日志文件目录:/var/log/mongodb
useradd -s /bin/false -M mongod
mkdir -p /var/lib/mongo
mkdir -p /var/log/mongodb
编写配置文件/etc/mongod.conf
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
#auditLog:
#snmp:
3、启动
/www/server/mongodb/bin/mongod -f /etc/mongod.conf
检查启动是否正常,访问服务器的27017端口,注意要开放配置文件中的bindIp为0.0.0.0,否则拒绝访问,正常情况如下:
4、开机自启动
echo “/www/server/mongodb/bin/mongod -f /etc/mongod.conf
” >>/etc/rc.local
标签:mongod,Mongdb,部署,mongodb,www,etc,var,安装,log 来源: https://blog.csdn.net/weixin_42456117/article/details/123083193