Could not connect to other node database
How to solve error 'Could not connect to other node database' ?
Overview: This article provides troubleshooting steps to fix the “Could not connect to other node database” error that appears in the Ezeelogin UI on clicking “Verify Database” on the primary node. This error can happen in two cases, when the other node shows “Not Available” or “Down.”
The above error occur on clicking “Verify Database” under the Cluster tab in the following two cases:
Case 1: When the other node state shows "Not Available"
This error occurs when there is no connection from the master node to the slave node.
Step 1(A): Verify if the slave node has been installed with the correct IP address. If the IP address is incorrect, run the following command on the slave node with the correct IP of the secondary node to reinstall the slave.
root@secondary:~# sh ezlogin_7.x.x.bin -- -secondary <ip_addr of secondary node> -othernode <ip_addr of master node>
Step 1(B): Ensure that MySQL port 3306 is open and MySQL is running on both nodes. Run below command to check if MySQL is listening on port 3306.
netstat -nltp | grep 3306
systemctl status mysql
Step 1(C): Verify that there is MySQL connection between the master and slave, as well as between the slave and master. Run below commands to check the MySQL connection.
Run below command on master node:
root@primary:~# telnet secondary_ip 3306
Run below command on slave node:
root@secondary:~# telnet primary_ip 3306
Step 1(D): Check for the error messages in the application logs on the primary server. Run the following command to navigate to the log directory and tail the latest log.
root@primary:~# cd $(awk '/^system_folder/ {print $2}' /usr/local/etc/ezlogin/ez.conf)/application/logs/
For Example:
root@primary:/var/www/ezlogin/application/logs# tail log-2024-07-11.php
Case 2: When the other node state shows "Down"
This error occurs when the slave node becomes unreachable after successfully setting up the cluster.
Step 2(A): Ensure that MySQL port 3306 is open and that MySQL is running on both nodes. Use the following command to check if MySQL is listening on port 3306 and check the status of MySQL.
netstat -nltp | grep 3306
systemctl status mysql
Step 2(B): Verify the database connection between master and slave nodes, ensuring successsful login to MySQL as database user from primary to secondary and vice versa. Run the below command to get the database credentials.
root@primary:~# php /usr/local/ezlogin/eztool.php -show_db_credentials
_ _
___ _______ ___| | ___ __ _(_)_ __
/ _ \_ / _ \/ _ \ |/ _ \ / _` | | ’_ \
| __// / __/ __/ | (_) | (_| | | | | |
\___/___\___|\___|_|\___/ \__, |_|_| |_|
|___/
#########################
# Ezeelogin Tool #
#########################
Checking environment... done
Checking license... done (0)
Enter the Ezeelogin administrator password: 9Im8as=K>X4?
Database credentials:
Host: localhost
Port/Socket: /var/lib/mysql/mysql.sock
Database: ezlogin_phmxgg
Username: ezlogin_pyy
Password: P4&][*V]Qx3jn3n7A6@p6p7]G
Table Prefix: vbsrc_
After getting the database credentials run the below command to check MySQL connection between master and slave nodes.
Run below command on primary node:
root@primary:~# mysql -h secondary_server_ip -u db_username -p
Run below command on secondary node:
root@secondary:~# mysql -h primary_server_ip -u db_username -p
Step 2(C): Execute the following command on the secondary server to grant access to the Ezeelogin database from the primary server.
root@secondary:~# php /usr/local/ezlogin/grant_host.php <ip_address of primary node/master>
Step 2(D): Check for the error messages in the application logs on the primary server. Run the following command to navigate to the log directory and tail the latest log.
root@primary:~# cd $(awk '/^system_folder/ {print $2}' /usr/local/etc/ezlogin/ez.conf)/application/logs/
For Example:
root@primary:/var/www/ezlogin/application/logs# tail log-2024-07-11.php
Related Articles:
Install slave / secondary node for high availability in jump server
Primary node showing the public ip instead of lan ip when cluster is configured