eole-mariadb/README.md

128 lines
3.3 KiB
Markdown
Raw Normal View History

2018-04-10 14:15:57 +02:00
# eole-mariadb
2018-04-10 16:15:28 +02:00
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
## 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/
## 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://<IP_NODE1>,<IP_NODE2>"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="<IP_NODE1>"
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://<IP_NODE1>,<IP_NODE2>"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="<IP_NODE2>"
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 |
+--------------------+-------+
```