加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 服务器 > 系统 > 正文

Centos7 mongodb安装部署笔记

发布时间:2023-09-22 15:37:06 所属栏目:系统 来源:
导读:配置系统源

cat /etc/yum.repos.d/mongodb-org-4.2.repo

[mongodb-org-4.2]

name=MongoDB Repository

baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/

gpgch
配置系统源
 
cat /etc/yum.repos.d/mongodb-org-4.2.repo
 
[mongodb-org-4.2]
 
name=MongoDB Repository
 
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
 
gpgcheck=1
 
enabled=1
 
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
 
安装
 
yum install -y mongodb-org
 
systemctl start mongod.service
 
配置用户
 
use admin
 
db.createUser({ user:"root", pwd:"123456", roles:["root"] })
 
use test
 
db.createUser({ user:"admin", pwd:"123456", roles:["dbOwner"] })
 
修改配置文件/etc/mongod.conf
 
# mongod.conf
 
# for documentation of all options, see:
 
#   http://docs.mongodb.org/manual/reference/configuration-options/
 
# where to write logging data.
 
systemLog:
 
  destination: file
 
  logAppend: true
 
  path: /var/log/mongodb/mongod.log
 
# Where and how to store data.
 
storage:
 
  dbPath: /data/mongo
 
  journal:
 
    enabled: true
 
#  engine:
 
#  wiredTiger:
 
# how the process runs
 
processManagement:
 
  fork: true  # fork and run in background
 
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
 
  timeZoneInfo: /usr/share/zoneinfo
 
# network interfaces
 
net:
 
  port: 27017
 
  bindIp: 0.0.0.0  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
 
security:
 
  authorization: "enabled"
 
#operationProfiling:
 
#replication:
 
#sharding:
 
## Enterprise-Only Options
 
#auditLog:
 
#snmp:
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章