mongodb Failed: error connecting to db server: no reachable servers
2016-03-29 15:37
295 查看
I installed mongodb in Ubuntu14.04 server
在Ubuntu14.04上安装MongoDB
I was not able to connect to mongodb via "mongoimport", "mongodump", "mongostat", etc. It always show "no reachable server"
不能通过 "mongoimport", "mongodump", "mongostat"等命令连接到MongoDB,一直报错:
"no
reachable server"
Somehow, I was able to connect with mongo shell
但是,我可以连接到mongo shell
At first, I doubt if it cause by my iptables, so I flush all iptables rules and create rules for ALL accept, but it still same
开始时,我怀疑是我的iptables出错,所以我刷新iptables规则,为ALL accept创建规则,但还是出错。
I search the stackOverflow and google and someone told marked off bind_ip or set bind_ip to 0.0.0.0, I tried all but still failed.
我搜索了stackOerflow和Google,有人说把bind_ip设为0.0.0.0,但还是失败了。
Below are my mangodb config, would any one can help me to check? Thanks for your help
下面是我的配置信息,有人知道哪里出错了吗?
A temporary workaround (worked for me) is to add the "host" param:
(Source: ranjeetcao @ mongorestore Failed: no reachable servers)
Update:
Updating to Mongo >= 3.0.7 should solve the issue
(Source: Colin Marshall @ mongorestore Failed: no reachable servers)
更新MongoDB到3.0.7版本以上,成功解决问题。
原文来自:http://stackoverflow.com/questions/32195997/mongodb-failed-error-connecting-to-db-server-no-reachable-servers
I tried to restore mongo from dump but failed:
Although I can connect to it without any problem:
In a log file there is nothing special:
Host
help
Although I can still connect using
Host
help as well:
I have 3.2 version of MongoDb:
anwser1:
try adding host param
anwser2:
I have MongoDB installed through Homebrew, and was having this issue. Here are the symptoms:
These failed:
The error I got:
These worked (as a workaround):
This fixed the problem for me:
That updated MongoDB to 3.0.7 and now
原文来自:http://stackoverflow.com/questions/30093744/mongorestore-failed-no-reachable-servers/33139963#33139963
在Ubuntu14.04上安装MongoDB
I was not able to connect to mongodb via "mongoimport", "mongodump", "mongostat", etc. It always show "no reachable server"
不能通过 "mongoimport", "mongodump", "mongostat"等命令连接到MongoDB,一直报错:
"no
reachable server"
mongoimport --db test --collection restaurants --drop --file dataset.json 2015-08-25T13:08:29.802+0800 [........................] test.restaurants 0.0 B/11.3 MB (0.0%) 2015-08-25T13:08:30.306+0800 Failed: error connecting to db server: no reachable servers 2015-08-25T13:08:30.306+0800 imported 0 documents
Somehow, I was able to connect with mongo shell
但是,我可以连接到mongo shell
mongo --port 27017 MongoDB shell version: 3.0.6 connecting to: 127.0.0.1:27017/test
At first, I doubt if it cause by my iptables, so I flush all iptables rules and create rules for ALL accept, but it still same
开始时,我怀疑是我的iptables出错,所以我刷新iptables规则,为ALL accept创建规则,但还是出错。
sudo iptables -S -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -A INPUT -j ACCEPT -A INPUT -i lo -j ACCEPT -A FORWARD -j ACCEPT -A OUTPUT -j ACCEPT -A OUTPUT -o lo -j ACCEPT
I search the stackOverflow and google and someone told marked off bind_ip or set bind_ip to 0.0.0.0, I tried all but still failed.
我搜索了stackOerflow和Google,有人说把bind_ip设为0.0.0.0,但还是失败了。
Below are my mangodb config, would any one can help me to check? Thanks for your help
下面是我的配置信息,有人知道哪里出错了吗?
james@localhost:~$ cat /etc/mongod.conf # mongod.conf # Where to store the data. # Note: if you run mongodb as a non-root user (recommended) you may # need to create and set permissions for this directory manually, # e.g., if the parent directory isn't mutable by the mongodb user. dbpath=/var/lib/mongodb #where to log logpath=/var/log/mongodb/mongod.log logappend=true port = 27017 # Listen to local interface only. Comment out to listen on all interfaces. #bind_ip = 127.0.0.1 # Disables write-ahead journaling # nojournal = true # Enables periodic logging of CPU utilization and I/O wait #cpu = true # Turn on/off security. Off is currently the default #noauth = true #auth = true # Verbose logging output. verbose = true # Inspect all client data for validity on receipt (useful for # developing drivers) #objcheck = true # Enable db quota management #quota = true # Set oplogging level where n is # 0=off (default) # 1=W # 2=R # 3=both # 7=W+some reads #diaglog = 0 # Ignore query hints #nohints = true # Enable the HTTP interface (Defaults to port 28017). #httpinterface = true # Turns off server-side scripting. This will result in greatly limited # functionality #noscripting = true # Turns off table scans. Any query that would do a table scan fails. #notablescan = true # Disable data file preallocation. #noprealloc = true # Specify .ns file size for new databases. # nssize = <size> # Replication Options # in replicated mongo databases, specify the replica set name here #replSet=setname # maximum size in megabytes for replication operation log #oplogSize=1024 # path to a key file storing authentication info for connections # between replica set members #keyFile=/path/to/keyfile
A temporary workaround (worked for me) is to add the "host" param:
mongoimport --host=127.0.0.1
(Source: ranjeetcao @ mongorestore Failed: no reachable servers)
Update:
Updating to Mongo >= 3.0.7 should solve the issue
(Source: Colin Marshall @ mongorestore Failed: no reachable servers)
更新MongoDB到3.0.7版本以上,成功解决问题。
原文来自:http://stackoverflow.com/questions/32195997/mongodb-failed-error-connecting-to-db-server-no-reachable-servers
I tried to restore mongo from dump but failed:
mongorestore --port 27133 dump 2015-05-07T09:39:11.760+0300 Failed: no reachable servers
Although I can connect to it without any problem:
$ mongo --port 27133 MongoDB shell version: 3.0.1 connecting to: 127.0.0.1:27133/test
In a log file there is nothing special:
2015-05-07T09:37:00.350+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44901 #1 (1 connection now open) 2015-05-07T09:37:13.935+0300 I NETWORK [conn1] end connection 127.0.0.1:44901 (0 connections now open) 2015-05-07T09:39:08.752+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44906 #2 (1 connection now open) 2015-05-07T09:39:11.763+0300 I NETWORK [conn2] end connection 127.0.0.1:44906 (0 connections now open) 2015-05-07T09:39:52.365+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44907 #3 (1 connection now open) 2015-05-07T09:39:55.064+0300 I NETWORK [conn3] end connection 127.0.0.1:44907 (0 connections now open) 2015-05-07T09:40:11.272+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44909 #4 (1 connection now open) 2015-05-07T09:40:14.281+0300 I NETWORK [conn4] end connection 127.0.0.1:44909 (0 connections now open)
Update
Host 127.0.0.1didn't
help
$ mongorestore --host=127.0.0.1 --port=27132 dump 2015-12-16T18:52:33.270+0300 Failed: no reachable servers
Although I can still connect using
mongocommand:
$ mongo --host=127.0.0.1 --port=27133 MongoDB shell version: 3.2.0 connecting to: 127.0.0.1:27133/test > ^C bye
Host
0.0.0.0didn't
help as well:
$ mongorestore --host=0.0.0.0 --port=27133 dump
I have 3.2 version of MongoDb:
$ mongorestore --version mongorestore version: 3.2.0-rc5 git version: 6186100ad0500c122a56f0a0e28ce1227ca4fc88
anwser1:
try adding host param
mongorestore --host=127.0.0.1 --port=27133 dump
anwser2:
I have MongoDB installed through Homebrew, and was having this issue. Here are the symptoms:
These failed:
mongorestore dump
mongorestore dump --host=localhost
The error I got:
Failed: error connecting to db server: no reachable servers
These worked (as a workaround):
mongorestore dump --host=127.0.0.1
mongorestore dump --host=0.0.0.0
This fixed the problem for me:
brew update && brew upgrade
That updated MongoDB to 3.0.7 and now
mongorestore dumpworks without the host flag.
shareimprove this answer |
相关文章推荐
- 70. Climbing Stairs
- kmalloc fail导致系统异常
- Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
- Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
- SLF4J: Class path contains multiple SLF4J bindings.
- CodeForces 635D Factory Repairs(树状数组)
- lightoj 1071 - Baker Vai DP
- Codeforces 652C Foe Pairs 【dp】
- 【redis】WRONGTYPE Operation against a key holding
- Hive安装报错:Terminal initialization failed; falling back to unsupported
- NSLayoutConstraint
- CDC的四个派生类CClientDC,CPaintDC,CWindowDC,CMetaFileD
- LeetCode 219 Contains Duplicate II
- CodeIgniter基于Email类发邮件的方法
- 用Paint Tool SAI绘制漫画
- svn cleanup failed–previous operation has not finished; run cleanup if it was in
- failed to lazily initialize a collection of role
- Ubuntu raid5+lvm实验
- leetcode 11.Container With Most Water
- mybaits generator自动生成model、xml、dao