I'm trying to shift from a single instance of a mysql database to using a cluster for redundancy purposes, following the steps I found from here, I thought this was the solution I needed, but I'm getting an error now that I can't seem to find a solution for online. I've created the cluster config.ini file, and modified mysql's my.cnf file to point to my management server, but when I try to connect to MySQL now, I get an error ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 104
, and I can't figure out exactly what is wrong. The NDB manager says all is okay, and the MySQL exits successfully with error code 0 for success, but it is constantly stuck in a status of "server startup in progress" and gives me an error 22 for an "invalid argument". Please help, I've been at this for over a week and cannot for the life of me figure it out.
systemctl status ndb_mgmd
returns:
ndb_mgmd.service - MySQL NDB Cluster Management Server
Loaded: loaded (/etc/systemd/system/ndb_mgmd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-04-11 19:43:56 UTC; 2s ago
Process: 5463 ExecStart=/usr/sbin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini (code=exited, status=0/SUCCESS)
Main PID: 5464 (ndb_mgmd)
Tasks: 12 (limit: 8500)
Memory: 2.4M
CPU: 52ms
CGroup: /system.slice/ndb_mgmd.service
└─5464 /usr/sbin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini
systemctl status mysql
returns:
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start) since Tue 2023-04-11 19:44:09 UTC; 825ms ago
Process: 5733 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 5741 (mysqld)
Status: "Server startup in progress"
Error: 22 (Invalid argument)
Tasks: 31 (limit: 8500)
Memory: 364.0M
CPU: 524ms
CGroup: /system.slice/mysql.service
└─5741 /usr/sbin/mysqld
Trying to connect with mysql -u root -p
and then entering the password gives:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 104
/etc/mysql/my.cnf:
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
# Options for mysqld process:
ndbcluster # run NDB storage engine
[mysql_cluster]
# Options for NDB Cluster processes:
ndb-connectstring=192.168.195.101 # location of management server
/var/lib/mysql-cluster/config.ini:
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=1 # Number of replicas
[ndb_mgmd]
# Management process options:
hostname=192.168.195.101 # Hostname of the manager
datadir=/var/lib/mysql-cluster # Directory for the log files
[ndbd]
hostname=192.168.195.167 # Hostname/IP of the second data node
NodeId=2 # Node ID for this data node
datadir=/usr/local/mysql/data # Remote directory for the data files
[mysqld]
# SQL node options:
hostname=192.168.195.101 # In our case the MySQL server/client is on the same Droplet as the cluster manager
I've tripled check the IP addresses, but ever since I started trying to use the second unit to cluster, I haven't even been able to connect to MySQL to do any further tests. How to fix this?