Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb can';不要将localhost用作碎片,因为所有碎片都需要通信。在本地主机中使用所有碎片和配置数据库,或在实际IPs主机中使用所有碎片和配置数据库_Mongodb - Fatal编程技术网

Mongodb can';不要将localhost用作碎片,因为所有碎片都需要通信。在本地主机中使用所有碎片和配置数据库,或在实际IPs主机中使用所有碎片和配置数据库

Mongodb can';不要将localhost用作碎片,因为所有碎片都需要通信。在本地主机中使用所有碎片和配置数据库,或在实际IPs主机中使用所有碎片和配置数据库,mongodb,Mongodb,我在同一台主机上用不同的端口运行3个实例。这是一个测试系统。我创建了一个名为rs0的副本集。现在我正在添加shard。它显示实例在localhost上运行。甚至我也尝试了ip和环回ip 如果有人能从同一个帮助我,那就太好了。我想您在注册配置服务器(--configdb)时使用了“localhost”。你能确定用主机名启动你的mongos吗?差不多 mongos--configdb delhivery tech:27019 请大家看一下本页第一段: PS:当您的集群(副本集和/或碎片)出现问题时

我在同一台主机上用不同的端口运行3个实例。这是一个测试系统。我创建了一个名为
rs0
副本集。现在我正在添加
shard
。它显示实例在
localhost
上运行。甚至我也尝试了ip和环回ip

如果有人能从同一个帮助我,那就太好了。我想您在注册配置服务器(--configdb)时使用了“localhost”。你能确定用主机名启动你的mongos吗?差不多

mongos--configdb delhivery tech:27019

请大家看一下本页第一段:


PS:当您的集群(副本集和/或碎片)出现问题时,最好显示它的状态/配置。(rs.status()或sh.status()。这将帮助人们了解您的拓扑结构并给出更好的答案。

谢谢,这是正确的。我在本地主机上注册了它。。。现在,我用主机名替换了localhost及其工作模式。我加了碎片。
mongos> sh.addShard("rs0/delhivery-tech:27017,delhivery-tech:27018,delhivery-tech:27019");

{
    "ok" : 0,
    "errmsg" : "can't use localhost as a shard since all shards need to communicate. either use all shards and configdbs in localhost or all in actual IPs  host: delhivery-tech:27017 isLocalHost:0"
}