1、mongodb下载linux
官方下载地址:https://www.mongodb.com/download-center#community mongodb
没有yueyu的用户可能下载比较缓慢,请自行解决vim
2、环境配置
centos
测试系统centos6.8 ip地址:192.168.1.197ide
一、关闭SELinux测试
vim /etc/selinux/config spa
SELINUX=disabled ip
setenforce 0 get
2.关闭防火墙it
service iptables stop
三、增长用户和组
groupadd mongodb && useradd -g mongodb mongodb
四、上传二进制包到/opt下解压并受权
cd /opt && tar -xf mongodb-linux-x86_64-rhel62-3.4.5.tgz
五、建立软链接
ln -s /opt/mongodb-linux-x86_64-rhel62-3.4.5 /usr/local/mongodb
六、更改属性
chown -R mongodb:mongodb /opt/mongodb-linux-x86_64-rhel62-3.4.5
chown -R mongodb:mongodb /usr/local/mongodb
七、配置环境变量
echo 'PATH=/usr/local/mongodb/bin:$PATH' >>/etc/profile
source /etc/profile
八、建立相关目录
mkdir -p /data/mongo/{db,log,tmp}
mkdir -p /etc/mongodb
九、建立mongodb配置文件
vim /etc/mongodb/mongo.conf
storage:
dbPath: /data/mongo/db
journal:
enabled: true
engine: wiredTiger
systemLog:
destination: file
logAppend: true
path: /data/mongo/log/mongod.log
processManagement:
fork: true # fork and run in background
pidFilePath: /data/mongo/tmp/mongod.pid
net:
port: 27017
bindIp: 192.168.1.197,127.0.0.1
security:
authorization: enabled
十、受权
chown -R mongodb:mongodb /data/mongo
chown -R mongodb:mongodb /etc/mongodb
十一、启动mongodb
su - mongodb
mongod --config /etc/mongodb/mongo.conf
#ps aux |grep mongo
mongodb 1649 0.6 1.1 1015552 46780 ? SLl 08:45 0:55 /usr/local/mongodb/bin/mongod --config /etc/mongodb/mongo.conf
mongodb 30100 0.0 0.0 103256 848 pts/0 S+ 11:08 0:00 grep mongo