设为首页 加入收藏

TOP

MongoDB2.6部署副本集+分区(一)
2015-12-01 16:03:14 来源: 作者: 【 】 浏览:92
Tags:MongoDB2.6 部署 副本 +分区

部署规划


一、在三个节点上创建如下目录,做测试的话建议确保在/目录有15G左右的剩余空间


[root@orcl ~]# mkdir -p /var/config


[root@orcl ~]# mkdir -p /var/sd1


[root@orcl ~]# mkdir -p /var/sd2


[root@orcl ~]# mkdir -p /var/sd3


二、查看配置文件


[root@orcl ~]# cat /etc/config.conf?


port=28000


dbpath=/var/config


logpath=/var/config/config.log


logappend=true


fork=true


configsvr=true


[root@orcl ~]# cat /etc/route.conf?


port=27017


configdb=192.168.1.30:28000,192.168.1.52:28000,192.168.1.108:28000


logpath=/var/log/mongos.log


logappend=true


fork=true


[root@orcl ~]# cat /etc/sd1.conf?


port = 27018


dbpath=/var/sd1


logpath =/var/sd1/shard1.log


logappend =true


shardsvr =true


replSet =set1


fork =true


[root@orcl ~]# cat /etc/sd2.conf ?


port = 27019


dbpath=/var/sd2


logpath =/var/sd2/shard2.log


logappend =true


shardsvr =true


replSet =set2


fork =true


[root@orcl ~]# cat /etc/sd3.conf ?


port = 27020


dbpath=/var/sd3


logpath =/var/sd3/shard1.log


logappend =true


shardsvr =true


replSet =set3


fork =true


三、在三个节点上同步时间



四、在三个节点上启动用config服务器


节点1


[root@orcl ~]# mongod -f /etc/config.conf?


about to fork child process, waiting until server is ready for connections.


forked process: 3472


child process started successfully, parent exiting


[root@orcl ~]# ps -ef |grep mongo


root ? ? ?3472 ? ? 1 ?1 19:15 ? ? ? ? ?00:00:01 mongod -f /etc/config.conf


root ? ? ?3499 ?2858 ?0 19:17 pts/0 ? ?00:00:00 grep mongo


[root@orcl ~]# netstat -anltp|grep 28000


tcp ? ? ? ?0 ? ? ?0 0.0.0.0:28000 ? ? ? ? ? ? ? 0.0.0.0:* ? ? ? ? ? ? ? ? ? LISTEN ? ? ?3472/mongod?


节点2


[root@localhost ~]# mongod -f /etc/config.conf


about to fork child process, waiting until server is ready for connections.


forked process: 2998


child process started successfully, parent exiting


[root@localhost ~]# ps -ef |grep mongo


root ? ? ?2998 ? ? 1 ?8 19:15 ? ? ? ? ?00:00:08 mongod -f /etc/config.conf


root ? ? ?3014 ?2546 ?0 19:17 pts/0 ? ?00:00:00 grep mongo


[root@localhost ~]# netstat -anltp|grep 28000


tcp ? ? ? ?0 ? ? ?0 0.0.0.0:28000 ? ? ? ? ? ? ? 0.0.0.0:* ? ? ? ? ? ? ? ? ? LISTEN ? ? ?2998/mongod ?


节点3


[root@db10g ~]# mongod -f /etc/config.conf


about to fork child process, waiting until server is ready for connections.


forked process: 4086


child process started successfully, parent exiting


[root@db10g ~]# ps -ef |grep mongo


root ? ? ?4086 ? ? 1 ?2 19:25 ? ? ? ? ?00:00:00 mongod -f /etc/config.conf


root ? ? ?4100 ?3786 ?0 19:25 pts/0 ? ?00:00:00 grep mongo


[root@db10g ~]# netstat -anltp|grep 28000


tcp ? ? ? ?0 ? ? ?0 0.0.0.0:28000 ? ? ? ? ? ? ? 0.0.0.0:* ? ? ? ? ? ? ? ? ? LISTEN ? ? ?4086/mongod ?


五、在三个节点上启动用路由服务器


节点1


[root@orcl ~]# ?mongos -f /etc/route.conf


about to fork child process, waiting until server is ready for connections.


forked process: 3575


child process started successfully, parent exiting


[root@orcl ~]# netstat -anltp|grep 2701


tcp ? ? ? ?0 ? ? ?0 0.0.0.0:27017 ? ? ? ? ? ? ? 0.0.0.0:* ? ? ? ? ? ? ? ? ? LISTEN ? ? ?3575/mongos ?


节点2


[root@localhost ~]# ?mongos -f /etc/route.conf


about to fork child process, waiting until server is ready for connections.


forked process: 3057


child process started successfully, parent exiting


[root@localhost ~]# netstat -anltp|grep 2701


tcp ? ? ? ?0 ? ? ?0 0.0.0.0:27017 ?


节点3


[root@db10g ~]# mongos -f /etc/route.conf


about to fork child process, waiting until server is ready for connections.


forked process: 4108


child process started successfully, parent exiting


[root@db10g ~]# netstat -anltp|grep 27017


tcp ? ? ? ?0 ? ? ?0 0.0.0.0:27017 ? ? ? ? ? ? ? 0.0.0.0:* ? ? ? ? ? ? ? ? ? LISTEN ? ? ?4108/mongos?


六、在三个节点启用shard


mongod -f /etc/sd1.conf


mongod -f /etc/sd2.conf


mongod -f /etc/sd3.conf


节点1


[ro

首页 上一页 1 2 3 4 下一页 尾页 1/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇通过BBED修复ORA-01190错误 下一篇Oracle 11g导入到10g引起的错误

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: