apigee / apigee-devportal-kickstart-drupal

A fast demo and starting point for Apigee Developer Portals for Drupal
https://www.drupal.org/project/apigee_devportal_kickstart
GNU General Public License v2.0
26 stars 34 forks source link

Unable to connect to the Remote Database (when the Devportal app is on one linux Server and MariaDB on the other) #402

Closed pradeepgorle13 closed 4 years ago

pradeepgorle13 commented 4 years ago

I have two Linux Servers

  1. Installed the Devportal on Server 1
  2. Installed the MariaDB on the Server 2

image By default the server is running on the port 3306.

So changed the file "/var/www/devportal/web/sites/default/settings.php" as mentioned below image

And when i restarted the server and tried to access the drupal site, I am getting the following error image

I even tried with http and https too. Can you please let me know where are i am going wrong and I tried to look for the documentation and i didn't find any for the remote install of DB.

Do I need to do any changes to the my.conf file, If so what would be the change.

================================================================ Updating after the above

Also, Please find the following Screenshot for image

I tried some more uses cases and found that Step 1. Called the command "mysql -u devportal -h DatabaseServerIP –p " from the server where Developer portal is installed. Step 2. It asked for a password since i haven't mentioned any password in the above command. Step 3. After entering the correct password, I was able to see the following

image

Does that mean, I am able to get the remote connection of the Database but I am unable to connect to the Server after giving the correct credentials.

Please advise.

Thanks.

pradeepgorle13 commented 4 years ago

@arlina-espinoza @minnur Can you suggest any options?

pradeepgorle13 commented 4 years ago

@minnur if possible can we have a Webex so that I can share my screen to show where i am facing the issue.

minnur commented 4 years ago

Hi @pradeepgorle13 are you able to try install Kickstarter using local database (code and db on the same server) ? I would like to make sure this issue is relevant to the kickstarter.

pradeepgorle13 commented 4 years ago

Hi @pradeepgorle13 are you able to try install Kickstarter using local database (code and db on the same server) ? I would like to make sure this issue is relevant to the kickstarter.

@minnur When I installed using the kickstarter with the local Database(Code and db on the same server), It is working fine. But when i installed the DB on the other server and changing the settings.php, The error mentioned previously is being displayed.

minnur commented 4 years ago

@pradeepgorle13 From the errors I see in the screenshots you provided it looks like your DB is not accessible from remote. Yes most likely your server is not properly configured. Take a look here https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/ for my.cnf configuration.

pradeepgorle13 commented 4 years ago

@pradeepgorle13 From the errors I see in the screenshots you provided it looks like your DB is not accessible from remote. Yes most likely your server is not properly configured. Take a look here https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/ for my.cnf configuration.

Hi @minnur , I verified if you see my last point in the above I tried some more uses cases and found that Step 1. Called the command "mysql -u devportal -h DatabaseServerIP –p " from the server where Developer portal is installed. Step 2. It asked for a password since i haven't mentioned any password in the above command. Step 3. After entering the correct password, I was able to connect to the remote DB server image

I called the server2(db server) from Server1(Devportal install location). I was able to access the Server2(db server) remotely from Server1.

minnur commented 4 years ago

This is a documentation page for the database configuration of Drupal https://www.drupal.org/docs/8/api/database-api/database-configuration

pradeepgorle13 commented 4 years ago

This is a documentation page for the database configuration of Drupal https://www.drupal.org/docs/8/api/database-api/database-configuration

Sure, Will let you know once i go through

Shanli-Yu commented 4 years ago

Is there any logs from the remote server where mariaDB is installed that indicates connection attempts from devportal?

pradeepgorle13 commented 4 years ago

I

Is there any logs from the remote server where mariaDB is installed that indicates connection attempts from devportal?

Hi @Shanli-Yu I haven;t seen any logs in the dbserver regarding the connection. Now it just changed my view When i used the page and refreshed it, it isn't connecting to the dbserver and ai am not seeing any logs

Even When i am connecting to the server with the devportal server to remote DBserver in the command line, I can see the success but not the logs updated image

