标签:环境 init reload fork 创建数据库 style fun database ret
tar -zxvf mongodb-linux-x86_64-4.0.0.tgz
[root@nam-qa2 software]# mv mongodb-linux-x86_64-4.0.0 mongodb
#Set Mongodb MONGODB_HOME=/software/mongodb PATH=$PATH:$MONGODB_HOME/bin
cd /software/mongodb
$ touch mongodb.conf
$ mkdir db
$ mkdir log
$ cd log
$ touch mongodb.log
port=27017 dbpath= /software/mongodb/db logpath= /software/mongodb/log/mongodb.log logappend=true fork=true maxConns=100 noauth=true journal=true storageEngine=wiredTiger bind_ip = 0.0.0.0
cd /software/mongodb
bin/mongod -f /software/mongodb/mongo.conf
[Unit] Description=mongodb After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/software/mongodb/bin/mongod --config /software/mongodb/bin/mongodb.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/software/mongodb/bin/mongod --shutdown --config /software/mongodb/bin/mongodb.conf PrivateTmp=true [Install] WantedBy=multi-user.target
#!/bin/sh # #mongod - Startup script for mongod # # chkconfig: - 85 15 # description: Mongodb database. # processname: mongod # Source function library . /etc/rc.d/init.d/functions # things from mongod.conf get there by mongod reading it # OPTIONS OPTIONS=" --dbpath=/software/mongodb/ --logpath=/software/mongodb/log/mongodb.log --logappend &" #mongod mongod="/software/mongodb/bin/mongod" lockfile=/var/lock/subsys/mongod start() { echo -n $"Starting mongod: " daemon $mongod $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile } stop() { echo -n $"Stopping mongod: " killproc $mongod -QUIT RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile } restart () { stop start } ulimit -n 12000 RETVAL=0 case "$1" in start) start ;; stop) stop ;; restart|reload|force-reload) restart ;; condrestart) [ -f $lockfile ] && restart || : ;; status) status $mongod RETVAL=$? ;; *) echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" RETVAL=1 esac exit $RETVAL
标签:环境 init reload fork 创建数据库 style fun database ret
原文地址:https://www.cnblogs.com/wongandy/p/11874725.html