Cannot connect to mongodb using machine ip -
installed mongo
using homebrew
. if type mongo
on shell, gets connected test
. when type ip address
of local machine instead of 127.0.0.1
mongo --host 192.168.1.100 --verbose
it gives me error message
mongodb shell version: 2.4.6 fri aug 23 15:18:27.552 versionarraytest passed connecting to: 192.168.1.100:27017/test fri aug 23 15:18:27.579 creating new connection to:192.168.1.100:27017 fri aug 23 15:18:27.579 backgroundjob starting: connectbg fri aug 23 15:18:27.580 error: couldn't connect server 192.168.1.100:27017 @ src/mongo/shell/mongo.js:147 fri aug 23 15:18:27.580 user assertion: 12513:connect failed
have tried modifying mongo.conf
commenting bind_ip
or changing ip address 127.0.0.1
0.0.0.0
no luck. should simple have no clue now. using mac.
thanks
update: requested. works after have made changes suggested.
ifconfig output
lo0: flags=8049<up,loopback,running,multicast> mtu 16384 options=3<rxcsum,txcsum> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 gif0: flags=8010<pointopoint,multicast> mtu 1280 stf0: flags=0<> mtu 1280 en0: flags=8863<up,broadcast,smart,running,simplex,multicast> mtu 1500 options=b<rxcsum,txcsum,vlan_hwtagging> ether xx:xx:xx: media: autoselect (none) status: inactive en1: flags=8863<up,broadcast,smart,running,simplex,multicast> mtu 1500 ether xx:xx:xx:xx:01 inet6 xxxx:xxxx:xxxx: %en1 prefixlen 64 scopeid 0x5 inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255 media: autoselect status: active p2p0: flags=8843<up,broadcast,running,simplex,multicast> mtu 2304 ether xx:xx:xx:xx:xx media: autoselect status: inactive fw0: flags=8863<up,broadcast,smart,running,simplex,multicast> mtu 4078 lladdr xx:xx:xx:xx media: autoselect <full-duplex> status: inactive
output when executing command mongo --host 192.168.1.100 --verbose
mongodb shell version: 2.4.5 fri aug 23 16:42:09.806 versionarraytest passed connecting to: 192.168.1.100:27017/test fri aug 23 16:42:09.837 creating new connection to:192.168.1.100:27017 fri aug 23 16:42:09.837 backgroundjob starting: connectbg fri aug 23 16:42:10.129 connected connection! server has startup warnings: fri aug 23 16:41:59.025 [initandlisten] fri aug 23 16:41:59.025 [initandlisten] ** warning: soft rlimits low. number of files 256, should @ least 1000
file mongod.conf
# store data in /usr/local/var/mongodb instead of default /data/db dbpath = /usr/local/var/mongodb # append logs /usr/local/var/log/mongodb/mongo.log logpath = /usr/local/var/log/mongodb/mongo.log logappend = true # accept local connections bind_ip = 0.0.0.0`
i tested on mac homebrew, works fine if change bind address. suspect didn't config bind correct?
just have information, can paste output of ifconfig
please?
by default, mongodb should listen on interfaces, shouldn't need change configuration, however, homebrew setup seems override (/usr/local/etc/mongod.conf):
# accept local connections bind_ip = 127.0.0.1
please kill mongodb , run (note -v):
$ mongod --bind_ip 0.0.0.0 -v warning: bind_ip of 0.0.0.0 unnecessary; listens on ips default output going to: /usr/local/var/log/mongodb/mongo.log
just paste output please?
and try:
$ mongo --host 192.168.43.2 --verbose mongodb shell version: 2.4.6 sat aug 24 09:07:14.556 versionarraytest passed connecting to: 192.168.43.2:27017/test sat aug 24 09:07:14.657 creating new connection to:192.168.43.2:27017 sat aug 24 09:07:14.657 backgroundjob starting: connectbg sat aug 24 09:07:14.657 connected connection! server has startup warnings: sat aug 24 09:06:44.360 [initandlisten] sat aug 24 09:06:44.360 [initandlisten] ** warning: soft rlimits low. number of files 256, should @ least 1000 >
obviously replace ip address. let know how goes.
Comments
Post a Comment