cd /opt
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.4.3.tgz
tar -zxvf mongodb-linux-x86_64-rhel70-4.4.3.tgz
mkdir /opt/mongodb && mv /opt/mongodb/mongodb-linux-x86_64-rhel70-4.4.3/ /op/mongodb
vim /opt/mongodb/mongodb.conf
##注意对齐
systemLog:
destination: file
path: "/opt/mongodb/logs/mongodb.log"
logAppend: true
storage:
dbPath: "/opt/mongodb/data/db"
journal:
enabled: true
processManagement:
fork: true
net:
bindIp: 0.0.0.0
port: 27017
setParameter:
enableLocalhostAuthBypass: false
mkdir -p /opt/mongodb/data/db/
mkdir -p /opt/mongodb/logs/
echo "/opt/mongodb/bin/mongod --config=/opt/mongodb/mongodb.conf" > /opt/mongodb/start
chmod +x /opt/mongodb/start
sh /opt/mongodb/start //启动
echo "ps -ef|grep mongodb.conf|grep -v grep|awk ‘{printf $2}‘|xargs kill -9" > /opt/mongodb/stop //关闭
chmod +x /opt/mongodb/stop