How do I set up Mysql Cluster?
Solution 1:
Oh.., after multiple tries I got it working myself and it has taken upto now. The links are very nice tutorials and I could fix the issues I had this way.
Also I am not understanding whether mysql-server or mysql-client need to be installed along with mysql-cluster else mysql-cluster alone is enough for running mysqld on SQL nodes.
A: I am not sure if mysql-cluster
works along mysql-server
and mysql-client
which are already installed from apt
but I am sure that those or any extra package are NOT required for mysql-cluster on Ubuntu as it itself has all the packages. So I can run mysqld
from cluster extracted package and nothing required for this to install additionally for SQL nodes.
./bin/mysqld_safe --user=mysql --defaults-file=/etc/my.cnf &
A: No need to run mysqld
manually and instead can use /etc/init.d/mysql.server start
copying from /usr/local/mysql/support-files/mysql.server
to start mysqld/SQL node.
Starting MySQL * Couldn't find MySQL manager (/usr/bin/mysqlmanager) or server (/usr/bin/mysqld_safe)
A: The above was the error encountered while trying to start mysql.server
and that was because I had mysql-server
and mysql-client
already installed. Those should be completely removed(I'm not sure if can run cluster successfully along with them) and I did. Those were not completely removed(probably I have to use apt --purge remove
). Check with dpkg --get-selections | grep mysql
, if you find deinstall
then those are not completely uninstalled, which should be, else one will have to face above error. Executing below command completely removed them and I could start mysql.server with no errors.
aptitude purge $(dpkg --get-selections | grep deinstall | sed s/deinstall//) #To completely remove all deinstall package
pkill -9 mysqld
/etc/init.d/mysql.server
............ * Manager of pid-file quit without updating file.
A: I faced the above error many times in my testing while trying to start mysql.server
. I could avoid this by simply granting permission on data
to mysql user like chown -R mysql:mysql /usr/local/mysql/data
, this mistake was because I was trying extracting mysql-cluster newly number of times and thus the error as the user mysql
could not create pid file under data directory for no permission and error log under /var/lib/mysql-cluster
on sql/data node helped me trace this.
Should be very specific in assigning to /usr/local/mysql/data, if you just do chown -R mysql:mysql /usr/local/mysql
and keep quiet, it won't work and same error is thrown!
After granting permission , check mysqld is working and running by issuing /usr/local/mysql/bin/mysql -uroot -p
. Even after entering password you cannot connect and throws error, then mysql root password is not set or you forgot. Use below command to reset mysql root password, and then try connecting again:
/usr/local/mysql/bin/mysqladmin -uroot password your-new-password-here
Neither I am satisfied with the answer nor I am willing to accept and award myself as I have many more to do in this clustering. I am willing to update my question with more queries and await to award points to other who is going to answer. UPDATED QUESTION!
Thank you!
Update
We thought of using MySQL Cluster for production web servers where apache-tomcat serving some static and jsp pages but because of slow joins
, no support for foreign keys
and so on... issues which are crucial in our environment and works fine in Innodb engine than NDB, I am ending not using mysql cluster and looking back to replication again though it has sync issues. Thank you!