# eole-mariadb Début des travaux pour l'utilisation de mariadb dans Eole avec des fonctionalitées avancées du type mise en clustter # How-to for Eole 2.6.2 (using this repo dico and templates) ### FIXME # How-to for Eole 2.6.2 (From scratch) ## Sources * https://mariadb.com/kb/en/library/getting-started-with-mariadb-galera-cluster/ * https://mariadb.com/kb/en/library/installing-mariadb-deb-files/#installing-mariadb-galera-cluster-with-apt-get * https://downloads.mariadb.org/mariadb/repositories/#mirror=ovh&distro=Ubuntu&distro_release=xenial--ubuntu_xenial&version=10.2 * http://galeracluster.com/documentation-webpages/?id=galera_parameters_0.8 * https://mariadb.com/kb/en/library/mariadb-galera-cluster-known-limitations/ * https://www.howtoforge.com/tutorial/how-to-install-and-configure-galera-cluster-on-ubuntu-1604/ ## Requirements * 2 eolebase 2.6.2 servers ## Adding MariaDB (Galera) cluster repository (on each server) GenConfig (Mode Expert) -> Dépôt tiers : * Libellé du dépôt : MariaDB * Déclaration du dépôt : deb [arch=amd64] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.2/ubuntu xenial main * Méthode de récupération de la clé publique du dépôt : serveur de clés * URL du serveur de clés : hkp://keyserver.ubuntu.com:80 * Empreinte de la clé : 0xF1656F24C74CD1D8 ## Installing MariaDB software on the First Node aka "Node1" * Query-Auto * apt install mariadb-server ### Secure MariaDB installation * mysql_secure_installation ### Configure the Master * vim /etc/mysql/conf.d/galera.cnf ``` [mysqld] binlog_format=ROW default-storage-engine=innodb innodb_autoinc_lock_mode=2 bind-address=0.0.0.0 # Galera Provider Configuration wsrep_on=ON wsrep_provider=/usr/lib/galera/libgalera_smm.so # Galera Cluster Configuration wsrep_cluster_name="eole_cluster" wsrep_cluster_address="gcomm://," # Galera Synchronization Configuration wsrep_sst_method=rsync # Galera Node Configuration wsrep_node_address="" wsrep_node_name="Node1" ``` ### Open Firewall ports * 3306/tcp * 4444/tcp * 4567/tcp * 4568/tcp * 4567/udp ### Bootstraping the new cluster * systemctl stop mariadb * galera_new_cluster ### Check cluster size * mysql -u root -p -e "show status like 'wsrep_cluster_size'" ``` +--------------------+-------+ | Variable_name | Value | +--------------------+-------+ | wsrep_cluster_size | 1 | +--------------------+-------+ ``` ## Installing MariaDB software in the Second node aka "Node2" * Query-Auto * apt install mariadb-server ### Secure MariaDB installation * mysql_secure_installation ### Configure the Master * vim /etc/mysql/conf.d/galera.cnf ``` [mysqld] binlog_format=ROW default-storage-engine=innodb innodb_autoinc_lock_mode=2 bind-address=0.0.0.0 # Galera Provider Configuration wsrep_on=ON wsrep_provider=/usr/lib/galera/libgalera_smm.so # Galera Cluster Configuration wsrep_cluster_name="eole_cluster" wsrep_cluster_address="gcomm://," # Galera Synchronization Configuration wsrep_sst_method=rsync # Galera Node Configuration wsrep_node_address="" wsrep_node_name="Node2" ``` ### Open Firewall ports * 3306/tcp * 4444/tcp * 4567/tcp * 4568/tcp * 4567/udp ### Restart MariaDB * systemctl restart mysql ### Check Cluster Size * mysql -u root -p -e "show status like 'wsrep_cluster_size'" ``` +--------------------+-------+ | Variable_name | Value | +--------------------+-------+ | wsrep_cluster_size | 2 | +--------------------+-------+ ```