<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Archives des Cluster MySQL - CoffeeBreak Info</title>
	<atom:link href="https://coffeebreak.en-images.info/tag/cluster-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>https://coffeebreak.en-images.info/tag/cluster-mysql/</link>
	<description>Une petite pause :)</description>
	<lastBuildDate>Fri, 12 Nov 2021 16:13:19 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://coffeebreak.en-images.info/wp-content/uploads/2021/07/cropped-Tasse_Cafe-scaled-1-32x32.jpg</url>
	<title>Archives des Cluster MySQL - CoffeeBreak Info</title>
	<link>https://coffeebreak.en-images.info/tag/cluster-mysql/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>MODOP &#8211; PARTIE 3 &#8211; Installation WordPress en HA – Cluster MySQL</title>
		<link>https://coffeebreak.en-images.info/modop-partie-3-installation-wordpress-en-ha-cluster-mysql/</link>
					<comments>https://coffeebreak.en-images.info/modop-partie-3-installation-wordpress-en-ha-cluster-mysql/#respond</comments>
		
		<dc:creator><![CDATA[chris]]></dc:creator>
		<pubDate>Sun, 27 Jun 2021 17:34:04 +0000</pubDate>
				<category><![CDATA[Infrastructure HA Web]]></category>
		<category><![CDATA[RedHat/Centos Linux]]></category>
		<category><![CDATA[Système]]></category>
		<category><![CDATA[AlmaLinux]]></category>
		<category><![CDATA[Cluster MySQL]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>
		<guid isPermaLink="false">https://coffeebreak.en-images.info/?p=2359</guid>

					<description><![CDATA[<p>Mise en place d'un cluster Percona MySQL qui sera en charger de stocker les données site. les trois machines sont en mode MASTER-MASTER-MASTER par réplication de données.</p>
<p>L’article <a href="https://coffeebreak.en-images.info/modop-partie-3-installation-wordpress-en-ha-cluster-mysql/">MODOP &#8211; PARTIE 3 &#8211; Installation WordPress en HA – Cluster MySQL</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3><strong>3 machines Mysql Percona (AlmaLinux 8)</strong></h3>
<ul>
<li>node01-sqlw 172.16.186.27</li>
<li>node02-sqlw 172.16.186.28</li>
<li>node03-sqlw 172.16.186.29</li>
</ul>
<p>Le Pool « Cluster_SQLW » va être composé de trois machines virtuelles</p>
<ul>
<li>Node01-sqlw -&gt; 172.16.186.27
<ul>
<li>2CPU, 2G RAM, 20Go Disk</li>
</ul>
</li>
<li>Node02-sqlw -&gt; 172.16.186.28
<ul>
<li>2CPU, 2G RAM, 20Go Disk</li>
</ul>
</li>
<li>Node03-sqlw -&gt; 172.16.186.29
<ul>
<li>2CPU, 2G RAM, 20Go Disk</li>
</ul>
</li>
</ul>
<h4><strong>Spécification des machines</strong></h4>
<p><img fetchpriority="high" decoding="async" width="909" height="296" class="wp-image-2365" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-592.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-592.png 909w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-592-300x98.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-592-768x250.png 768w" sizes="(max-width: 909px) 100vw, 909px" /></p>
<p><img decoding="async" width="1096" height="197" class="wp-image-2368" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-593.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-593.png 1096w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-593-300x54.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-593-1024x184.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-593-768x138.png 768w" sizes="(max-width: 1096px) 100vw, 1096px" /></p>
<h3>1°) Désactivation du SElinux (3 nœuds sqlw)</h3>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">vi /etc/selinux/config</span></strong>
<span style="color: #ff0000;"><em>SELINUX=</em><strong><em>disabled</em></strong></span></pre>
<p><img decoding="async" width="791" height="182" class="wp-image-2370" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-594.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-594.png 791w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-594-300x69.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-594-768x177.png 768w" sizes="(max-width: 791px) 100vw, 791px" /></p>
<p>Redémarrer la machine.</p>
<pre>[root@node01-sqlw ~]#<strong><span style="color: #ff0000;"> reboot</span></strong></pre>
<h3><strong>2°) Désactiver l’IPV6 </strong>(3 nœuds sqlw)</h3>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">vi /etc/sysctl.conf</span></strong>
<span style="color: #ff0000;"><em>net.ipv6.conf.all.disable_ipv6 = 1</em></span>
<span style="color: #ff0000;"><em>net.ipv6.conf.all.autoconf = 0</em></span>
<span style="color: #ff0000;"><em>net.ipv6.conf.default.disable_ipv6 = 1</em></span>
<span style="color: #ff0000;"><em>net.ipv6.conf.default.autoconf = 0</em></span></pre>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">sysctl -p</span></strong></pre>
<h3>3°) Installation de paquets utiles(3 nœuds)</h3>
<pre>[root@node01-sqlw ~]#<strong><span style="color: #ff0000;"> yum update &amp;&amp; yum upgrade</span></strong>
[root@node01-sqlw ~]#] <span style="color: #ff0000;"><strong>yum -y install qemu-guest-agent</strong></span>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">yum -y install htop nmap net-tools</span></strong>
[root@node01-sqlw ~]# <span style="color: #ff0000;"><strong>yum -y install epel-release socat</strong></span></pre>
<p><strong>Suppression des lib inutiles.</strong></p>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">yum -y remove mariadb-libs</span></strong></pre>
<h3>4°) Installation Percona(3 nœuds)</h3>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm</span></strong>
[root@node01-sqlw ~]# <span style="color: #ff0000;"><strong>yum makecache &amp;&amp; yum update</strong></span>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">yum install -y Percona-XtraDB-Cluster-client-57* Percona-XtraDB-Cluster-server-57*</span></strong>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">yum install -y Percona-XtraDB-Cluster-shared-57-debuginfo* Percona-XtraDB-Cluster-garbd-57-debuginfo*</span></strong>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">yum install -y mariadb-server-galera.x86_64</span></strong>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">yum install -y percona-toolkit</span></strong>
[root@node01-sqlw ~]#<strong><span style="color: #ff0000;"> yum install -y percona-xtrabackup-24</span></strong>

[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">systemctl enable --now mariadb.service</span></strong></pre>
<h3>5°) Ajout des Rules Firewall(3 nœuds)</h3>
<pre>[root@node01-sqlw ~]#<strong><span style="color: #ff0000;">firewall-cmd --permanent --add-port={3306,4444,4567,4568}/tcp</span></strong>
[root@node01-sqlw ~]#<strong><span style="color: #ff0000;">firewall-cmd --zone=public --add-port=4567/udp --permanent</span></strong>
[root@node01-sqlw ~]#<strong><span style="color: #ff0000;">firewall-cmd --reload</span></strong></pre>
<h3>6°)Installantion NTP(3 nœuds)</h3>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">dnf install chrony</span></strong>
[root@node01-sqlw ~]# <span style="color: #ff0000;"><strong>systemctl start chronyd</strong></span>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">systemctl enable chronyd</span></strong>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">systemctl status chronyd</span></strong>

[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">firewall-cmd --permanent --add-service=ntp</span></strong>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">firewall-cmd --reload</span></strong></pre>
<h3>7°) Configurer le nœud node01-sqlw</h3>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">systemctl stop mariadb</span></strong></pre>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">vi /etc/my.cnf</span></strong>
<span style="color: #ff0000;"><em>[mysqld]</em></span>
<span style="color: #ff0000;"><em>wsrep_cluster_address = gcomm://</em></span>
<span style="color: #ff0000;"><em>wsrep_provider = /usr/lib64/galera3/libgalera_smm.so</em></span>
<span style="color: #ff0000;"><em>wsrep_slave_threads = 8</em></span>
<span style="color: #ff0000;"><em>wsrep_cluster_name = SQL-Cluster</em></span>
<span style="color: #ff0000;"><em>wsrep_node_name = </em><strong><em>node01-sqlw</em></strong></span>
<span style="color: #ff0000;"><em>wsrep_node_address = </em><strong><em>node01-sqlw</em></strong></span>
<span style="color: #ff0000;"><em>wsrep_sst_method = xtrabackup-v2</em></span>
<span style="color: #ff0000;"><em>wsrep_sst_auth = </em><strong><em>mysql-cluster:mysql@2021</em></strong></span></pre>
<p><strong>Création du Cluster </strong></p>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">rm -rf /var/lib/mysql/*</span></strong>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">galera_new_cluster</span></strong>
[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">systemctl start mariadb &amp;&amp; systemctl enable mariadb</span></strong></pre>
<p><strong>Connexion à la base de données Percona Mariadb</strong></p>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">mysql -u root –p</span></strong>

MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> SHOW STATUS LIKE 'wsrep_local_state_comment';</span></strong></pre>
<p><img loading="lazy" decoding="async" width="686" height="180" class="wp-image-2371" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-595.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-595.png 686w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-595-300x79.png 300w" sizes="auto, (max-width: 686px) 100vw, 686px" /></p>
<pre>MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">show global status like 'wsrep_cluster_size';</span></strong></pre>
<p><img loading="lazy" decoding="async" width="668" height="120" class="wp-image-2373" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-596.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-596.png 668w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-596-300x54.png 300w" sizes="auto, (max-width: 668px) 100vw, 668px" /></p>
<pre>MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">show global status like 'wsrep%';</span></strong></pre>
<p><img loading="lazy" decoding="async" width="582" height="663" class="wp-image-2376" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-597.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-597.png 582w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-597-263x300.png 263w" sizes="auto, (max-width: 582px) 100vw, 582px" /></p>
<h3>7°) Configurer le root de Mariadb</h3>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">mysql_secure_installation</span></strong>
Enter current password for root (enter for none): <strong><span style="color: #ff0000;">« ENTER »</span></strong>
Set root password? [Y/n] <span style="color: #ff0000;"><strong>Y</strong></span>
New password: <strong><span style="color: #ff0000;">« Votre password »</span></strong>
Re-enter new password: <strong><span style="color: #ff0000;">« retaper password »</span></strong>
Remove anonymous users? [Y/n] <strong><span style="color: #ff0000;">Y</span></strong>
Disallow root login remotely? [Y/n] <strong><span style="color: #ff0000;">Y</span></strong>
Remove test database and access to it? [Y/n] <strong><span style="color: #ff0000;">Y</span></strong>
Reload privilege tables now? [Y/n] <strong><span style="color: #ff0000;">Y</span></strong></pre>
<h3>8°) Création des utilisateurs/Machines « mysql-cluster »</h3>
<pre>[root@node01-sqlw ~]#<strong><span style="color: #ff0000;">mysql -u root -p</span></strong>
mysql&gt; <strong><span style="color: #ff0000;">CREATE USER 'mysql-cluster'@'node01-sqlw' IDENTIFIED BY 'mysql@2021';</span></strong>
mysql&gt; <strong><span style="color: #ff0000;">CREATE USER 'mysql-cluster'@'node02-sqlw' IDENTIFIED BY 'mysql@2021';</span></strong>
mysql&gt; <strong><span style="color: #ff0000;">CREATE USER 'mysql-cluster'@'node03-sqlw' IDENTIFIED BY 'mysql@2021';</span></strong>

