Problem connecting my database with my ip address (cpanel)

Hi @Ousmane_DIAW - Welcome to the community!

I don’t understand why when I connect my application locally in mongodb atlas it works but when I conncete the ip address of the site it doesn’t work.

If you’re able to connect to the Atlas cluster locally but not from cPanel, it may be possible that there is a cPanel configuration issue. However to confirm this, we’ll require more information which I have requested below.

I’ve not used cPanel in the past but it appears it is a hosting platform which means you may require them to allow outbound traffic to ports 27015 to 27017 as noted here. Additionally, you can see from the following post here that it appears the cPanel support (Namecheap?) unblocked port 27017 which resolved the issue. Hopefully this helps in your case. You may also want to ensure the client attempting to connect from the cPanel end is on the Network Access List for the project.

If further assistance is required after confirming the ports are not blocked, please provide the following:

  1. Method of connection (mongosh, MongoDB driver, driver version)
  2. Full error message / output when attempting to connect from cPanel
  3. The output from running a ping to one of the hosts (prefereably the PRIMARY) from the cPanel client:
/// example
ping cluster0-shard-00-00.ze4xc.mongodb.net
  1. The output from running a telnet to one of the hosts on port 27017 from the cPanel client:
/// example
telnet cluster0-shard-00-00.ze4cx.mongodb.net 27017

Note: You can find the hostname in the metrics page of your cluster

Regards,
Jason

2 Likes