Mongodb之使用rpm包安装配置启动

  下载rpm包

wget https://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/RPMS/mongodb-org-3.2.2-1.el7.x86_64.rpm
wget https://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/RPMS/mongodb-org-tools-3.2.20-1.el7.x86_64.rpm
wget https://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/RPMS/mongodb-org-shell-3.2.20-1.el7.x86_64.rpm
wget https://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/RPMS/mongodb-org-server-3.2.20-1.el7.x86_64.rpm
wget https://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/RPMS/mongodb-org-mongos-3.2.20-1.el7.x86_64.rpm

  安装

rpm -ivh mongodb-org-3.2.20-1.el7.x86_64.rpm         mongodb-org-server-3.2.20-1.el7.x86_64.rpm  mongodb-org-tools-3.2.20-1.el7.x86_64.rpm
mongodb-org-mongos-3.2.20-1.el7.x86_64.rpm  mongodb-org-shell-3.2.20-1.el7.x86_64.rpm

  修改配置文件/etc/mongod.conf

systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log
storage:
  dbPath: /data/mongo
  journal:
    enabled: true
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
net:
  port: 27017
  bindIp: 127.0.0.1  # Listen to local interface only, comment to listen on all interfaces.

  启动

 systemctl start mongod

  连接

mongo --host 127.0.0.1:27017

猜你喜欢

转载自www.cnblogs.com/minseo/p/9145906.html