在服务器上设置mongodb分片集群开机自启动

本文档详细介绍了如何在服务器上设置MongoDB分片集群在开机时自动启动。涉及步骤包括配置各分片节点的config.conf、mongos.conf及shard*.conf文件,并将mongod脚本置于/etc/init.d目录下,赋予执行权限。通过`service mongod start`和`service mongod stop`命令管理服务,并使用ln命令将其链接到/etc/rcS.d/S99mongod以确保服务器重启时自动启动。
摘要由CSDN通过智能技术生成

服务器上的配置文件

config.conf

#config.conf
configsvr=true
#where to log
logpath=/home/mongodb/bin/mongodbData/config/log/config.log
logappend=true
#where to dbpath
dbpath=/home/mongodb/bin/mongodbData/config/data
#where to pid
pidfilepath=/home/mongodb/bin/mongodbData/run/config.pid
#port
port=11000
#fork and run in background
fork=true

mongos.conf

#mongos.conf
configdb=xx.xx.x0.xx:11000
#where to log
logpath=/home/mongodb/bin/mongodbData/mongos/log/mongos.log
logappend=true
#where to pid
pidfilepath=/home/mongodb/bin/mongodbData/run/mongos.pid
#port
port=13000
#fork and run in background
fork=true

shard1.conf

#shard1.conf
shardsvr=true
#where to log
logpath=/home/mongodb/bin/mongodbData/shard1/log/shard1.log
logappend=true
#where to dbpath
dbpath=/home/mongodb/bin/mongodbData/shard1/data
#where to pid
pidfilepath=/home/mongodb/bin/mongodbData/run/shard1.pid
#port
port=12003
#fork and run in background
fork=true

shard2.conf

#shard2.conf

shardsvr=true
#where to log
logpath=/home/mongodb/bin/mongodbData/shard2/log/shard2.log
logappend=true
#where to dbpath
dbpath=/home/mongodb/bin/mongodbData/shard2/data
#where to pid
pidfilepath=/home/mongodb/bin/mongodbData/run/shard2.pid
#port
port=12001
#fork and run in background
fork=true

shard3.conf

#shard3.conf
shardsvr=true
#where to log
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值