mysql&gt; <strong><span style="color: #ff0000;">GRANT ALL ON *.* TO 'mysql-cluster'@'node01-sqlw';</span></strong>
mysql&gt; <strong><span style="color: #ff0000;">GRANT ALL ON *.* TO 'mysql-cluster'@'node02-sqlw';</span></strong>
mysql&gt; <strong><span style="color: #ff0000;">GRANT ALL ON *.* TO 'mysql-cluster'@'node03-sqlw';</span></strong>

mysql&gt;<strong><span style="color: #ff0000;"> FLUSH PRIVILEGES;</span></strong></pre>
<p><img loading="lazy" decoding="async" width="1069" height="358" class="wp-image-2379" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-598.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-598.png 1069w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-598-300x100.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-598-1024x343.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-598-768x257.png 768w" sizes="auto, (max-width: 1069px) 100vw, 1069px" /></p>
<pre>MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> select * from mysql.user;</span></strong></pre>
<p><img loading="lazy" decoding="async" width="1261" height="296" class="wp-image-2381" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-599.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-599.png 1261w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-599-300x70.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-599-1024x240.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-599-768x180.png 768w" sizes="auto, (max-width: 1261px) 100vw, 1261px" /></p>
<p>Les utilisateurs autoriser à échanger entre les machines sont créer.</p>
<h3>9°) Configurer le nœud node02-sqlw</h3>
<pre>[root@node02-sqlw ~]#<strong><span style="color: #ff0000;"> systemctl stop mariadb</span></strong></pre>
<pre>
[root@node02-sqlw ~]# <strong><span style="color: #ff0000;">vi /etc/my.cnf</span></strong>
<span style="color: #ff0000;"><em>
[mysqld]</em></span>
<span style="color: #ff0000;"><em><strong>wsrep_cluster_address = gcomm://node01-sqlw,node03-sqlw</strong></em></span>
<span style="color: #ff0000;"><em>wsrep_provider = /usr/lib64/galera3/libgalera_smm.so</em></span>
<span style="color: #ff0000;"><em>wsrep_slave_threads = 8</em></span>
<span style="color: #ff0000;"><em>wsrep_cluster_name = SQL-Cluster</em></span>
<span style="color: #ff0000;"><em>wsrep_node_name = <strong>node02-sqlw</strong></em></span>
<span style="color: #ff0000;"><em>wsrep_node_address = <strong>node02-sqlw/strong&gt;
wsrep_sst_method = xtrabackup-v2
wsrep_sst_auth = <strong>mysql-cluster:mysql@2021</strong></strong></em></span></pre>
<pre>[root@node02-sqlw ~]#<span style="color: #ff0000;"><strong> systemctl start mariadb &amp;&amp; systemctl enable mariadb</strong></span></pre>
<p><strong>Vérifier sur node01-sqlw l’ajout du node02.</strong></p>
<pre>MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">show global status like 'wsrep_cluster_size';</span></strong></pre>
<p><img loading="lazy" decoding="async" width="527" height="109" class="wp-image-2384" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-600.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-600.png 527w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-600-300x62.png 300w" sizes="auto, (max-width: 527px) 100vw, 527px" /></p>
<p><strong>Vérifier que le node02 est bien en mode synchronisé.</strong></p>
<pre>[root@node02-sqlw ~]#<strong><span style="color: #ff0000;"> mysql -u root –p</span></strong></pre>
<p>Ici la mot root est celui répliqué par la synchronisation de node01 =&gt; node02.</p>
<pre>MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">SHOW STATUS LIKE 'wsrep_local_state_comment';</span></strong></pre>
<p><img loading="lazy" decoding="async" width="723" height="182" class="wp-image-2386" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-601.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-601.png 723w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-601-300x76.png 300w" sizes="auto, (max-width: 723px) 100vw, 723px" /></p>
<pre>MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> select * from mysql.user;</span></strong></pre>
<p><img loading="lazy" decoding="async" width="1121" height="298" class="wp-image-2387" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-602.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-602.png 1121w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-602-300x80.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-602-1024x272.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-602-768x204.png 768w" sizes="auto, (max-width: 1121px) 100vw, 1121px" /></p>
<p>Le nœud node02-sqlw est bien synchronisé au Cluster et à bien récupérer par la synchronisation les users de la table mysql.user.</p>
<h3>10°) Configurer le nœud node03-sqlw</h3>
<pre>[root@node03-sqlw ~]#<strong><span style="color: #ff0000;"> systemctl stop mariadb</span></strong></pre>
<pre>[root@node03-sqlw ~]#<strong><span style="color: #ff0000;"> vi /etc/my.cnf</span></strong>
<em><span style="color: #ff0000;">
[mysqld]</span></em>
<em><span style="color: #ff0000;"><strong>wsrep_cluster_address = gcomm://node01-sqlw,node02-sqlw</strong></span></em>
<em><span style="color: #ff0000;">wsrep_provider = /usr/lib64/galera3/libgalera_smm.so</span></em>
<em><span style="color: #ff0000;">wsrep_slave_threads = 8</span></em>
<em><span style="color: #ff0000;">wsrep_cluster_name = SQL-Cluster</span></em>
<em><span style="color: #ff0000;">wsrep_node_name = <strong>node03-sqlw</strong></span></em>
<em><span style="color: #ff0000;">wsrep_node_address = <strong>node03-sqlw</strong></span></em>
<em><span style="color: #ff0000;">wsrep_sst_method = xtrabackup-v2</span></em>
<em><span style="color: #ff0000;">wsrep_sst_auth = <strong>mysql-cluster:mysql@2021</strong></span></em></pre>
<pre><span style="color: #000000;">[root@node03-sqlw~ ~]#<span style="color: #ff0000;"><strong>systemctl start maria</strong></span></span><span style="color: #ff0000;"><strong>db &amp;&amp; systemctl enable mariadb</strong></span></pre>
<p><strong>Vérifier sur node01-sqlw l’ajout du node03.</strong></p>
<pre>MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> show global status like 'wsrep_cluster_size';</span></strong></pre>
<p><img loading="lazy" decoding="async" width="561" height="137" class="wp-image-2389" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-603.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-603.png 561w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-603-300x73.png 300w" sizes="auto, (max-width: 561px) 100vw, 561px" /></p>
<p><strong>Vérifier que le node03 est bien en mode synchronisé.</strong></p>
<pre>[root@node03-sqlw ~]# <strong><span style="color: #ff0000;">mysql -u root -p</span></strong></pre>
<p>Pareil pour ne node2 , le mot de passe devrait être celui défini sur le node01 et répliqué par la synchronisation des nœuds.</p>
<pre>MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>SHOW STATUS LIKE 'wsrep_local_state_comment';</strong></span></pre>
<p><img loading="lazy" decoding="async" width="677" height="151" class="wp-image-2392" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-604.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-604.png 677w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-604-300x67.png 300w" sizes="auto, (max-width: 677px) 100vw, 677px" /></p>
<pre>MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> select * from mysql.user;</span></strong></pre>
<p><img loading="lazy" decoding="async" width="1048" height="289" class="wp-image-2394" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-605.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-605.png 1048w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-605-300x83.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-605-1024x282.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-605-768x212.png 768w" sizes="auto, (max-width: 1048px) 100vw, 1048px" /></p>
<p>A ce stade les trois machines Mysql/Percona sont bien synchronisées entre elles.</p>
<h3>11°) Reconfigurer node01-sqlw</h3>
<p>Il faut à présent reprendre la configuration de la machine node01-sqlw pour qu’elle synchronise avec les machines node02 et node03. En</p>
<pre>[root@node01-sqlw ~]# <span style="color: #ff0000;"><strong>systemctl stop mariadb</strong></span></pre>
<pre>
[root@node01-sqlw ~]#<strong><span style="color: #ff0000;"> vi /etc/my.cnf</span></strong>
<span style="color: #ff0000;"><em>
[mysqld]</em></span>
<span style="color: #ff0000;"><strong><em>#wsrep_cluster_address = gcomm://</em></strong></span>
<span style="color: #ff0000;"><strong><em>wsrep_cluster_address = gcomm://node02-sqlw,node03-sqlw</em></strong></span>
<span style="color: #ff0000;"><em>wsrep_provider = /usr/lib64/galera3/libgalera_smm.so</em></span>
<span style="color: #ff0000;"><em>wsrep_slave_threads = 8</em></span>
<span style="color: #ff0000;"><em>wsrep_cluster_name = SQL-Cluster</em></span>
<span style="color: #ff0000;"><em>wsrep_node_name = </em><strong><em>node01-sqlw</em></strong></span>
<span style="color: #ff0000;"><em>wsrep_node_address = </em><strong><em>node01-sqlw</em></strong></span>
<span style="color: #ff0000;"><em>wsrep_sst_method = xtrabackup-v2</em></span>
<span style="color: #ff0000;"><em>wsrep_sst_auth = </em><strong><em>mysql-cluster:mysql@2021</em></strong></span></pre>
<pre>[root@node01-sqlw ~]# <strong><span style="color: #ff0000;">systemctl start mariadb</span></strong></pre>
<h3><strong>12°)  Création de Base sur Node01 et réplication automatique sur les Node02 et Node03</strong></h3>
<pre>[root@<strong>node01-sqlw</strong> cp219538]# <span style="color: #ff0000;"><strong>mysql -u root –p</strong></span>
MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">CREATE DATABASE Cluster_Test;</span></strong>
Query OK, 1 row affected (0.008 sec)</pre>
<pre>MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> SHOW DATABASES;</span></strong></pre>
<p><img loading="lazy" decoding="async" width="533" height="194" class="wp-image-2395" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-606.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-606.png 533w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-606-300x109.png 300w" sizes="auto, (max-width: 533px) 100vw, 533px" /></p>
<p><strong>Côté node02-sqlw et node03-sqlw</strong></p>
<pre>[root@node02-sqlw ~]# <strong><span style="color: #ff0000;">mysql -u root -p -e "SHOW DATABASES;"</span></strong></pre>
<p><img loading="lazy" decoding="async" width="578" height="347" class="wp-image-2397" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-607.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-607.png 578w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-607-300x180.png 300w" sizes="auto, (max-width: 578px) 100vw, 578px" /></p>
<p>Views: 9</p><p>L’article <a href="https://coffeebreak.en-images.info/modop-partie-3-installation-wordpress-en-ha-cluster-mysql/">MODOP &#8211; PARTIE 3 &#8211; Installation WordPress en HA – Cluster MySQL</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://coffeebreak.en-images.info/modop-partie-3-installation-wordpress-en-ha-cluster-mysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MODOP – PARTIE 1 &#8211; Installation WordPress en HA – Présentation</title>
		<link>https://coffeebreak.en-images.info/modop-installation-wordpress-en-ha-presentation/</link>
					<comments>https://coffeebreak.en-images.info/modop-installation-wordpress-en-ha-presentation/#respond</comments>
		
		<dc:creator><![CDATA[chris]]></dc:creator>
		<pubDate>Sun, 27 Jun 2021 16:40:31 +0000</pubDate>
				<category><![CDATA[AlmaLinux]]></category>
		<category><![CDATA[Cluster Apache]]></category>
		<category><![CDATA[Cluster HAProxy]]></category>
		<category><![CDATA[Cluster Mysql/MariaDB]]></category>
		<category><![CDATA[RedHat/Centos Linux]]></category>
		<category><![CDATA[Système]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cluster GlusterFS]]></category>
		<category><![CDATA[Cluster HA]]></category>
		<category><![CDATA[Cluster MySQL]]></category>
		<category><![CDATA[RockyLinux]]></category>
		<guid isPermaLink="false">https://coffeebreak.en-images.info/?p=2270</guid>

					<description><![CDATA[<p>Mise en place d'une Infrastructure WEB haute disponibilité via des Clusters "Tiers" . Ici on aura  4 Clusters (HaProxy, Mysql , Apache , GLusterFS).<br />
Le site test sera un Wordpress.</p>
<p>L’article <a href="https://coffeebreak.en-images.info/modop-installation-wordpress-en-ha-presentation/">MODOP – PARTIE 1 &#8211; Installation WordPress en HA – Présentation</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Le but est de rendre disponible une application web (ici WordPress) dans une infrastructure la plus solide possible.</p>
<h3><strong>Principe </strong></h3>
<p><img loading="lazy" decoding="async" width="1146" height="766" class="wp-image-2274" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-570.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-570.png 1146w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-570-300x201.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-570-1024x684.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-570-768x513.png 768w" sizes="auto, (max-width: 1146px) 100vw, 1146px" /></p>
<h3><strong>Inventaire des Machines</strong></h3>
<p><img loading="lazy" decoding="async" width="1087" height="293" class="wp-image-2275" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-571.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-571.png 1087w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-571-300x81.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-571-1024x276.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-571-768x207.png 768w" sizes="auto, (max-width: 1087px) 100vw, 1087px" /></p>
<h3><strong>Composition des Clusters </strong></h3>
<h3><strong>Cluster HaProxy + keepalive(RockyLinux 8 fork RHEL8)</strong></h3>
<p><a href="https://coffeebreak.en-images.info/?p=2580">MODOP – PARTIE 5 – Installation WordPress en HA – Cluster HaProxy</a></p>
<p><strong>3 machines HaProxy</strong></p>
<ul>
<li>node01-haw 172.16.186.20</li>
<li>node02-haw 172.16.186.21</li>
<li>node03-haw 172.16.186.22</li>
<li>node-haw 192.168.1.230/24(vIP)</li>
</ul>
<p><img loading="lazy" decoding="async" width="955" height="173" class="wp-image-2277" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-572.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-572.png 955w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-572-300x54.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-572-768x139.png 768w" sizes="auto, (max-width: 955px) 100vw, 955px" /></p>
<p>HaProxy va repartir la charge réseau en fonction de la disponibilité des machines du réseau.<br />
Si votre site possède une forte affluence, HaProxy répartira les différentes requêtes SQL, http sur les différents Cluster de machine.<br />
Ici on utilisera 3 machines HaProxy pour gérer la gestion « tiers » panne.<br />
En effet, il y aura un master et deux slaves.</p>
<ul>
<li>Si le master est down l’un des deux « slaves » passe en master et répondra aux requêtes.</li>
<li>Si le deuxième master tombe alors le troisième passera Master.</li>
</ul>
<p>Statistiquement la panne de 2 serveurs sur 3 est assez rare.</p>
<h3><strong>GlusterFS cluster (Centos7)</strong></h3>
<ul>
<li><a href="https://coffeebreak.en-images.info/?p=2310">MODOP – PARTIE 2 – Installation WordPress en HA – GlusterFS</a></li>
</ul>
<p><strong>3 machines GlusterFS</strong></p>
<ul>
<li>node01-gfsw 172.16.186.24</li>
<li>node02-gfsw 172.16.186.25</li>
<li>node03-gfsw 172.16.186.26</li>
</ul>
<p><img loading="lazy" decoding="async" width="965" height="174" class="wp-image-2280" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-573.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-573.png 965w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-573-300x54.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-573-768x138.png 768w" sizes="auto, (max-width: 965px) 100vw, 965px" /></p>
<p>GlusterFS est un service de fichiers distribués. Chaque fichier inscrit sur une machine est automatiquement répliqué sur les autres machines du cluster.<br />
Si une machine du cluster est down, les fichiers restent disponibles sur les deux autres nœuds du Cluster.<br />
Nous allons héberger les fichiers de conf (Apache, haProxy ) et le site de WordPress.<br />
Cela nous permettra de centraliser les fichiers nécessaires au fonctionnement des Clusters.</p>
<h3><strong>MySQL cluster (AlmaLinux 8 fork RHEL8)</strong></h3>
<p><a href="https://coffeebreak.en-images.info/?p=2359">MODOP &#8211; PARTIE 3 &#8211; Installation WordPress en HA – Cluster Mysql</a></p>
<p><strong>3 machines MySQL</strong></p>
<ul>
<li>node01-sqlw 172.16.186.27</li>
<li>node02-sqlw 172.16.186.28</li>
<li>node03-sqlw 172.16.186.29</li>
</ul>
<p><img loading="lazy" decoding="async" width="944" height="166" class="wp-image-2282" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-574.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-574.png 944w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-574-300x53.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-574-768x135.png 768w" sizes="auto, (max-width: 944px) 100vw, 944px" /></p>
<p>Le cluster MySQL est constitué de 3 nœuds MySQL en Master-Master-Master. Toutes données inscrites sur un des nœuds est répliquées automatiquement sur les autres nœuds du cluster.<br />
Si une machine est down, les autres machines répondront aux requêtes via le Cluster HaProxy.<br />
Quand la machine reviendra UP dans le Cluster, elle se resynchronisera automatiquement auprès des autres machines du cluster.</p>
<h3><strong>Web cluster apache/PHP</strong></h3>
<p><a href="https://coffeebreak.en-images.info/?p=2439">MODOP – PARTIE 4 – Installation WordPress en HA – Cluster Apache </a></p>
<p><strong>3 machines Apache/php</strong></p>
<ul>
<li>node01-webw 172.16.186.30</li>
<li>node02-webw 172.16.186.31</li>
<li>node03-webw 172.16.186.32</li>
</ul>
<p><img loading="lazy" decoding="async" width="933" height="166" class="wp-image-2283" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-575.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-575.png 933w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-575-300x53.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-575-768x137.png 768w" sizes="auto, (max-width: 933px) 100vw, 933px" /></p>
<p>Le Cluster Apache hébergera uniquement le service Apache/PHP pour le site WordPress, il répondra à toutes les requêtes de HaProxy.<br />
Nous sommes encore sous le mode « tiers ». Si une machine cesse de fonctionner les deux autres répondrons aux sollicitations de HaProxy via le LoadBalancing.</p>
<h3><strong>Conclusion </strong></h3>
<p>Dans notre infrastructure nous avons 4 clusters de service en mode « tiers » Haute disponibilité</p>
<ul>
<li>Cluster HaProxy + KeepAlived</li>
<li>Cluster GlusterFS</li>
<li>Cluster MySQL</li>
<li>Cluster Web</li>
</ul>
<p>Pour que ce mode soit le plus résilient, il faut impérativement provisionner chacun des services sur des machines hyperviseurs différentes (VMware, Proxmox ,HyperV ,etc) .</p>
<p><img loading="lazy" decoding="async" width="1136" height="502" class="wp-image-2285" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-576.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-576.png 1136w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-576-300x133.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-576-1024x453.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-576-768x339.png 768w" sizes="auto, (max-width: 1136px) 100vw, 1136px" /></p>
<p>Bref si un Hyperviseur est down, les deux autres répondrons aux sollicitations des clients.</p>
<p>Si les hyperviseurs sont gérés par le mode HA, les machines virtuelles hébergées par l’hyperviseur en panne migreront automatiquement sur les autres hyperviseurs UP.</p>
<h3><strong>Prérequis </strong></h3>
<p>La première étape sera d’inscrire toutes les machines de notre infrastructure « WordPress » sur nos DNS primaire et secondaire afin que les machines se trouvent facilement par leur nom d’host.</p>
<ul>
<li><a href="https://coffeebreak.en-images.info/?p=1111">MODOP – Configurer un DNS Primaire et Secondaire – Centos7 – SysBreak Info (en-images.info)</a></li>
</ul>
<pre><em>[root@dns-pri ~]# vi /var/named/forward.house.cpb</em>
<em>; ### infrastructure WordPress ###</em>
<em>;</em>
<em>; Cluster HAproxy</em>
<em>node01-haw IN A 172.16.186.20</em>
<em>node02-haw IN A 172.16.186.21</em>
<em>node03-haw IN A 172.16.186.22</em>
<em>node-haw IN A 192.168.1.230</em>
<em>; Cluster GlusterFS</em>
<em>node01-gfsw IN A 172.16.186.24</em>
<em>node02-gfsw IN A 172.16.186.25</em>
<em>node03-gfsw IN A 172.16.186.26</em>
<em>; Cluster MySQL</em>
<em>node01-sqlw IN A 172.16.186.27</em>
<em>node02-sqlw IN A 172.16.186.28</em>
<em>node03-sqlw IN A 172.16.186.29</em>
<em>; Cluster Web Httpd/PHP</em>
<em>node01-webw IN A 172.16.186.30</em>
<em>node02-webw IN A 172.16.186.31</em>
<em>node03-webw IN A 172.16.186.32</em></pre>
<p><em><img loading="lazy" decoding="async" width="439" height="122" class="wp-image-2288" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-577.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-577.png 439w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-577-300x83.png 300w" sizes="auto, (max-width: 439px) 100vw, 439px" /></em></p>
<p>Modifier le numéro de série et redémarrer le service apache.</p>
<pre>[root@dns-pri ~]# systemctl reload named</pre>
<p>Côté DNS Primaire<br />
<img loading="lazy" decoding="async" width="1361" height="193" class="wp-image-2290" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-578.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-578.png 1361w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-578-300x43.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-578-1024x145.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-578-768x109.png 768w" sizes="auto, (max-width: 1361px) 100vw, 1361px" /></p>
<p>Côté DNS Secondaire<br />
<img loading="lazy" decoding="async" width="1444" height="148" class="wp-image-2291" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-579.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-579.png 1444w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-579-300x31.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-579-1024x105.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-579-768x79.png 768w" sizes="auto, (max-width: 1444px) 100vw, 1444px" /></p>
<p>Test sur un client<br />
<img loading="lazy" decoding="async" width="962" height="447" class="wp-image-2293" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-580.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-580.png 962w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-580-300x139.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-580-768x357.png 768w" sizes="auto, (max-width: 962px) 100vw, 962px" /></p>
<p>Views: 25</p><p>L’article <a href="https://coffeebreak.en-images.info/modop-installation-wordpress-en-ha-presentation/">MODOP – PARTIE 1 &#8211; Installation WordPress en HA – Présentation</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://coffeebreak.en-images.info/modop-installation-wordpress-en-ha-presentation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
