设为首页 加入收藏

TOP

Linux下MongoDB简介及部署使用(二)
2017-02-21 08:15:44 】 浏览:444
Tags:Linux MongoDB 简介 部署 使用
SB:-}" ] && echo -n "$base "
? ? ? ? ? ? ? ? if checkpid $pid 2>&1; then
? ? ? ? ? ? ? ? ? ? ? ? # TERM first, then KILL if not dead
? ? ? ? ? ? ? ? ? ? ? ? kill -TERM $pid >/dev/null 2>&1
? ? ? ? ? ? ? ? ? ? ? ? usleep 100000
?
? ? ? ? ? ? ? ? ? ? ? ? # Check every one second if the program is stopped.
? ? ? ? ? ? ? ? ? ? ? ? # Do so for a maximum of $delay seconds
? ? ? ? ? ? ? ? ? ? ? ? for ((i = 0 ; i < $delay; i++))
? ? ? ? ? ? ? ? ? ? ? ? do
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if checkpid $pid; then
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sleep 1
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fi
? ? ? ? ? ? ? ? ? ? ? ? done
?
? ? ? ? ? ? ? ? ? ? ? ? # If the program is not stopped, kill it
? ? ? ? ? ? ? ? ? ? ? ? if checkpid $pid ; then
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? kill -KILL $pid >/dev/null 2>&1
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? usleep 100000
? ? ? ? ? ? ? ? ? ? ? ? fi
? ? ? ? ? ? ? ? fi
? ? ? ? ? ? ? ? checkpid $pid
? ? ? ? ? ? ? ? RC=$?
? ? ? ? ? ? ? ? [ "$RC" -eq 0 ] && failure $"$base shutdown" || success $"$base shutdown"
? ? ? ? ? ? ? ? RC=$((! $RC))
? ? ? ? else
? ? ? ? ? ? ? ? failure $"$base shutdown"
? ? ? ? ? ? ? ? RC=0
? ? ? ? fi
?
? ? ? ? # Remove pid file if any.
? ? ? ? rm -f "${pid_file:-/var/run/$base.pid}"
? ? ? ? return $RC
}
?
start() {
? ? [ -x $exec ] || exit 5
? ? echo -n $"Starting $prog: "
? ? daemon --pidfile=${pidfile} --user mongodb "$exec $options run >> $logfile 2>&1"
? ? retval=$?
? ? echo
? ? [ $retval -eq 0 ] && touch $lockfile
? ? return $retval
}
?
stop() {
? ? echo -n $"Stopping $prog: "
? ? killproc_nice -p ${pidfile} -d 300 $prog
? ? retval=$?
? ? echo
? ? [ $retval -eq 0 ] && rm -f $lockfile
? ? return $retval
}
?
restart() {
? ? stop
? ? start
}
?
reload() {
? ? restart
}
?
force_reload() {
? ? restart
}
?
rh_status() {
? ? # run checks to determine if the service is running or use generic status
? ? status -p ${pidfile} $prog
}
?
rh_status_q() {
? ? rh_status >/dev/null 2>&1
}
?
?
case "$1" in
? ? start)
? ? ? ? rh_status_q && exit 0
? ? ? ? $1
? ? ? ? ;;
? ? stop)
? ? ? ? rh_status_q || exit 0
? ? ? ? $1
? ? ? ? ;;
? ? restart)
? ? ? ? $1
? ? ? ? ;;
? ? reload)
? ? ? ? rh_status_q || exit 7
? ? ? ? $1
? ? ? ? ;;
? ? force-reload)
? ? ? ? force_reload
? ? ? ? ;;
? ? status)
? ? ? ? rh_status
? ? ? ? ;;
? ? condrestart|try-restart)
? ? ? ? rh_status_q || exit 0
? ? ? ? restart
? ? ? ? ;;
? ? *)
? ? ? ? echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
? ? ? ? exit 2
esac
exit $?


Mongodb的配置文件mongodb.conf,如下:


##
### Basic Defaults
##
bind_ip = 127.0.0.1
port = 27017
fork = true
pidfilepath = /var/run/mongodb/mongodb.pid
logpath = /var/log/mongodb/mongodb.log
dbpath =/data/mongodata
journal = true
?
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
?
# Turn on/off security.? Off is currently the default
#noauth = true
#auth = true
?
# Verbose logging output.
#verbose = true
?
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
?
# Enable db quota management
#quota = true
?
# Set oplogging level where n is
#? 0=off (default)
#? 1=W
#? 2=R
#? 3=both
#? 7=W+some reads
#oplog = 0
?
# Diagnostic/debugging option
#nocursors = true
?
# Ignore query hints
#nohints = true
?
# Disable the HTTP interface (Defaults to port+1000).
nohttpinterface = true
?
# Turns off server-side scripting.? This will result in greatly limited
# functionality
#noscripting = true
?
# Turns off table scans.? Any query that would do a table scan fails.
#notablescan = true
?
# Disable data file preallocation.
#noprealloc = true
?
# Specify .ns file size for new databases.
# nssize =
?
# Accout token for Mongo monitoring server.
#mms-token =
?
# Server name for Mongo monitoring server.
#mms-name =
?
# Ping interval for Mongo monitoring server.
#mms-interval =
?
# Replication Options
?
# in replicated mongo databases, specify here whether this is a slave or master
#slav

首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇MySQL使用可重复读作为默认隔离级.. 下一篇Tornado 异步非阻塞 实验

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目