CNode

mongodb脚本自动化部署副本集和分片

分享
TTimLiu1发布于6 年前最后回复6 年前0 回复5074 浏览0 收藏
背景

我们在本地做mongodb测试开发时,如果需要mongodb的状态是副本集或则分片集群的话,部署副本集或则分片集群需要花费大量的时间,所以写写了两个脚本一件部署副本集或则分片集群

github地址

shell to quickly deploy mongodb replica set and sharding

Environment install mongodb

 mongodb version >= 3.4 

Replica Set Deployment

bash replica-set.sh
check deploy status
mongo --port 27017
rs.status()
rs.config()

all data store in ~/srv/mongodb/replicaset

Deploy a Sharded Cluster

bash sharded-cluster.sh

config ports 30000~30002

shard_one ports 30003~30005

shard_two ports 30006~30008

mongos port 30009

shard db: db_test

shard collection: student

shard key: age

check deploy status
mongo --port 30009
sh.status()

all data store in ~/srv/mongodb

查看回复

回复 (0)

暂无回复,成为第一个参与讨论的人。
参与回复
登录后即可参与回复。登录