mongodb Failed: error connecting to db server: no reachable servers -
i installed mongodb in ubuntu14.04 server
i not able connect mongodb via "mongoimport", "mongodump", "mongostat", etc. show "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 db server: no reachable servers 2015-08-25t13:08:30.306+0800 imported 0 documents
somehow, able connect mongo shell
mongo --port 27017 mongodb shell version: 3.0.6 connecting to: 127.0.0.1:27017/test
at first, doubt if cause iptables, flush iptables rules , create rules accept, still same
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 stackoverflow , google , told marked off bind_ip or set bind_ip 0.0.0.0, tried still failed.
below mangodb config, 1 can me check? help
james@localhost:~$ cat /etc/mongod.conf # mongod.conf # store data. # note: if run mongodb non-root user (recommended) may # need create , set permissions directory manually, # e.g., if parent directory isn't mutable mongodb user. dbpath=/var/lib/mongodb #where log logpath=/var/log/mongodb/mongod.log logappend=true port = 27017 # listen local interface only. comment out listen on interfaces. #bind_ip = 127.0.0.1 # disables write-ahead journaling # nojournal = true # enables periodic logging of cpu utilization , i/o wait #cpu = true # turn on/off security. off default #noauth = true #auth = true # verbose logging output. verbose = true # inspect client data validity on receipt (useful # developing drivers) #objcheck = true # enable db quota management #quota = true # set oplogging level n # 0=off (default) # 1=w # 2=r # 3=both # 7=w+some reads #diaglog = 0 # ignore query hints #nohints = true # enable http interface (defaults port 28017). #httpinterface = true # turns off server-side scripting. result in limited # functionality #noscripting = true # turns off table scans. query table scan fails. #notablescan = true # disable data file preallocation. #noprealloc = true # specify .ns file size new databases. # nssize = <size> # replication options # in replicated mongo databases, specify replica set name here #replset=setname # maximum size in megabytes replication operation log #oplogsize=1024 # path key file storing authentication info connections # between replica set members #keyfile=/path/to/keyfile
a temporary workaround add host
param mongoimport
call, letting mongo know host own machine (127.0.0.1
):
mongoimport --host=127.0.0.1
the full command in case then:
mongoimport --host=127.0.0.1 \ --db test --collection restaurants --drop --file dataset.json
(source: ranjeetcao @ mongorestore failed: no reachable servers)
update:
updating mongo >= 3.0.7 should solve issue
(source: colin marshall @ mongorestore failed: no reachable servers)
update 2:
it seems bug is still happening users.
there's open jira issue here.
(source: james chien @ this question thread)
update 3:
in cases, can caused mongo running replicaset. solve this, far i've seen, 1 can either disable replicaset functionality or reset it. see:
(source: maxim yefremov @ mongorestore failed: no reachable servers)
Comments
Post a Comment