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