eole-mariadb/README.md

234 lines
7.2 KiB
Markdown
Raw Normal View History

2018-04-10 14:15:57 +02:00
# eole-mariadb
2019-02-14 10:04:09 +01:00
Paquet porté pour la 2.7.0. Les tests n'ont été réalisé que sur un Eolebase.
La version utilisé est mariadb 10.3
Ajout de ce paquet sur une 2.7.0 :
## Add the Cadoles repository on all the nodes and the Leader
GenConfig [Mode Expert] -> Dépôts Tiers
* Libellé du dépôt : Cadoles dev
* Déclaration du dépôt : deb [ arch=all ] https://vulcain.cadoles.com 2.7.0-dev main
* Méthode de récupération de la clé publique du dépôt : URL de la clé
* URL de la clé : https://vulcain.cadoles.com/cadoles.gpg
## Add the MariaDB repository on all the nodes and the Leader
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.3/ubuntu bionic 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
#######################################################################
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
2018-04-10 16:31:41 +02:00
# How-to for Eole 2.6.2 (using this repo dico and templates)
2018-05-11 08:49:14 +02:00
Start with 3 fresh eolebase 2.6.2 instancied.
One for the Clustter Leader, another for the cluster Node another for the Arbitrator, the arbitrator can be replaced by another node.
The order is very important, Never configure a Node before the Leader ! The Leader must be the first one.
## Add the Cadoles repository on all the nodes and the Leader
GenConfig [Mode Expert] -> Dépôts Tiers
* Libellé du dépôt : Cadoles dev
* Déclaration du dépôt : deb [ arch=all ] https://vulcain.cadoles.com 2.6.2-dev main
* Méthode de récupération de la clé publique du dépôt : URL de la clé
* URL de la clé : https://vulcain.cadoles.com/cadoles.gpg
## Add the MariaDB repository on all the nodes and the Leader
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
## Configure the Leader :
GenConfig (Mode Normal) -> Services :
* Activer le serveur de base de données MariaDB : oui
GenConfig (Mode Normal) -> Database :
* Activer la mise en grappe MariaDB Galera ? : oui
GenConfig (Mode Normal) -> Database cluster :
* Rôle dans la grappe : Leader
* Interface réseau dédiée à la grappe BDD : eth0
* Nom du noeud local : <THE NAME YOU WANT>
* Membre de la grappe BDD :
* Membre de la grappe BDD : <NAME OF THE LEADER>
* Adresse IP : <IP OF THE LEADER>
* Membre de la grappe BDD : <NAME OF THE ARBITRATOR OR NODE>
* Adresse IP : <IP OF THE NODE OR ARBITRATOR>
* *Nom de la grappe : <NAME OF THE CLUSTER>
## Reconfigure Leader !
Run reconfigure command !
## Configure the Nodes !
GenConfig (Mode Normal) -> Services :
* Activer le serveur de base de données MariaDB : oui
GenConfig (Mode Normal) -> Database :
* Activer la mise en grappe MariaDB Galera ? : oui
GenConfig (Mode Normal) -> Database cluster :
* Rôle dans la grappe : Node
* Interface réseau dédiée à la grappe BDD : eth0
* Nom du noeud local : <THE NAME YOU WANT>
* Membre de la grappe BDD :
* Membre de la grappe BDD : <NAME OF THE LEADER>
* Adresse IP : <IP OF THE LEADER>
* Membre de la grappe BDD : <NAME OF THE ARBITRATOR OR NODE>
* Adresse IP : <IP OF THE NODE OR ARBITRATOR>
* *Nom de la grappe : <NAME OF THE CLUSTER>
## Reconfigure the Nodes !
Run reconfigure command on each node one by one.
## Configure the Arbitrator if needed !
If you have only 2 nodes you need to setup an arbitrator, for this follow the tutorial in the eole-galera-arbitrator project page https://forge.cadoles.com/Cadoles/eole-galera-arbitrator
2018-04-10 16:31:41 +02:00
2018-05-28 16:13:45 +02:00
2018-04-10 16:31:41 +02:00
# How-to for Eole 2.6.2 (From scratch)
2018-04-10 16:15:28 +02:00
## 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/
2018-04-10 16:31:41 +02:00
* https://www.howtoforge.com/tutorial/how-to-install-and-configure-galera-cluster-on-ubuntu-1604/
2018-04-10 16:15:28 +02:00
## 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 |
+--------------------+-------+
```