Problem connecting my database with my ip address (cpanel)

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.
I need your help

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

Hi
I followed your instructions: port 27017 is not blocked and the ip address is on the network access list.

Here is the information you requested:

  1. Connection method: MongoDB driver version 4.4.1
  2. Error message
  3. [senechoicetours-shard-00-01.ovhwy.mongodb.net:27017]

Thanks in advance

I followed your instructions: port 27017 is not blocked and the ip address is on the network access list.

Thanks for providing those details. Could you provide the output from the ping and telnet commands from that client? I cannot see the output from either from the screenshot you attached? This will at least help confirm some level of connectivity from the cPanel client to the Atlas cluster’s node(s).

  1. [senechoicetours-shard-00-01.ovhwy.mongodb.net:27017]

If the hostname:port of the PRIMARY is the value you provided here, then the commands that should be run from the cPanel client are:

ping senechoicetours-shard-00-01.ovhwy.mongodb.net
telnet senechoicetours-shard-00-01.ovhwy.mongodb.net 27017

Regards,
Jason

1 Like