<?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>cluster Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/cluster/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Sat, 07 Sep 2019 22:22:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How to create a MariaDB cluster on Debian 10?</title>
		<link>https://www.osradar.com/create-a-mariadb-cluster-debian-10/</link>
					<comments>https://www.osradar.com/create-a-mariadb-cluster-debian-10/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Tue, 10 Sep 2019 23:11:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mariadb]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=13320</guid>

					<description><![CDATA[<p>We often use MariaDB in our tutorials. In fact, along with PostgreSQL, they are the most powerful relational database management systems out there. At least, among the community alternatives. Then, we can make hateful comparisons against payment solutions like Oracle or DB2. The point is, MariaDB has very special features that make it quite good. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/create-a-mariadb-cluster-debian-10/">How to create a MariaDB cluster on Debian 10?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We often use MariaDB in our tutorials. In fact, along with PostgreSQL, they are the most powerful relational database management systems out there. At least, among the community alternatives. Then, we can make hateful comparisons against payment solutions like Oracle or DB2. The point is, MariaDB has very special features that make it quite good. One of those features is the possibility to create our own database cluster using MariaDB. The reality is that it is quite simple. So in this post, I will show you how to create a MariaDB cluster on Debian 10?</p>
<h2>The cluster environment</h2>
<p>A cluster in informatics is understood as the union of different components of hardware or software that work together as if it were a single one. In this case, our objective will be that the databases that we make in the first node, automatically, are replicated in the second.</p>
<p>For it, I will use in both nodes the following configuration:</p>
<p>Node 1:</p>
<pre>OS: Debian 10 Buster
Hostname: osradar1
IP address: 192.168.250.100
RAM Memory: 512 mb
Hard drive: 20gb</pre>
<p>Node 2:</p>
<pre>OS: Debian 10 Buster
Hostname: osradar2
IP address: 192.168.250.101
RAM Memory: 512 mb
Hard drive: 20gb</pre>
<p>So we can get started.</p>
<h2>Installing MariaDB Galera Cluster</h2>
<p>To make a cluster with MariaDB it is necessary to install Galera cluster. However, from the most recent versions of MariaDB, this utility is incorporated into the main server package. Therefore, there is nothing strange to do. We will take this opportunity to install a necessary package such as <code>rsync</code>.</p>
<p>It is necessary that your user is able to execute commands with sudo, if not, read our tutorial to enable it.</p>
<p>Read, <a href="https://www.osradar.com/how-to-enable-sudo-on-debian-10/" rel="noopener">How to enable sudo on Debian 10?</a></p>
<p>Once you&#8217;ve done that, we can start with the installation:</p>
<pre>:~$ sudo apt install rsync mariadb-server mariadb-client</pre>
<p>This process has to be done in both nodes.</p>
<h2>Configure the MariaDB cluster</h2>
<p>Now it is necessary to configure a little the cluster so that the nodes can communicate between them. In the first node, you have to edit the file <code>/etc/mysql/mariadb.conf.d/50-server.cnf</code> and modify some things.</p>
<pre>:~$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf</pre>
<p>And add the following:</p>
<pre class="wp-block-code">[galera]
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
wsrep_cluster_name="galera_cluster"
wsrep_node_address="db1"
wsrep_node_name="osradar1"</pre>
<p>The following must be edited within this text file:</p>
<pre>wsrep_cluster_address="gcomm://[NODE1_IP_ADDRESS,NODE2_IP_ADDRESS..]"</pre>
<p>For example:</p>
<pre>wsrep_cluster_address="gcomm://192.168.250.100,192.168.250.101"</pre>
<p>Further down in the same file you have to edit the node configuration:</p>
<pre>wsrep_node_address="192.168.250.100"
wsrep_node_name="osradar1"</pre>
<figure id="attachment_13484" aria-describedby="caption-attachment-13484" style="width: 656px" class="wp-caption alignnone"><img loading="lazy" class="wp-image-13484 size-full" src="https://www.osradar.com/wp-content/uploads/2019/09/1-4.png" alt="1.-configuring a MariaDB cluster on Debian 10" width="656" height="255" srcset="https://www.osradar.com/wp-content/uploads/2019/09/1-4.png 656w, https://www.osradar.com/wp-content/uploads/2019/09/1-4-300x117.png 300w" sizes="(max-width: 656px) 100vw, 656px" /><figcaption id="caption-attachment-13484" class="wp-caption-text">1.-configuring a MariaDB cluster on Debian 10</figcaption></figure>
<p>Then save the changes and close the file.</p>
<p>In node2, in the same configuration file, the changes would be as follows:</p>
<pre>wsrep_cluster_address="gcomm://192.168.250.100,192.168.250.101"</pre>
<p>And:</p>
<pre>wsrep_node_address="192.168.250.101"
wsrep_node_name="osradar2"</pre>
<p>In both nodes, a root password must be defined for MariaDB. You can do this with the following command:</p>
<pre>:~$ sudo mysql_secure_installation</pre>
<p>If you use a firewall, then you need to open the following ports:</p>
<ul>
<li>3306/tcp</li>
<li>4444/tcp</li>
<li>4567/tcp</li>
<li>4568/tcp</li>
<li>4567/udp</li>
</ul>
<p>This has to be done in both nodes.</p>
<h2>Initializing and testing the cluster</h2>
<p>Now we can initialize the cluster. To do this, stop the MariaDB service in both nodes:</p>
<pre>:~$ sudo systemctl stop mariadb</pre>
<p>Then, at the first node, start the cluster with the following command:</p>
<pre>:~$ sudo galera_new_cluster</pre>
<p>Once you start it, you won&#8217;t see a screen output. But if you check the status of the cluster, you will notice that it already recognizes the first node:</p>
<pre>:~$ sudo mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"</pre>
<figure id="attachment_13485" aria-describedby="caption-attachment-13485" style="width: 669px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-13485" src="https://www.osradar.com/wp-content/uploads/2019/09/2-3.png" alt="2.- Check the cluster status" width="669" height="195" srcset="https://www.osradar.com/wp-content/uploads/2019/09/2-3.png 669w, https://www.osradar.com/wp-content/uploads/2019/09/2-3-300x87.png 300w" sizes="(max-width: 669px) 100vw, 669px" /><figcaption id="caption-attachment-13485" class="wp-caption-text">2.- Check the cluster status</figcaption></figure>
<p>At the second node, start the MariaDB service:</p>
<pre>:~$ sudo systemctl start mariadb</pre>
<p>With this, the second node will be automatically added to the cluster. To check it, just execute this command in the first node:</p>
<pre>:~$ sudo mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"</pre>
<figure id="attachment_13486" aria-describedby="caption-attachment-13486" style="width: 670px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-13486" src="https://www.osradar.com/wp-content/uploads/2019/09/3-4.png" alt="3.- The second node has been added" width="670" height="216" srcset="https://www.osradar.com/wp-content/uploads/2019/09/3-4.png 670w, https://www.osradar.com/wp-content/uploads/2019/09/3-4-300x97.png 300w" sizes="(max-width: 670px) 100vw, 670px" /><figcaption id="caption-attachment-13486" class="wp-caption-text">3.- The second node has been added</figcaption></figure>
<p>And now we&#8217;ll see that this is the second node added.</p>
<p>To test the cluster just create a database in the first node and see how it automatically replicates in the second:</p>
<pre>:~$ sudo mysql -u root -p
&gt; SHOW DATABASES;
&gt; CREATE DATABASE example;</pre>
<p>In the second node:</p>
<pre>:~$ sudo mysql -u root -p
&gt; SHOW DATABASES;</pre>
<figure id="attachment_13487" aria-describedby="caption-attachment-13487" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-13487" src="https://www.osradar.com/wp-content/uploads/2019/09/4-4.png" alt="4.- Testing the MariaDB cluster on Debian 10" width="1366" height="571" srcset="https://www.osradar.com/wp-content/uploads/2019/09/4-4.png 1366w, https://www.osradar.com/wp-content/uploads/2019/09/4-4-300x125.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/4-4-768x321.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/4-4-1024x428.png 1024w, https://www.osradar.com/wp-content/uploads/2019/09/4-4-696x291.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/4-4-1068x446.png 1068w, https://www.osradar.com/wp-content/uploads/2019/09/4-4-1005x420.png 1005w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-13487" class="wp-caption-text">4.- Testing the MariaDB cluster on Debian 10</figcaption></figure>
<p>This way you can easily create a MariaDB cluster on Debian 10.</p>
<h2>Conclusion</h2>
<p>A MariaDB cluster can be created in Debian 10, quite simply. Since the application incorporates it in the same package. Just install it and make some configurations.</p>
<p>Please share this post and join <a href="https://t.me/osradar" rel="noopener">our Telegram channel</a>.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/create-a-mariadb-cluster-debian-10/">How to create a MariaDB cluster on Debian 10?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/create-a-mariadb-cluster-debian-10/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create Nginx High Availability with Pacemaker and Corosync on CentOS 7</title>
		<link>https://www.osradar.com/create-nginx-high-availability-with-pacemaker-and-corosync-on-centos-7/</link>
					<comments>https://www.osradar.com/create-nginx-high-availability-with-pacemaker-and-corosync-on-centos-7/#respond</comments>
		
		<dc:creator><![CDATA[Muhammad Nabeel]]></dc:creator>
		<pubDate>Tue, 19 Feb 2019 09:32:19 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos 7]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[redhat 7]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=10896</guid>

					<description><![CDATA[<p>In this article, you will learn that how to create a high availability Nginx Web Server Cluster with Pacemaker, Corosync, and Pcsd. We will create Failover-cluster for Nginx web server using Pacemaker on a CentOS 7 system. Pacemaker is an open source cluster manager software that achieves maximum high availability of your services. Corosync Cluster [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/create-nginx-high-availability-with-pacemaker-and-corosync-on-centos-7/">Create Nginx High Availability with Pacemaker and Corosync on CentOS 7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, you will learn that how to create a high availability Nginx Web Server Cluster with Pacemaker, Corosync, and Pcsd. We will create Failover-cluster for Nginx web server using Pacemaker on a CentOS 7 system.</p>
<p>Pacemaker is an open source cluster manager software that achieves maximum high availability of your services.</p>
<p>Corosync Cluster Engine is an open source project derived from the OpenAIS project under new BSD License. It&#8217;s a group communication system with additional features for implementing High Availability within applications.</p>
<p><strong>Prerequisites</strong></p>
<ol>
<li>Two or more CentOS Servers</li>
<li>Each server must have unique IP address</li>
<li>At leat one Floating IP Address</li>
<li>Root Privileges</li>
</ol>
<p><strong>Our Working Environment</strong><br />
host1 192.168.130.141<br />
host2 192.168.130.142<br />
host3 192.168.130.143<br />
Floating IP Address 192.168.130.222</p>
<h4><strong>Run step 1 to step 3 on all servers host1, host2 and host3</strong></h4>
<h1>Step 1: Configure Host File</h1>
<p>Edit the host file on each server in order to map the hostname of all servers. login to each server (host1, host2 and host3) one by one and run below commands.</p>
<pre>vi /etc/hosts</pre>
<p>and add below configurations.</p>
<pre>192.168.130.141 host1
192.168.130.142 host2
192.168.130.141 host3</pre>
<p>Save changes and exit</p>
<p><img loading="lazy" class="alignnone wp-image-10897" src="https://www.osradar.com/wp-content/uploads/2019/02/1-1-300x77.jpg" alt="" width="682" height="175" srcset="https://www.osradar.com/wp-content/uploads/2019/02/1-1-300x77.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/1-1-768x198.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/1-1-696x180.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/1-1.jpg 964w" sizes="(max-width: 682px) 100vw, 682px" /></p>
<p>Now test the hosts&#8217; configuration using below commands.</p>
<pre>ping -c 2 host1
ping -c 2 host2
ping -c 2 host3</pre>
<p><img loading="lazy" class="alignnone wp-image-10898" src="https://www.osradar.com/wp-content/uploads/2019/02/2-2-300x181.jpg" alt="" width="680" height="410" srcset="https://www.osradar.com/wp-content/uploads/2019/02/2-2-300x181.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/2-2-768x464.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/2-2-696x420.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/2-2-695x420.jpg 695w, https://www.osradar.com/wp-content/uploads/2019/02/2-2.jpg 972w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>Make sure &#8216;host1&#8217;, &#8216;host2&#8217; and &#8216;host3&#8217; are mapped to correct IP addresses.</p>
<h1>Step 2: Install Nginx</h1>
<p>Run below commands on host1, host2 and host3 to install nginx web server.</p>
<pre>yum install epel-release -y
yum install nginx -y</pre>
<p><img loading="lazy" class="alignnone wp-image-10899" src="https://www.osradar.com/wp-content/uploads/2019/02/3-2-300x147.jpg" alt="" width="680" height="333" srcset="https://www.osradar.com/wp-content/uploads/2019/02/3-2-300x147.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/3-2-768x377.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/3-2-324x160.jpg 324w, https://www.osradar.com/wp-content/uploads/2019/02/3-2-533x261.jpg 533w, https://www.osradar.com/wp-content/uploads/2019/02/3-2-696x342.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/3-2-856x420.jpg 856w, https://www.osradar.com/wp-content/uploads/2019/02/3-2.jpg 976w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>After installation, set the default index.html page on each server.</p>
<pre>##Run below Command on host1
echo '&lt;h1&gt;host1 - osradar.com&lt;/h1&gt;' &gt; /usr/share/nginx/html/index.html

##Run below Command on host2
echo '&lt;h1&gt;host2 - osradar.com&lt;/h1&gt;' &gt; /usr/share/nginx/html/index.html

##Run below Command on host3
echo '&lt;h1&gt;host3 - osradar.com&lt;/h1&gt;' &gt; /usr/share/nginx/html/index.html</pre>
<h1>Step 3: Installation and configuration of Pacemaker, Corosync, and Pcsd</h1>
<p>Run below commands on each server to install Pacemaker, Corosync, and Pcsd</p>
<pre>yum install corosync pacemaker pcs -y</pre>
<p>Then run below commands on each server to enable all services to launch automatically at system boot.</p>
<pre>systemctl enable pacemaker
systemctl enable corosync
systemctl enable pcsd</pre>
<p>Now start the pcsd Pacemaker command line interface on all servers.</p>
<pre>systemctl start pcsd</pre>
<p>Now set a new password for &#8216;hacluster&#8217; user password must be same for all servers. This user has been created automatically during software installation.</p>
<p>RUn below command to all servers and set same password.</p>
<pre>passwd hacluster</pre>
<p><img loading="lazy" class="alignnone wp-image-10900" src="https://www.osradar.com/wp-content/uploads/2019/02/4-1-300x133.jpg" alt="" width="679" height="301" srcset="https://www.osradar.com/wp-content/uploads/2019/02/4-1-300x133.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/4-1-768x342.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/4-1-1024x455.jpg 1024w, https://www.osradar.com/wp-content/uploads/2019/02/4-1-696x310.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/4-1-1068x475.jpg 1068w, https://www.osradar.com/wp-content/uploads/2019/02/4-1-944x420.jpg 944w, https://www.osradar.com/wp-content/uploads/2019/02/4-1.jpg 1329w" sizes="(max-width: 679px) 100vw, 679px" /></p>
<p>High Availability software have been installed on to the system.</p>
<h1>Step 4: Create and Configure Cluster</h1>
<h4><strong>Note: Run steps 4 to step 7 on &#8220;host1&#8221; only.</strong></h4>
<p>We will create a new cluster with 3 servers.</p>
<p>we need to authorize all servers to create new cluster using below command. username will be &#8220;hacluster&#8221;</p>
<pre>pcs cluster auth host1 host2 host3</pre>
<p><img loading="lazy" class="alignnone wp-image-10901" src="https://www.osradar.com/wp-content/uploads/2019/02/5-1-300x77.jpg" alt="" width="682" height="175" srcset="https://www.osradar.com/wp-content/uploads/2019/02/5-1-300x77.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/5-1-768x197.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/5-1-696x179.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/5-1.jpg 865w" sizes="(max-width: 682px) 100vw, 682px" /></p>
<p>Now create the cluster named osradar_cluster for all servers using below command.</p>
<pre>pcs cluster setup --name osradar_cluster host1 host2 host3</pre>
<p><img loading="lazy" class="alignnone wp-image-10904" src="https://www.osradar.com/wp-content/uploads/2019/02/7-1-300x192.jpg" alt="" width="680" height="435" srcset="https://www.osradar.com/wp-content/uploads/2019/02/7-1-300x192.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/7-1-768x491.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/7-1-696x445.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/7-1-657x420.jpg 657w, https://www.osradar.com/wp-content/uploads/2019/02/7-1.jpg 989w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>Now start and enable all cluster services using below command.</p>
<pre>pcs cluster start --all
pcs cluster enable --all</pre>
<p><img loading="lazy" class="alignnone wp-image-10905" src="https://www.osradar.com/wp-content/uploads/2019/02/8-1-300x78.jpg" alt="" width="681" height="177" srcset="https://www.osradar.com/wp-content/uploads/2019/02/8-1-300x78.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/8-1-768x199.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/8-1-1024x266.jpg 1024w, https://www.osradar.com/wp-content/uploads/2019/02/8-1-696x180.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/8-1-1068x277.jpg 1068w, https://www.osradar.com/wp-content/uploads/2019/02/8-1.jpg 1180w" sizes="(max-width: 681px) 100vw, 681px" /></p>
<p>Now verify the cluster status.</p>
<pre>pcs status cluster</pre>
<p><img loading="lazy" class="alignnone wp-image-10906" src="https://www.osradar.com/wp-content/uploads/2019/02/9-1-300x98.jpg" alt="" width="680" height="222" srcset="https://www.osradar.com/wp-content/uploads/2019/02/9-1-300x98.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/9-1-768x252.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/9-1-1024x336.jpg 1024w, https://www.osradar.com/wp-content/uploads/2019/02/9-1-696x228.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/9-1-1068x350.jpg 1068w, https://www.osradar.com/wp-content/uploads/2019/02/9-1.jpg 1074w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<h1>Step 5: Disable STONITH and Ignore the Quorum Policy</h1>
<p>Since we are running three node cluster and don&#8217;t have a fencing device. So we have to disable the STONITH setting but it is not recommended for production environment.</p>
<p>Disable STONITH and ignore Quorum policy using below commands.</p>
<pre>pcs property set stonith-enabled=false
pcs property set no-quorum-policy=ignore</pre>
<p>Then make sure stonith and the quorum policy are disabled.</p>
<pre>pcs property list</pre>
<p><img loading="lazy" class="alignnone wp-image-10902" src="https://www.osradar.com/wp-content/uploads/2019/02/6-1-300x84.jpg" alt="" width="682" height="191" srcset="https://www.osradar.com/wp-content/uploads/2019/02/6-1-300x84.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/6-1-768x215.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/6-1-696x195.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/6-1.jpg 1014w" sizes="(max-width: 682px) 100vw, 682px" /></p>
<h1>Step 6: Add the Floating IP and Resources</h1>
<p>Floating IP is the IP address that wil be migrated/moved automatically from one server to another server. Our floating ip address wil be 192.168.130.222 then we will add two resources, the Floating IP address resource with the name &#8216;virtual_ip&#8217; and a new resource for the Nginx web server named &#8216;webserver&#8217;</p>
<p>Run below command to add floating IP address &#8216;virtual_ip&#8217;</p>
<pre>pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.130.222 cidr_netmask=32 op monitor interval=30s</pre>
<p>Then run below command to add a new resource for the Nginx &#8216;webserver&#8217;</p>
<pre>pcs resource create webserver ocf:heartbeat:nginx configfile=/etc/nginx/nginx.conf op monitor timeout="5s" interval="5s"</pre>
<p>Now verify resources status and check that there is no error.</p>
<pre>pcs status resources</pre>
<p><img loading="lazy" class="alignnone wp-image-10903" src="https://www.osradar.com/wp-content/uploads/2019/02/10-1-300x61.jpg" alt="" width="679" height="138" srcset="https://www.osradar.com/wp-content/uploads/2019/02/10-1-300x61.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/10-1-768x156.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/10-1-1024x208.jpg 1024w, https://www.osradar.com/wp-content/uploads/2019/02/10-1-696x142.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/10-1-1068x217.jpg 1068w, https://www.osradar.com/wp-content/uploads/2019/02/10-1.jpg 1366w" sizes="(max-width: 679px) 100vw, 679px" /></p>
<h1>Step 7: Add Constraint Rules to the Cluster</h1>
<p>Now will configure High Availability Rules and resource constraint.</p>
<p>Set the collation constraint for webserver and virtual_ip resources with the score &#8216;INFINITY&#8217; using below command.</p>
<pre>pcs constraint colocation add webserver virtual_ip INFINITY</pre>
<p>Now Set the &#8216;virtual_ip&#8217; and &#8216;webserver&#8217; resources always on same node servers using below command.</p>
<pre>pcs constraint order virtual_ip then webserver</pre>
<p>Next, stop and start the cluster</p>
<pre>pcs cluster stop --all
pcs cluster start --all</pre>
<p>Now again verify resources status.</p>
<pre>pcs status resources</pre>
<p>You can sse that virtual_ip and webserver resources started on the same server/node &#8216;host2&#8217;</p>
<p><img loading="lazy" class="alignnone wp-image-10907" src="https://www.osradar.com/wp-content/uploads/2019/02/11-300x59.jpg" alt="" width="676" height="133" srcset="https://www.osradar.com/wp-content/uploads/2019/02/11-300x59.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/11-768x150.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/11-1024x200.jpg 1024w, https://www.osradar.com/wp-content/uploads/2019/02/11-696x136.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/11.jpg 1051w" sizes="(max-width: 676px) 100vw, 676px" /></p>
<h1>Step 8: Configure Firewalld</h1>
<p>Run below commands to add necessary services in firewalld.</p>
<pre>firewall-cmd --add-service=high-availability --permanent 
firewall-cmd --add-service=http --permanent 
firewall-cmd --add-service=https --permanent</pre>
<p>Now reload the firewalld</p>
<pre>firewall-cmd --reload</pre>
<h1>Step 9: Testing</h1>
<p>In this step, we will Test the node status, corosync members and status and then test the high-availability of the Nginx webserver by accessing the Floating IP address.</p>
<p>Test node status corosync members and corosync status using below command.</p>
<pre>pcs status nodes
corosync-cmapctl | grep members
pcs status corosync</pre>
<p>Finally, check the webserver High Availability. Open your web browser and type the Floating IP address 192.168.130.222</p>
<p>You will see the web page from the &#8216;host2&#8217; server.</p>
<p><img loading="lazy" class="alignnone wp-image-10908" src="https://www.osradar.com/wp-content/uploads/2019/02/12-300x91.jpg" alt="" width="683" height="207" srcset="https://www.osradar.com/wp-content/uploads/2019/02/12-300x91.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/12-768x232.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/12-696x211.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/12.jpg 985w" sizes="(max-width: 683px) 100vw, 683px" /></p>
<p>Now, stop the cluster on the &#8216;host2&#8217; server using below command.</p>
<pre>pcs cluster stop host2 --force</pre>
<p>And check again the page and this time, you will see the page from the &#8216;host1&#8217; server as below.</p>
<p><img loading="lazy" class="alignnone wp-image-10909" src="https://www.osradar.com/wp-content/uploads/2019/02/13-300x109.jpg" alt="" width="680" height="247" srcset="https://www.osradar.com/wp-content/uploads/2019/02/13-300x109.jpg 300w, https://www.osradar.com/wp-content/uploads/2019/02/13-768x279.jpg 768w, https://www.osradar.com/wp-content/uploads/2019/02/13-696x253.jpg 696w, https://www.osradar.com/wp-content/uploads/2019/02/13.jpg 990w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>You have installed Nginx webserver High Availability with Pacemaker, Corosync, and Pcsd on CentOS 7 server successfully.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/create-nginx-high-availability-with-pacemaker-and-corosync-on-centos-7/">Create Nginx High Availability with Pacemaker and Corosync on CentOS 7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/create-nginx-high-availability-with-pacemaker-and-corosync-on-centos-7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to install and configure GlusterFS on CentOS 7?</title>
		<link>https://www.osradar.com/how-to-install-and-configure-glusterfs-on-centos-7/</link>
					<comments>https://www.osradar.com/how-to-install-and-configure-glusterfs-on-centos-7/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Wed, 29 Aug 2018 05:13:41 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[glusterfs]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=5455</guid>

					<description><![CDATA[<p>GlusterFS, is a multi-scalable file system for NAS initially developed by Gluster Inc. A Gluster would allow us to connect two machines that will write simultaneously on the same disc, agreeing on the writer. Most of the GlusterFS functionalities are implemented as translators, including: Mirroring and file replication. Fragmentation of the files or Data striping. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-and-configure-glusterfs-on-centos-7/">How to install and configure GlusterFS on CentOS 7?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>GlusterFS, is a multi-scalable file system for NAS initially developed by Gluster Inc. A Gluster would allow us to connect two machines that will write simultaneously on the same disc, agreeing on the writer.</p>
<p>Most of the GlusterFS functionalities are implemented as translators, including:</p>
<ul>
<li>Mirroring and file replication.</li>
<li>Fragmentation of the files or Data striping.</li>
<li>Load balancing for reading and writing files.</li>
<li>Fault tolerant volumes.</li>
<li>I/O planning and disk caching.</li>
<li>The storage quotas.</li>
</ul>
<p>In this tutorial, we will cluster using GlusterFS between two server machines that are using CentOS 7</p>
<h3>0.- Requeriments</h3>
<p>To make this turtorial we will use three computers with GNU/LINUX systems, must have at least 1gb of ram and use 64bits systems, also a separate hard disk in /dev/sdb.</p>
<p>Server 1:</p>
<ul>
<li>Hostname: gluster1.osradar.local</li>
<li>O.S:  CentOS 7</li>
<li>Memory: 1gb</li>
<li>Ip Address: 192.168.1.9</li>
<li>Disk: 8gb /dev/sdb</li>
</ul>
<p>Server 2:</p>
<ul>
<li>Hostname: gluster2.osradar.local</li>
<li>O.S:  CentOS 7</li>
<li>Memory: 1gb</li>
<li>Ip Address: 192.168.1.10</li>
<li>Disk: 8gb /dev/sdb</li>
</ul>
<h3>1.- Configuring DNS (both nodes)</h3>
<p>This first step is vital because GlusterFS uses name resolution to communicate between servers and clients. As root user you write to a terminal:</p>
<pre class="">:~# nano /etc/hosts</pre>
<p>And in the file it places the information of the nodes in the following way:</p>
<pre class="">192.168.1.9 gluster1.osradar.local gluster1
192.168.1.10 gluster2.osradar.local gluster2</pre>
<figure id="attachment_5456" aria-describedby="caption-attachment-5456" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5456" src="https://www.osradar.com/wp-content/uploads/2018/08/1-6.png" alt="1.- DNS config on servers" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/1-6.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/1-6-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/1-6-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/1-6-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/1-6-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/1-6-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/1-6-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5456" class="wp-caption-text">1.- DNS config on servers</figcaption></figure>
<h3>2.- Installing GlusterFS (both nodes)</h3>
<p>To install Gluster we need to add its repository first, to do this, in a terminal we must write:</p>
<pre class="">:~# yum install centos-release-gluster</pre>
<figure id="attachment_5457" aria-describedby="caption-attachment-5457" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5457" src="https://www.osradar.com/wp-content/uploads/2018/08/2-7.png" alt="2.- installing gluster repo package" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/2-7.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/2-7-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/2-7-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/2-7-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/2-7-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/2-7-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/2-7-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5457" class="wp-caption-text">2.- installing gluster repo package</figcaption></figure>
<p>When the package installation is complete, the repository will be added and we can now install GlusterFS.</p>
<pre class="">:~# yum install glusterfs-server</pre>
<figure id="attachment_5458" aria-describedby="caption-attachment-5458" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5458" src="https://www.osradar.com/wp-content/uploads/2018/08/3-7.png" alt="3.- Installing GlusterFS" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/3-7.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/3-7-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/3-7-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/3-7-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/3-7-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/3-7-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/3-7-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5458" class="wp-caption-text">3.- Installing GlusterFS</figcaption></figure>
<p>Once the installation is complete, we can start the service:</p>
<pre class="">:~# systemctl start glusterd
:~# systemctl enable glusterd</pre>
<figure id="attachment_5459" aria-describedby="caption-attachment-5459" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5459" src="https://www.osradar.com/wp-content/uploads/2018/08/4-6.png" alt="4.- Enabling and starting service" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/4-6.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/4-6-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/4-6-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/4-6-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/4-6-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/4-6-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/4-6-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5459" class="wp-caption-text">4.- Enabling and starting service</figcaption></figure>
<p>The next thing to do is to modify the firewall settings:</p>
<pre class="">:~# firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="IP_ADDRESS_HERE" accept'
:~# firewall-cmd --reload</pre>
<figure id="attachment_5460" aria-describedby="caption-attachment-5460" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5460" src="https://www.osradar.com/wp-content/uploads/2018/08/5-7.png" alt="5.- Setting firewall rule" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/5-7.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/5-7-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/5-7-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/5-7-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/5-7-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/5-7-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/5-7-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5460" class="wp-caption-text">5.- Setting firewall rule</figcaption></figure>
<h3>3.-Add a storage (both nodes)</h3>
<p>Now we must prepare the second hard disk (/dev/sdb) to be used as a brick (basic storage unit in Gluster). We&#8217;ll do a partition there.</p>
<pre class="">:~# fdisk /dev/sdb</pre>
<p>To perform the process properly, write the options in this order</p>
<pre class="">Command (m for help): n
Select (default p): p
Partition number (1-4, default 1): 1
press enter
press enter
Command (m for help): p
Command (m for help): w</pre>
<figure id="attachment_5461" aria-describedby="caption-attachment-5461" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5461" src="https://www.osradar.com/wp-content/uploads/2018/08/6-6.png" alt="6.- Creating a new partition" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/6-6.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/6-6-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/6-6-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/6-6-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/6-6-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/6-6-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/6-6-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5461" class="wp-caption-text">6.- Creating a new partition</figcaption></figure>
<p>now we proceed to format the partition:</p>
<pre class="">:~# mkfs.ext4 /dev/sdb1</pre>
<figure id="attachment_5463" aria-describedby="caption-attachment-5463" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5463" src="https://www.osradar.com/wp-content/uploads/2018/08/7-7.png" alt="7.- Formating the partition" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/7-7.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/7-7-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/7-7-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/7-7-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/7-7-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/7-7-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/7-7-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5463" class="wp-caption-text">7.- Formating the partition</figcaption></figure>
<p>Then we create a folder and mount the partition on it.</p>
<pre class="">:~# mkdir -p /data/glusterfs
:~# mount /dev/sdb1 /data/glusterfs</pre>
<figure id="attachment_5464" aria-describedby="caption-attachment-5464" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5464" src="https://www.osradar.com/wp-content/uploads/2018/08/8-5.png" alt="8.- Mounting the partition" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/8-5.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/8-5-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/8-5-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/8-5-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/8-5-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/8-5-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/8-5-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5464" class="wp-caption-text">8.- Mounting the partition</figcaption></figure>
<p>We make sure that the partition is automatically mounted at system boot:</p>
<pre class="">:~# echo "/dev/sdb1 /data/glusterfs ext4 defaults 0 0" | tee --append /etc/fstab</pre>
<figure id="attachment_5465" aria-describedby="caption-attachment-5465" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5465" src="https://www.osradar.com/wp-content/uploads/2018/08/9-7.png" alt="9.- editing fstab " width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/9-7.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/9-7-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/9-7-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/9-7-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/9-7-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/9-7-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/9-7-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5465" class="wp-caption-text">9.- editing fstab</figcaption></figure>
<h3>4.-Configuring GlusterFS</h3>
<p>The next step will be on node 1. tell Gluster that node 2 is trustworthy to build the cluster itself. To do this we must execute the following command:</p>
<pre class="">:~# gluster peer probe gluster2.osradar.local</pre>
<figure id="attachment_5470" aria-describedby="caption-attachment-5470" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5470" src="https://www.osradar.com/wp-content/uploads/2018/08/10-5.png" alt="10.- Setup gluster peer" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/10-5.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/10-5-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/10-5-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/10-5-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/10-5-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/10-5-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/10-5-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5470" class="wp-caption-text">10.- Setup gluster peer</figcaption></figure>
<p>And then we verify that the other node has been added correctly with these commands:</p>
<pre class="">:~# gluster peer status
:~# gluster pool list</pre>
<figure id="attachment_5471" aria-describedby="caption-attachment-5471" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5471" src="https://www.osradar.com/wp-content/uploads/2018/08/11-4.png" alt="11.- Checking the node added" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/11-4.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/11-4-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/11-4-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/11-4-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/11-4-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/11-4-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/11-4-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5471" class="wp-caption-text">11.- Checking the node added</figcaption></figure>
<h3>5.- Creating GlusterFS Volume</h3>
<p>We create a folder on both nodes that will serve as the volume folder:</p>
<pre class="">:~# mkdir -p /data/glusterfs/glustervolume</pre>
<figure id="attachment_5472" aria-describedby="caption-attachment-5472" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5472" src="https://www.osradar.com/wp-content/uploads/2018/08/12-5.png" alt="12.- Creating a directory for new volume" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/12-5.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/12-5-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/12-5-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/12-5-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/12-5-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/12-5-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/12-5-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5472" class="wp-caption-text">12.- Creating a directory for new volume</figcaption></figure>
<p>We now proceed to create the volume by indicating that you will use two mirrors in this case:</p>
<pre class="">:~# gluster volume create glusterfsvolumne replica 2 gluster1.osradar.local:/data/glusterfs/glustervolume gluster2.osradar.local:/data/glusterfs/glustervolume</pre>
<figure id="attachment_5473" aria-describedby="caption-attachment-5473" style="width: 690px" class="wp-caption alignnone"><img loading="lazy" class=" wp-image-5473" src="https://www.osradar.com/wp-content/uploads/2018/08/13-3.png" alt="13.- Creating gluster volume" width="690" height="358" srcset="https://www.osradar.com/wp-content/uploads/2018/08/13-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/13-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/13-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/13-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/13-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/13-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/13-3-809x420.png 809w" sizes="(max-width: 690px) 100vw, 690px" /><figcaption id="caption-attachment-5473" class="wp-caption-text">13.- Creating gluster volume</figcaption></figure>
<p>We start the volume:</p>
<pre class="">:~# gluster volume start glusterfsvolumne</pre>
<figure id="attachment_5474" aria-describedby="caption-attachment-5474" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5474" src="https://www.osradar.com/wp-content/uploads/2018/08/14-2.png" alt="14.- Starting the volume" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/14-2.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/14-2-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/14-2-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/14-2-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/14-2-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/14-2-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/14-2-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5474" class="wp-caption-text">14.- Starting the volume</figcaption></figure>
<p>The installation and configuration of glusterfs on a server is now complete. We proceed to install the client on another machine.</p>
<h3>GlusterFS client</h3>
<p>Now it is the customer&#8217;s turn to use another CentOS 7 device with an IP address of 192.168.1.7. The other features of the device do not influence the use of the device.</p>
<p>We proceed to install the glusterfs-client package:</p>
<pre class="">:~# yum install glusterfs-client</pre>
<p>Once the installation is finished, we will create a folder to mount the volume.</p>
<pre class="">:~# mkdir -p /mnt/glusterfsvolumne</pre>
<p>we set up the firewall:</p>
<pre class="">:~# firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.1.7" accept'
:~# ffirewall-cmd --reload</pre>
<p>And we mount the previously created glusterFs volume.</p>
<pre class="">:~# mount -t glusterfs gluster1.osradar.local:/glusterfsvolumne /mnt/glusterfsvolumne</pre>
<figure id="attachment_5475" aria-describedby="caption-attachment-5475" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5475" src="https://www.osradar.com/wp-content/uploads/2018/08/15-1.png" alt="15.- Mounting gluster volume on client node" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/15-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/15-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/15-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/15-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/15-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/15-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/15-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5475" class="wp-caption-text">15.- Mounting gluster volume on client node</figcaption></figure>
<p>We checked the mounting:</p>
<pre class="">df -hP /mnt/glusterfsvolumne/</pre>
<figure id="attachment_5476" aria-describedby="caption-attachment-5476" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5476" src="https://www.osradar.com/wp-content/uploads/2018/08/16-1.png" alt="16.- checking the mounting" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/16-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/16-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/16-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/16-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/16-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/16-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/16-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5476" class="wp-caption-text">16.- checking the mounting</figcaption></figure>
<p>we add the entry in fstab so that it is automatically mounted:</p>
<pre class="">:~# echo "gluster1.osradar.local:/glusterfsvolumne /mnt/glusterfsvolumne/ glusterfs  defaults,_netdev 0 0" | tee --append /etc/fstab</pre>
<figure id="attachment_5477" aria-describedby="caption-attachment-5477" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5477" src="https://www.osradar.com/wp-content/uploads/2018/08/17-1.png" alt="17.- editing fstab" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/17-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/17-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/17-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/17-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/17-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/17-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/17-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5477" class="wp-caption-text">17.- editing fstab</figcaption></figure>
<h3>Testing the replication</h3>
<p>First of all, in the server nodes, we execute the following commands:</p>
<p>On the first node (gluster1.osradar.local):</p>
<pre class="">:~# mount -t glusterfs gluster2.osradar.local:/glusterfsvolumne /mnt</pre>
<p>On second node (gluster2.osradar.local):</p>
<pre class="">:~# mount -t glusterfs gluster1.osradar.local:/glusterfsvolumne /mnt</pre>
<figure id="attachment_5478" aria-describedby="caption-attachment-5478" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5478" src="https://www.osradar.com/wp-content/uploads/2018/08/18-1.png" alt="18.- Mounting the volumes" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/18-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/18-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/18-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/18-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/18-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/18-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/18-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5478" class="wp-caption-text">18.- Mounting the volumes</figcaption></figure>
<p>On client machine:</p>
<p>First we create the files, and verify</p>
<pre class="">:~# touch /mnt/glusterfsvolumne/filetest{1..4}
:~# ls /mnt/glusterfsvolumne</pre>
<figure id="attachment_5479" aria-describedby="caption-attachment-5479" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5479" src="https://www.osradar.com/wp-content/uploads/2018/08/19-1.png" alt="19.- Creating example files" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/19-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/19-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/19-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/19-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/19-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/19-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/19-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5479" class="wp-caption-text">19.- Creating example files</figcaption></figure>
<p>Now from node 1 we show the files created from the client.</p>
<pre class="">:~# ls -l /mnt/</pre>
<figure id="attachment_5480" aria-describedby="caption-attachment-5480" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5480" src="https://www.osradar.com/wp-content/uploads/2018/08/20-1.png" alt="20.- Testing the replication" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/20-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/20-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/20-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/20-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/20-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/20-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/20-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5480" class="wp-caption-text">20.- Testing the replication</figcaption></figure>
<p>That concludes the article and I hope it has served you well. Remember that for everything to work, you have to be careful with the firewall and define its rules correctly.</p>
<p>Please share this article through your social networks-</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-and-configure-glusterfs-on-centos-7/">How to install and configure GlusterFS on CentOS 7?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-and-configure-glusterfs-on-centos-7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Installing and configuring a DRBD cluster in CentOS 7</title>
		<link>https://www.osradar.com/installing-and-configuring-a-drbd-cluster-in-centos-7/</link>
					<comments>https://www.osradar.com/installing-and-configuring-a-drbd-cluster-in-centos-7/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Tue, 14 Aug 2018 04:13:51 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[DRDB]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=5297</guid>

					<description><![CDATA[<p>The backup of information is vital within a computer network, which is why fast, efficient and scalable solutions are required to meet this objective. DRBD is a software that allows you to replicate the data of a partition between several machines. which is excellent for always having a backup of the information. Installing DRBD 1.-Installing DRBD [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/installing-and-configuring-a-drbd-cluster-in-centos-7/">Installing and configuring a DRBD cluster in CentOS 7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The backup of information is vital within a computer network, which is why fast, efficient and scalable solutions are required to meet this objective.</p>
<p><strong>DRBD</strong> is a software that allows you to replicate the data of a partition between several machines. which is excellent for always having a backup of the information.</p>
<h2>Installing DRBD</h2>
<h3>1.-Installing DRBD packages on both server</h3>
<p>The first thing to do is to install DRDB on both nodes. To do this it is necessary to enable an external repository called ELRepo where we will download the necessary packages. We need to be root user, so open a terminal and type sudo -i, enter your password and we&#8217;ll have admin permissions.</p>
<pre class="">:~# sudo -i</pre>
<figure id="attachment_5298" aria-describedby="caption-attachment-5298" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5298" src="https://www.osradar.com/wp-content/uploads/2018/08/1-3.png" alt="1.- Getting root access" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/1-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/1-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/1-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/1-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/1-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/1-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/1-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5298" class="wp-caption-text">1.- Getting root access</figcaption></figure>
<p>Now we proceed to enable the repository:</p>
<pre class="">:~# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org</pre>
<figure id="attachment_5299" aria-describedby="caption-attachment-5299" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5299" src="https://www.osradar.com/wp-content/uploads/2018/08/2-4.png" alt="2.- Downloading repo package" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/2-4.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/2-4-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/2-4-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/2-4-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/2-4-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/2-4-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/2-4-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5299" class="wp-caption-text">2.- Downloading repo package</figcaption></figure>
<p>We install it:</p>
<pre class="">:~# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm</pre>
<figure id="attachment_5300" aria-describedby="caption-attachment-5300" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5300" src="https://www.osradar.com/wp-content/uploads/2018/08/3-4.png" alt="3.- Enabling additional repo" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/3-4.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/3-4-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/3-4-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/3-4-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/3-4-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/3-4-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/3-4-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5300" class="wp-caption-text">3.- Enabling additional repo</figcaption></figure>
<p>With the repository added, we can now install the DRBD packages.</p>
<pre class="">:~# yum install drbd90-utils kmod-drbd90</pre>
<figure id="attachment_5301" aria-describedby="caption-attachment-5301" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5301" src="https://www.osradar.com/wp-content/uploads/2018/08/4-3.png" alt="4.- Installing drbd packages" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/4-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/4-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/4-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/4-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/4-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/4-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/4-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5301" class="wp-caption-text">4.- Installing drbd packages</figcaption></figure>
<p>After the installation of the packages is finished, make sure that the drbd module is loaded to the kernel. We do it with the following command:</p>
<pre class="">:~# lsmod | grep -i drbd</pre>
<figure id="attachment_5302" aria-describedby="caption-attachment-5302" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5302" src="https://www.osradar.com/wp-content/uploads/2018/08/5-3.png" alt="5.- Checking the drbd installation" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/5-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/5-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/5-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/5-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/5-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/5-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/5-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5302" class="wp-caption-text">5.- Checking the drbd installation</figcaption></figure>
<p>In this case, we notice that it was not loaded, to solve this, we execute these two commands.</p>
<pre class="">:~# echo drbd &gt; /etc/modules-load.d/drbd.conf
:~# modprobe drbd</pre>
<figure id="attachment_5303" aria-describedby="caption-attachment-5303" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5303" src="https://www.osradar.com/wp-content/uploads/2018/08/6-3.png" alt="6.- enabling DRBD module " width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/6-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/6-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/6-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/6-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/6-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/6-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/6-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5303" class="wp-caption-text">6.- enabling DRBD module</figcaption></figure>
<p>The first one makes the module load at the beginning of the system and the second one enables it for the active session. We proceed to check again and we&#8217;ll get:</p>
<figure id="attachment_5304" aria-describedby="caption-attachment-5304" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5304" src="https://www.osradar.com/wp-content/uploads/2018/08/7-3.png" alt="7.- Module added" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/7-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/7-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/7-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/7-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/7-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/7-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/7-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5304" class="wp-caption-text">7.- Module added</figcaption></figure>
<h3>2.- Configure DRBD</h3>
<p>Once the packages are installed correctly, we must modify their configuration. First we&#8217;ll back up the original file. We will do this on both nodes:</p>
<pre class="">:~# mv /etc/drbd.d/global_common.conf /etc/drbd.d/global_common.conf.bak</pre>
<figure id="attachment_5305" aria-describedby="caption-attachment-5305" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5305" src="https://www.osradar.com/wp-content/uploads/2018/08/8-2.png" alt="8.- making a backup of config file" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/8-2.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/8-2-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/8-2-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/8-2-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/8-2-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/8-2-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/8-2-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5305" class="wp-caption-text">8.- making a backup of config file</figcaption></figure>
<p>Once the initial configuration file is backed up, we will create a new one:</p>
<pre class="">:~# nano /etc/drbd.d/global_common.conf</pre>
<p>And we&#8217;ll put the following in it:</p>
<pre class="">global {
 usage-count no;
}
common {
 net {
  protocol C;
 }
}</pre>
<figure id="attachment_5306" aria-describedby="caption-attachment-5306" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5306" src="https://www.osradar.com/wp-content/uploads/2018/08/9-4.png" alt="9.- Making a new conf file" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/9-4.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/9-4-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/9-4-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/9-4-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/9-4-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/9-4-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/9-4-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5306" class="wp-caption-text">9.- Making a new conf file</figcaption></figure>
<p>Next we will create a new file for the new resource that will be drbd1 in this case. The file will be called drbd1.res.</p>
<pre class="">:~# nano /etc/drbd.d/drbd1.res</pre>
<p>We will add the following:</p>
<pre class="">resource drbd1 {
        disk /dev/sdb;
        device /dev/drbd1;
        meta-disk internal;
        on osradar {
                address 192.168.1.9:7789;
        }
	on osradar2 {
                address 192.168.1.12:7789;
        }
}</pre>
<p>We briefly explain: disk refers to the hard disk to be replicated, device to the partition inside the disk, in the <em>on</em> segment comes the hostname of the computers; address to the ip address of the node and 7789 is the port where they will communicate.</p>
<figure id="attachment_5308" aria-describedby="caption-attachment-5308" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5308" src="https://www.osradar.com/wp-content/uploads/2018/08/10-3.png" alt="10.- editing config file for the new resource" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/10-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/10-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/10-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/10-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/10-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/10-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/10-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5308" class="wp-caption-text">10.- editing config file for the new resource</figcaption></figure>
<p>The next step is to initialize and create the resource at each of the nodes.</p>
<pre class="">:~# drbdadm create-md drbd1</pre>
<figure id="attachment_5309" aria-describedby="caption-attachment-5309" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5309" src="https://www.osradar.com/wp-content/uploads/2018/08/11-2.png" alt="11.- Creating new resource" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/11-2.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/11-2-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/11-2-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/11-2-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/11-2-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/11-2-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/11-2-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5309" class="wp-caption-text">11.- Creating new resource</figcaption></figure>
<p>Later we enable the drbd daemon on both nodes:</p>
<pre class="">:~# systemctl start drbd
:~# systemctl enable drbd</pre>
<p>Now let&#8217;s define who the primary node will be, in our case it will be in &#8220;osradar&#8221;, that is, the first node.</p>
<pre class="">:~# drbdadm down drbd1
:~# drbdadm up drbd1
</pre>
<figure id="attachment_5310" aria-describedby="caption-attachment-5310" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5310" src="https://www.osradar.com/wp-content/uploads/2018/08/12-3.png" alt="12.- Setup primary node" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/12-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/12-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/12-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/12-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/12-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/12-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/12-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5310" class="wp-caption-text">12.- Setup primary node</figcaption></figure>
<p>On the second node:</p>
<pre class="">:~# drbdadm down drbd1
:~# drbdadm up drbd1</pre>
<p>In case an error occurs setting the primary node, you can use this command:</p>
<pre class="">:~# drbdadm primary drbd1 --force</pre>
<p>Next we must configure the firewall to accept connections through the drbd port.</p>
<pre class="">:~# firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.12" port port="7789" protocol="tcp" accept</pre>
<p>Remember to modify the address in each node: if you are in node1 then in the command you must put the ip of node2.</p>
<figure id="attachment_5343" aria-describedby="caption-attachment-5343" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5343" src="https://www.osradar.com/wp-content/uploads/2018/08/13-1.png" alt="13.- Applying firewall rules" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/13-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/13-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/13-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/13-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/13-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/13-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/13-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5343" class="wp-caption-text">13.- Applying firewall rules</figcaption></figure>
<p>and reboot the firewall:</p>
<pre class="">:~# firewall-cmd --reload</pre>
<figure id="attachment_5344" aria-describedby="caption-attachment-5344" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5344" src="https://www.osradar.com/wp-content/uploads/2018/08/14-1.png" alt="14.- Firewall reload" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/08/14-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/08/14-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/08/14-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/08/14-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/08/14-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/08/14-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/08/14-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5344" class="wp-caption-text">14.- Firewall reload</figcaption></figure>
<p>We&#8217;ll have a DRBD cluster up and running, and we&#8217;ll be able to make changes to the first node&#8217;s partition and replicate from the network to the second one.</p>
<p>Please share this article through your social networks.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/installing-and-configuring-a-drbd-cluster-in-centos-7/">Installing and configuring a DRBD cluster in CentOS 7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/installing-and-configuring-a-drbd-cluster-in-centos-7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to create a cluster with MariaDB Galera on Ubuntu 18.04?</title>
		<link>https://www.osradar.com/how-to-create-a-cluster-with-mariadb-galera-on-ubuntu-18-04/</link>
					<comments>https://www.osradar.com/how-to-create-a-cluster-with-mariadb-galera-on-ubuntu-18-04/#comments</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Tue, 10 Jul 2018 09:26:50 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mariadb]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=4577</guid>

					<description><![CDATA[<p>The data that makes sense of the information must be safeguarded by system administrators around the world. Information management cannot be conceived without high technology that can lead to effective plans to achieve this goal. One of the technologies available to perform this task is clustering. In short, cluster is a group of multiple computers [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-create-a-cluster-with-mariadb-galera-on-ubuntu-18-04/">How to create a cluster with MariaDB Galera on Ubuntu 18.04?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The data that makes sense of the information must be safeguarded by system administrators around the world. Information management cannot be conceived without high technology that can lead to effective plans to achieve this goal.</p>
<p>One of the technologies available to perform this task is <strong>clustering</strong>. In short, cluster is a group of multiple computers linked by a high-speed network, so that the whole is seen as a single computer, more powerful than common desktop computers.</p>
<p>The advantages of having servers in clusters are many and range from processing speed to database scalability, allowing database replication.</p>
<p>MariaDB has within its products a software that allows us to do this in an efficient way on Ubuntu 18.04 and that utility is called MariaDB Galera Cluster. In this tutorial we will learn how to make one with two nodes.</p>
<h2>Information about the nodes</h2>
<p>For this article we will make a cluster with two nodes with the following data:</p>
<ul>
<li>OS: Ubuntu Server 18.04</li>
<li>Hostnames: osradar1, osradar2</li>
<li>IP address: 192.168.250.6, 192.168.250.7</li>
<li>RAM Memory: 512mb both</li>
<li>Hard Drive: 20gb</li>
</ul>
<p>It is vital to handle this information before we start our work because we will have to handle it well later on.</p>
<h2>Installing MariaDB Galera Cluster</h2>
<p>As the official <a href="https://mariadb.com/kb/en/library/getting-started-with-mariadb-galera-cluster/">documentation tells us</a>, from version 10.1 the utility is self-contained, inside the mariadb-server package. Therefore we proceed to install it:</p>
<p><strong>              sudo -i</strong></p>
<figure id="attachment_4578" aria-describedby="caption-attachment-4578" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4578" src="https://www.osradar.com/wp-content/uploads/2018/07/1.png" alt="1.- Root user" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4578" class="wp-caption-text">1.- Root user</figcaption></figure>
<p>When you enter the password, you will be a root user.</p>
<p>Now, we proceed to install the mariadb server and mariadb galera cluster.</p>
<p><strong>             apt install mariadb-server mariadb-client</strong></p>
<figure id="attachment_4580" aria-describedby="caption-attachment-4580" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4580" src="https://www.osradar.com/wp-content/uploads/2018/07/2.png" alt="2.- Installing mariadbserver and mariadb galera cluster" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/2.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/2-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/2-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/2-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/2-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/2-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/2-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4580" class="wp-caption-text">2.- Installing mariadbserver and mariadb galera cluster</figcaption></figure>
<p>Then we proceed to install rsync which is a necessary utility for the cluster to work.</p>
<p><strong>             apt install rsync</strong></p>
<figure id="attachment_4581" aria-describedby="caption-attachment-4581" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4581" src="https://www.osradar.com/wp-content/uploads/2018/07/3.png" alt="3.- Installing rsync" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4581" class="wp-caption-text">3.- Installing rsync</figcaption></figure>
<p>Note: these commands must be executed on each of the nodes</p>
<h3><strong>Configuring MariaDB cluster</strong></h3>
<p>In order for the cluster to achieve communication between the nodes, a common configuration file must be created in each of them. We create it with the following command:</p>
<p><strong>              nano /etc/mysql/conf.d/cluster.cnf</strong></p>
<p>And we put the following information in:</p>
<p><strong>[mysqld]</strong><br />
<strong>query_cache_size=0</strong><br />
<strong>binlog_format=ROW</strong><br />
<strong>default-storage-engine=innodb</strong><br />
<strong>innodb_autoinc_lock_mode=2</strong><br />
<strong>query_cache_type=0</strong><br />
<strong>bind-address=0.0.0.0</strong></p>
<p><strong>#Galera Provider Configuration</strong><br />
<strong>wsrep_on=ON</strong><br />
<strong>wsrep_provider=/usr/lib/galera/libgalera_smm.so</strong><br />
<strong>#wsrep_provider_options=&#8221;gcache.size=32G&#8221;</strong></p>
<p><strong>#Galera Cluster Configuration</strong><br />
<strong>wsrep_cluster_name=&#8221;test_cluster&#8221;</strong><br />
<strong>wsrep_cluster_address=&#8221;gcomm://first_ip,second_ip,third_ip&#8221;</strong></p>
<p><strong>#Galera Synchronization Congifuration</strong><br />
<strong>wsrep_sst_method=rsync</strong><br />
<strong>#wsrep_sst_auth=user:pass</strong></p>
<p><strong>#Galera Node Configuration</strong><br />
<strong>wsrep_node_address=&#8221;this_node_ip&#8221;</strong><br />
<strong>wsrep_node_name=&#8221;this_node_name&#8221;</strong></p>
<p>Now we have to modify some parameters to adapt them to our tutorial. First the line:</p>
<p><strong>           wsrep_cluster_address=&#8221;gcomm://first_ip,second_ip,third_ip&#8221;</strong></p>
<p>We must add the ip addresses of our nodes, so that&#8217;s how it looks:</p>
<p><strong>           wsrep_cluster_address=&#8221;gcomm://192.168.250.6,192.168.250.7&#8243;</strong></p>
<p>And in the segment: #Galera Node Configuration, we add our parameters</p>
<p><strong>          wsrep_node_address=&#8221;192.168.250.6&#8243;</strong><br />
<strong>           wsrep_node_name=&#8221;osradar1&#8243;</strong></p>
<figure id="attachment_4583" aria-describedby="caption-attachment-4583" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4583" src="https://www.osradar.com/wp-content/uploads/2018/07/5.png" alt="5.- configuration file" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/5.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/5-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/5-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/5-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/5-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/5-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/5-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4583" class="wp-caption-text">5.- configuration file</figcaption></figure>
<p>I remind you that this same file must be created in each of the nodes, modifying the ip address and computer name parameters.</p>
<p>Once this process is done, we must run the mysql_secure_installation script to define root password and other things:</p>
<p><strong>               mysql_secure_installation</strong></p>
<p>We define the root password and answer the questions: Y,N,Y,Y.</p>
<figure id="attachment_4584" aria-describedby="caption-attachment-4584" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4584" src="https://www.osradar.com/wp-content/uploads/2018/07/6.png" alt="6.- mysql_secure_installation" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/6.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/6-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/6-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/6-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/6-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/6-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/6-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4584" class="wp-caption-text">6.- mysql_secure_installation</figcaption></figure>
<figure id="attachment_4585" aria-describedby="caption-attachment-4585" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4585" src="https://www.osradar.com/wp-content/uploads/2018/07/7.png" alt="7.- mysql_secure_installation" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/7.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/7-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/7-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/7-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/7-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/7-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/7-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4585" class="wp-caption-text">7.- mysql_secure_installation</figcaption></figure>
<p>For the cluster to work we must add rules in the firewall allowing access through certain ports.</p>
<p><strong>            ufw enable</strong><br />
<strong>            ufw allow 3306/tcp</strong><br />
<strong>            ufw allow 4444/tcp</strong><br />
<strong>            ufw allow 4567/tcp</strong><br />
<strong>            ufw allow 4568/tcp</strong><br />
<strong>            ufw allow 4567/udp</strong></p>
<p>&nbsp;</p>
<h3><strong>Configuring Node 2</strong></h3>
<p>Previously we must run the mysql_secure_installation script to configure mariadb on this node:</p>
<p><strong>               mysql_secure_installation</strong></p>
<p>We respond in the same way as in the first node.</p>
<p>As mentioned above, we must create the same configuration file but modifying the IP and hostname criteria.</p>
<p><strong>                nano /etc/mysql/conf.d/cluster.cnf</strong></p>
<figure id="attachment_4600" aria-describedby="caption-attachment-4600" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4600" src="https://www.osradar.com/wp-content/uploads/2018/07/44.png" alt="cluster cnf" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/44.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/44-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/44-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/44-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/44-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/44-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/44-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4600" class="wp-caption-text">8.-cluster cnf</figcaption></figure>
<p>And we also opened the firewall ports:</p>
<p><strong>            ufw enable</strong><br />
<strong>            ufw allow 3306/tcp</strong><br />
<strong>            ufw allow 4444/tcp</strong><br />
<strong>            ufw allow 4567/tcp</strong><br />
<strong>            ufw allow 4568/tcp</strong><br />
<strong>            ufw allow 4567/udp</strong></p>
<figure id="attachment_4601" aria-describedby="caption-attachment-4601" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4601" src="https://www.osradar.com/wp-content/uploads/2018/07/45.png" alt="opening ports" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/45.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/45-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/45-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/45-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/45-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/45-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/45-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4601" class="wp-caption-text">9.-opening ports</figcaption></figure>
<p>&nbsp;</p>
<p>As ubuntu is a Debian derivative, we have to copy a configuration file to all nodes. It is important to note that only the file of the first node is useful and should not be modified in the rest of the nodes. That&#8217;s why the other nodes must have their own file but must be changed so that it is the same as the first one.</p>
<p>The file is located in /etc/mysql/debian.cfg</p>
<h2><strong>Initializing the cluster</strong></h2>
<p>Before initializing the cluster we must stop the Mariadb service on all nodes:</p>
<p><strong>             sudo systemctl stop mysql</strong></p>
<figure id="attachment_4602" aria-describedby="caption-attachment-4602" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4602" src="https://www.osradar.com/wp-content/uploads/2018/07/46.png" alt="46.- Stoping the service" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/46.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/46-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/46-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/46-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/46-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/46-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/46-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4602" class="wp-caption-text">10.- Stoping the service</figcaption></figure>
<p>Now we must initialize the cluster in the first node, to do this:</p>
<p><strong>                galera_new_cluster</strong></p>
<figure id="attachment_4603" aria-describedby="caption-attachment-4603" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4603" src="https://www.osradar.com/wp-content/uploads/2018/07/47.png" alt="47.- galera Cluster" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/47.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/47-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/47-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/47-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/47-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/47-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/47-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4603" class="wp-caption-text">11.- galera Cluster</figcaption></figure>
<p>With this, you should now start the cluster and the added node 1. To check, we proceed to write:</p>
<p><strong>               mysql -u root -p -e &#8220;SHOW STATUS LIKE &#8216;wsrep_cluster_size'&#8221;</strong></p>
<p>When entering the password, we should see something like this:</p>
<p>&nbsp;</p>
<figure id="attachment_4604" aria-describedby="caption-attachment-4604" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4604" src="https://www.osradar.com/wp-content/uploads/2018/07/48.png" alt="Showing size of cluster" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/48.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/48-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/48-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/48-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/48-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/48-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/48-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4604" class="wp-caption-text">12.-Showing size of cluster</figcaption></figure>
<p>Now we must go to the second node, and initialize the mariadb service.</p>
<p><strong>              systemctl start mysql</strong></p>
<p>And we return to the first node to verify that the second node has joined the cluster:</p>
<p><strong>mysql -u root -p -e &#8220;SHOW STATUS LIKE &#8216;wsrep_cluster_size'&#8221;</strong></p>
<figure id="attachment_4605" aria-describedby="caption-attachment-4605" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4605" src="https://www.osradar.com/wp-content/uploads/2018/07/50.png" alt="Showing the second node added to cluster" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/50.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/50-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/50-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/50-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/50-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/50-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/50-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4605" class="wp-caption-text">13.-Showing the second node added to cluster</figcaption></figure>
<h2><strong>Testing the efficacy of the cluster</strong></h2>
<p>To prove that the cluster is working in practice is by demonstrating database replication. In the first node, we access mariadb console and create a database:</p>
<p><strong>                mysql -u root -p</strong></p>
<p>next:</p>
<p><strong>               CREATE DATABASE cluster;</strong></p>
<p>and</p>
<p><strong>              SHOW DATABASES;</strong></p>
<p>And in the second node, we show the databases with Show Databases:</p>
<figure id="attachment_4606" aria-describedby="caption-attachment-4606" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4606" src="https://www.osradar.com/wp-content/uploads/2018/07/51.png" alt="Testing the replication" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/51.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/51-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/51-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/51-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/51-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/51-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/51-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4606" class="wp-caption-text">14.-Testing the replication</figcaption></figure>
<p>This is a tool with great potential, it allows us many possibilities in the segment of database management.</p>
<p>Please share this article through your social networks.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-create-a-cluster-with-mariadb-galera-on-ubuntu-18-04/">How to create a cluster with MariaDB Galera on Ubuntu 18.04?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-create-a-cluster-with-mariadb-galera-on-ubuntu-18-04/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
