今天早上我可以在端口27010和37010上创建2个不同的mongo实例,并且我可以使用mongo-connector进行复制。但是现在系统重启后,我无法使用以下命令连接到端口37010。
C:\Program Files\MongoDB 2.6 Standard\bin>mongo --port 37010
MongoDB shell version: 2.6.12
connecting to: 127.0.0.1:37010/test
2016-09-12T18:08:14.733-0500 warning: Failed to connect to 127.0.0.1:37010, reason: errno:10061 No connection could be made because the target machine actively refused it.
2016-09-12T18:08:14.756-0500 Error: couldn't connect to server 127.0.0.1:37010 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
如果我只给mongo它只连接到27010的默认端口,它工作正常。早上我也面临同样的问题,我删除了所有的mongo Windows服务并运行没有mongo Windows服务。但我又面临着同样的问题。请建议。
以下是我的配置文件。
mongo.config.txt
##store data here
dbpath=C:\Program Files\MongoDB 2.6 Standard\data
##all output go here
logpath=C:\Program Files\MongoDB 2.6 Standard\log\mongo.log
logappend=true
#port number
port=27017
##log read and write operations
diaglog=3
#replica set name
replSet=rs1
# only run on localhost for development
bind_ip = 127.0.0.1
mongo2.config.txt
##store data here
dbpath=C:\Program Files\MongoDB 2.6 Standard\data2
##all output go here
logpath=C:\Program Files\MongoDB 2.6 Standard\log2\mongo.log
logappend=true
#port number
port=37017
##log read and write operations
diaglog=3
#replica set name
replSet=rs2
# only run on localhost for development
bind_ip = 127.0.0.1
答案 0 :(得分:0)
我按照以下博客中提到的步骤回答了我的问题。
http://zdk.github.io/create-a-three-member-mongodb-replica-set
不知怎的,配置文件对我不起作用。但我通过在命令行中执行命令解决了我的问题。