Docker与MongoDB(3.4)副本碎片
使用docker-compose创build一个mongo分片群集。 开发,因为每个副本集和configuration是单个实例:
这是docker-compose文件:
version: '2' services: rs1_n1: image: mongo:3.4 command: mongod --shardsvr --replSet rs1 rs2_n1: image: mongo:3.4 command: mongod --shardsvr --replSet rs2 config_n1: image: mongo:3.4 command: mongod --configsvr --dbpath /data/db mongos_n1: image: mongo:3.4 command: mongos --configdb rs1/config_n1:27017,
没有问题提出副本集和configuration。 路由器(mongos)失败: Failed global initialization: FailedToParse: Empty host component parsing HostAndPort from ""
据我可以告诉从文档,我正确地传递<replicaset_name>/ip:port
参数。 是否需要一些额外的信息,因为我在docker构成中做了所有这些工作?
默认configsvr端口是27019。
试试这个: version: '2' services: rs1_n1: image: mongo:3.4 command: mongod --shardsvr --replSet rs1 rs2_n1: image: mongo:3.4 command: mongod --shardsvr --replSet rs2 config_n1: image: mongo:3.4 command: mongod --configsvr --dbpath /data/db mongos_n1: image: mongo:3.4 command: mongos --configdb rs1/config_n1:27019
要么
version: '2' services: rs1_n1: image: mongo:3.4 command: mongod --shardsvr --replSet rs1 rs2_n1: image: mongo:3.4 command: mongod --shardsvr --replSet rs2 config_n1: image: mongo:3.4 command: mongod --configsvr --dbpath /data/db --port 27017 mongos_n1: image: mongo:3.4 command: mongos --configdb rs1/config_n1:27017
您可能也有兴趣在下面的图像khezen / mongo