Logs are empty

Shanli-Yu commented 4 years ago

From what I can see so far of that error there are two existing causes and resolutions:

  1. The database is misconfigured and could not accept connections. This does not seem to be the issue since you were able to connect using mysql command

  2. Connection settings are not configured correctly in settings.php. One of the things that can cause this was that the hostname was not specified as IP address. Can you double check if the hostname can be specified as IP?

pradeepgorle13 commented 4 years ago

From what I can see so far of that error there are two existing causes and resolutions:

  1. The database is misconfigured and could not accept connections. This does not seem to be the issue since you were able to connect using mysql command
  2. Connection settings are not configured correctly in settings.php. One of the things that can cause this was that the hostname was not specified as IP address. Can you double check if the hostname can be specified as IP?

Yeah @Shanli-Yu , I used the IP in the settings.php. If you see the below image, I have updated with ip too... I just did all the permutations and combinations here. Anyways, I am going to change the userid and password.. Was just sharing this... image

Shanli-Yu commented 4 years ago

The only other thing I can think of is the port number. I see that you are using 3306 which is the number for internal connection, can you update the port number to external connection and see if it will connect?

pradeepgorle13 commented 4 years ago

The only other thing I can think of is the port number. I see that you are using 3306 which is the number for internal connection, can you update the port number to external connection and see if it will connect?

Hi @Shanli-Yu , I also went through that route.. Can you please let me know if i am going in the right direction. Please find the following image for the port where mysql is open image Also adding other image for the Status image ...

If this is not it, How can I update the port number to external connection and see if it will connect?

pradeepgorle13 commented 4 years ago

This is a documentation page for the database configuration of Drupal https://www.drupal.org/docs/8/api/database-api/database-configuration

@minnur I checked for remote connections from the Devportal server to Database server through command line and it is absolutely working fine. Me and @Shanli-Yu discussed regarding this. Please find the my.conf file contents as following

image

pradeepgorle13 commented 4 years ago

The only other thing I can think of is the port number. I see that you are using 3306 which is the number for internal connection, can you update the port number to external connection and see if it will connect?

Hi @Shanli-Yu , I also went through that route.. Can you please let me know if i am going in the right direction. Please find the following image for the port where mysql is open image Also adding other image for the Status image ...

If this is not it, How can I update the port number to external connection and see if it will connect?

Any other options @Shanli-Yu ? Any place where i am going wrong

Shanli-Yu commented 4 years ago

@pradeepgorle13 Seems like there is no other configurations done to mysql based on the output then 3306 should be the correct port number.

pradeepgorle13 commented 4 years ago

@pradeepgorle13 Seems like there is no other configurations done to mysql based on the output then 3306 should be the correct port number.

@minnur @shanli-yu So, Can you please suggest where i am going wrong.. I can setup some webex call if required..

Shanli-Yu commented 4 years ago

@pradeepgorle13 Since so far I cannot see any discrepancies in devportal settings, I highly recommend to first configure the server logging threshold if possible, to view the server access logs and confirm if the devportal node is at least making connection attempts, if there are attempts and based on the error the connection was refused, then the issue can be narrowed to server configuration rather than devportal configuration.

pradeepgorle13 commented 4 years ago

@pradeepgorle13 Since so far I cannot see any discrepancies in devportal settings, I highly recommend to first configure the server logging threshold if possible, to view the server access logs and confirm if the devportal node is at least making connection attempts, if there are attempts and based on the error the connection was refused, then the issue can be narrowed to server configuration rather than devportal configuration.

Sure @Shanli-Yu , Will see how far i can go and will update you guys tomorrow morning.

pradeepgorle13 commented 4 years ago

@minnur @Shanli-Yu By any chance, Is it a Selinux issue ? I tried getting the logs and i wasn't able to get the detailed logs. IF you guys point me to any Mariadb logs enabling for debug. it would be of great help.

pradeepgorle13 commented 4 years ago

I was able to resolve the issue. There was an issue with the SELinux as expected in my previous post. So i sort of disabled it.