Skip to content

安装教程

下载

mongo

视频讲解

上传到服务器并解压

sh
 tar zxvf mongodb-linux-x86_64-rhel8-8.0.3.tgz
 cp mongodb-linux-x86_64-rhel8-8.0.3 /usr/local/mongodb

 mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork

 #关闭进程
 mongod -f /etc/mongod.conf --shutdown

 #建立普通账号
 groupadd mongo -g 777
 useradd mongo -g 777 -u 777 -M -s /sbin/nologin
sh
/etc/mongod.conf
storage:
  dbPath: /mydata/mongodb/data/
#  journal:
#    enabled: true

# 指定与日志有关的信息,把日志输出到file文件夹
systemLog:
  destination: file
  quiet: true
  logAppend: false
  path: /mydata/mongodb/logs/log.log
#配置与网络有关的信息, mongodb 默认端口 27017
net:
  port: 27017
  bindIp: 0.0.0.0
processManagement:
  fork: true
security:
  authorization: enabled