- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试在一台机器上配置分片,但在尝试添加分片时我不断收到错误消息。我使用以下网站作为引用:http://www.javahotchocolate.com/notes/mongodb-sharding.html
我正在使用一台机器并使用不同的端口来模拟不同的 IP。
我的配置如下:
副本集成员:
mongod --dbpath \rs1_p\db --port 27017 --replSet rs1
mongod --dbpath \rs1_s1\db --port 27018 --replSet rs1
mongod --dbpath \rs1_s2\db --port 27019 --replSet rs1
mongod --dbpath \rs1_p\db --port 47017 --replSet rs2
mongod --dbpath \rs1_s1\db --port 47018 --replSet rs2
mongod --dbpath \rs1_s2\db --port 47019 --replSet rs2
在 MongoDB shell 中配置副本集:
config =
{
_id:"rs1",
members:
[
{ _id:0, host:"computerName:27017" },
{ _id:1, host:"computerName:27018" },
{ _id:2, host:"computerName:27019" }
]
}
rs.initiate( config )
config =
{
_id:"rs2",
members:
[
{ _id:0, host:"computerName:47017" },
{ _id:1, host:"computerName:47018" },
{ _id:2, host:"computerName:47019" }
]
}
rs.initiate( config )
启动配置服务器:
mongod --dbpath \c1\db --configsvr --port 37017
mongod --dbpath \c2\db --configsvr --port 37018
mongod --dbpath \c3\db --configsvr --port 37019
启动分片路由器:
mongos --port 27077 --configdb computerName:37017, computerName:37018, computerName:37019
mongos --port 27078 --configdb computerName:37017, computerName:37018, computerName:37019
到这里为止一切正常,但在下一步中收到错误消息
sh.addShard('rs1/computerName:27017')
我收到以下错误:
{
"ok" : 0.0,
"errmsg" : "no such command: 'addShard', bad cmd: '{ addShard: \"rs1/computerName:27017\" }'",
"code" : 59
}
我似乎无法摆脱这个错误信息。
关于我遗漏了什么的任何想法。
谢谢
最佳答案
根据文档
Run addShard when connected to a mongos instance. The command takes the following form when adding a single database instance as a shard
当你运行这个连接到 mongo shell 时你会得到那个错误,所以你需要连接让说 mongo --port 27078
并发出那个命令。
mongo --host <hostname of machine running mongos> --port <port mongos listens on>
关于Mongodb 分片 - 没有这样的命令 : 'addShard' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37768562/
我正在尝试在一台机器上配置分片,但在尝试添加分片时我不断收到错误消息。我使用以下网站作为引用:http://www.javahotchocolate.com/notes/mongodb-shardin
一共有6个目录,每个目录大概有1TB的数据,都属于一个数据库“test”现在,我想将它们分组到一个集群中。我已经构建了 Shardserver 和 Configserver,但是在将第二个分片添加到集
我是一名优秀的程序员,十分优秀!