问题描述
我是MongoDB的新手,我想在MongoDB中实现分片,但出现了一些错误,我没有找到具体的解决方法。我执行这些命令以在不同端口上启动3台不同的服务器,默认情况下,mongo设置在端口27017上。
start mongod --replSet s1 --logpath \data\rs1\1.Log --dbpath \data\rs1 --port 27017 -- smallfiles --oplogsize64
start mongod --replSet s1 --logpath \data\rs2\2.Log --dbpath \data\rs2 --port 27018 -- smallfiles --oplogsize64
start mongod --replSet s1 --logpath \data\rs3\3.Log --dbpath \data\rs3 --port 27019 -- smallfiles --oplogsize64
现在,例如,我尝试启动服务器
mongo --port 27017
开始了,但是
mongo --port 27018
mongo --port 27019
我有此错误:
Error: couldn't connect to server 127.0.0.1:27018,connection attempt failed: SocketException: Error connecting to 127.0.0.1:27018 :: caused by :: No connection could be made because the target machine actively refused it. :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
或者如果我进一步配置:
config={_id:"s1",members:[
{_id:0,host:"localhost:37017"},{_id:1,host:"localhost:37018"},{_id:2,host:"localhost:37019"}]};
rs.initiate(config);
下一个错误是
"ok" : 0,"errmsg": "This node was not started with the replSet option","code" : 76,"codeName" : "NoReplicationEnabled"
谢谢您的帮助!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)