mongo配置及开机自启动设置


1.设置开机自启动脚本
root# vi /etc/rc.local
//================rc.local内容=============================
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#

/root/mstartd   #开机执行此脚本,自动开启mongo server

exit 0
//============================================================
2. vim /root/mstartd     主脚本
//====================/root/mstartd内容=======================
#!/bin/sh

/Apps/mongo_report/bin/mstartd //mongo服务子脚本
//============================================================

3.vi /Apps/mongo_report/bin/mstartd
//====================/Apps/mongo_report/bin/mstartd内容======
#!/bin/sh
# chkconfig: 2345 99 99
# description: start mongod

# limit memory 32G
#ulimit -m 32998166 #设置可以使用的常驻内存的最大值.单位:kbytes

# limit count of open files (system default value is 1024, too small)
ulimit -n 20000 #设置内核可以同时打开的文件描述符的最大值.单位:n

# limit stack size 1M
ulimit -s 1024 #设置堆栈的最大值.单位:kbytes

# start mongod 27019
/Apps/mongo_report/bin/mongod --config /Apps/mongo_report/bin/conf/mongodb7019.conf #按脚本启动mongo
//============================================================
4.vi /Apps/mongo_report/bin/conf/mongodb7019.conf
//===============mongodb7019.conf内容===========================
port = 27019 #端口
dbpath = /Apps/mongo_report/bin/data/d7019 #数据存放位置
logpath = /Apps/mongo_report/bin/data/log/7019.log #日志
logappend = true #设置后,系统不会会清除原来的日志记录,也不会把已有的文件进行覆盖。日志以追加的方式进行记录
fork = true 指定以守护进程的方式来启动MongoDB,如果不指定,在启动mongod命令是加“&”也是可以的。
#bind_ip = 192.168.30.8,127.0.0.1 #指定对外服务的绑定ip,这里指定内网的ip方式,如果外网无特殊的处理方式是无法进行连接。
quiet = true #安静输出 ?????????
pidfilepath = /Apps/mongo_report/bin/data/d7019.pid  # PID File 的完整路径,如果没有设置,则没有PID文件
nohttpinterface = true #关闭http接口,默认关闭27018端口访问??????
nounixsocket = true # 禁用Unix套接字监听 ?????
//=========================================


参考:http://www.blogjava.net/dongbule/archive/2011/07/30/355409.html

           http://blog.csdn.net/zhengshqing/article/details/8686847

           http://itindex.net/detail/49978-mongodb-%E7%AE%A1%E7%90%86


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值