0

Here are the logs for my mongodb status which show in it is in running status

ubuntu@ip-172-31-9-130:/etc$ sudo service mongod status
● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: 
   Active: active (running) since Fri 2018-09-28 09:50:43 UTC; 37min ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 28315 (mongod)
   CGroup: /system.slice/mongod.service
           └─28315 /usr/bin/mongod --config /etc/mongod.conf

Sep 28 09:50:43 ip-172-31-9-130 systemd[1]: Started MongoDB Database Server.
Sep 28 09:50:43 ip-172-31-9-130 mongod[28315]: 2018-09-28T09:50:43.848+0000 I CO
lines 1-10/10 (END)

But when I connect it with robomongo it throws error

Failed to connect to the server

Please help!!!

Dark Knight
  • 995
  • 4
  • 22
  • 48
  • The current version of Robo 3T (1.2 as at Oct 2018) embeds the MongoDB 3.4 shell and is not fully compatible with newer versions of MongoDB server. You should look for an alternative admin UI that is actively updated. Your MongoDB 4.0 installation should have included a compatible version of the [MongoDB Compass GUI](https://www.mongodb.com/products/compass), but there are other options available. – Stennie Sep 28 '18 at 10:48
  • @Stennie Thank you for the reply but I have checked with compass as well. – Dark Knight Sep 28 '18 at 10:57
  • Check your mongodb config file. bind_ip etc. – nercan Sep 28 '18 at 15:11
  • @nercan When I bind the port then it doesn't get restarted the mongo server – Dark Knight Sep 29 '18 at 05:52
  • Are you connecting to your `mongod` from a remote client or the same server? Your shell output suggests the server is running on a [private network IP](https://en.wikipedia.org/wiki/Private_network) (`172.31.*`) , so your remote client would need to be on the same network (for example, connecting via `ssh` or VPN). – Stennie Sep 29 '18 at 06:43
  • @Stennie My mongodb instance is running on the remote client. I can use mongo shell on the remote server. The only issue is I am not able to connect it with robomongo or compass or even with nodejs locally. Kindly help!!! – Dark Knight Sep 29 '18 at 07:22
  • As mentioned in an earlier comment, if you are connecting from your local environment to a remote server running on a private network IP you will need to use `ssh` or a VPN to tunnel into the remote network to connect. Most admin clients support connecting over SSH. For example, see: [MongoDB Compass: Connect Using SSH](https://docs.mongodb.com/compass/master/connect/). If you want to use the Node driver or another application that doesn't have built-in SSH support, you can use [SSH port forwarding](https://www.ssh.com/ssh/tunneling/example) to set up a local port. – Stennie Oct 03 '18 at 06:00
  • @Stennie I am having the same problem not able to connect with remote server mongo. Also I have tried with compass it throws error `Could not connect to MongoDB on the provided host and port` and with robomongo `Cannot connect to the MongoDB at 13.56.140.11:27017.` – Ashh Mar 15 '19 at 09:51
  • @Stennie What your profile says [**#SOreadytohelp**](https://stackoverflow.com/users/1388319/stennie). So please help me out. – Ashh Mar 29 '19 at 12:44
  • @AnthonyWinzlet "Failed to connect to server" is a generic issue but I suspect this specific problem related to using a private network IP (172.*). Please post details of your environment as a new question on DBA StackExchange: MongoDB server version, O/S version, client version, and bindIP config would be helpful. If you can't connect to a remote server, usual suspects to check would be bindIP (is the server listening to a network interface your client has a route to?), firewall / security group (is the port open for your client to connect to?), and client version (try with `mongo` first). – Stennie Mar 30 '19 at 00:10
  • @Stennie Please have a look https://dba.stackexchange.com/questions/233556/connect-mongodb-4-0-with-robomongo – Ashh Mar 30 '19 at 07:08

0 Answers0