My SQL Galera Setup

Posted on Posted in Uncategorized

Reference :

root@ (Login to the Server using Root user)
1.configure the /etc/hosts db1 db2 db3

now put SELinux into permissive mode on all nodes
2. setenforce 0

3. configure the firewall
lokkit –port 3306:tcp
lokkit –port 4444:tcp
lokkit –port 4567:tcp
lokkit –port 4568:tcp rpm sofware from

5.Configure yam
6.configure createrepo (yum install createrepo) createrepo in the directory where rpm’s are kept
createrepo -v .
8.change in /etc/yum.repos.d/local.repo
[root@minbalx056v yum.repos.d]# cat local.repo
name=Red Hat Enterprise Linux

name = MariaDB
baseurl = file:///DB/software
for galrea cluster installation (run it on every node)

9.yum install –y MariaDB-Galera-server MariaDB-client galera
yum remove –y MariaDB-Galera-server MariaDB-client galera

yum remove MariaDB*server MariaDB-client galera

10.service mysql start (all nodes)
11.mysql_secure_installation –for securing database root password. on all nodes
12.login into database
mysql -u root -p

run below grant privilage to root

for cluster setup
change in below fines
before going to chnage the file,please stop the mysql DB
service mysql stop


mysql_install_db –user=mysql –ldata=/var/lib/mysql/

service mysql start –wsrep-cluster-address=gcomm://node2

mysql -u cluster_user -p

service mysql start –wsrep-new-cluster

mysql -u root -p -e”show status like ‘wsrep%'”


service mysql start –wsrep-cluster-address=gcomm://

wsrep_cluster_status | Disconnected



service mysql start –wsrep-new-cluster

mysql_install_db –user=mysql –ldata=/var/lib/mysql/

update user set password=PASSWORD(“bharti123”) where User=’root’;

How to Change default MySQL Data Directory in Linux

cp -rap /var/lib/mysql /DB/mysql

chown mysql.mysql /DB/mysql

cp -rap /DB/mysql /DB/datadir/mysql
cp -rap /var/lib/mysql /DB/datadir

chown root.root /DB/datadir
chown mysql.mysql /DB/datadir

mkdir -p /DB/datadir
cp -rap /DB/mysql /DB/datadir
cp -rap /DB/mysql /DB/datadir
#deprecated: log=/var/lib/mysql/mysqld.log

chown root.root /DB/logdir/
Change from rsync to xtrabackup – avoid read-only Donor during SST

Advantage of using xtrabackup

The main advantage of using xtrabackup to synchronize the nodes is that the Donor is writeable during the synchronization process.

Bug: the web interface will still show the Donor being “read-only” despite the wsrep_sst_method is set to xtrabackup.
Install xtrabackup

You need to install xtrabackup on all nodes in the cluster.

On each node you can run:

s9s_backup –install -i <clusterid>
#for example:
s9s_backup –install -i 1
#verify it is installed:
which innobackupex
#the above should print out the following if everything is okay:
# ubuntu/debian:
apt-get install nc
# redhat/centos:
yum install nc

s9s_backup requires internet access to Percona’s yum or apt repositories.

If you don’t have s9s_backup, you can download it here: and place it in
/usr/bin on each node.

Read more about s9s_backup here
On all nodes download and install (PXC users should not have to do this step):…

and place the wsrep_sst_xtrabackup in {mysql_basedir}/bin

Ubuntu/Debian (most likely location):




Then do:

chmod u+x /usr/bin/wsrep_sst_xtrabackup
chown mysql:mysql /usr/bin/wsrep_sst_xtrabackup
chmod u+x /usr/local/mysql/bin/wsrep_sst_xtrabackup
chown mysql:mysql /usr/local/mysql/bin/wsrep_sst_xtrabackup

Update Configuration – Subscription Customers

Go into Config Mgmt , and update each my.cnf file and set:


When saving, the configuration file will be exported to the node in question.

Now, the next time a node crashes and needs to do an SST the xtrabackup method will be used.
Update Configuration – Community

On all nodes edit the my.cnf file and set:


Now, the next time a node crashes and needs to do an SST the xtrabackup method will be used.

mail -s “This is the subject”
Hi someone

yum -y groupinstall “prod tools”

./configure –prefix=/DB/monit –without-pam


make install

mkdir /etc/monit.d/

service mysql bootstrap


./configure –prefix=/usr –without-pam
./configure –prefix=/DB/monit –without-pam

ps -aufx | grep mysql

MySQL server PID file could not be found! [FAILED]
Starting MySQL.. [ OK ]

For DR setup below needs to change on master
server_id=2 # 1 for master1, 2 for master2, 3 for master3
For DR setup below needs to change on slave
server_id=101 # 101 for slave?

system upgrade from
MariaDB [(none)]> show databases;
MariaDB [(none)]> SHOW GLOBAL STATUS LIKE ‘wsrep_provider_version’;
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE ‘version’;
MariaDB [(none)]> SHOW GLOBAL STATUS LIKE ‘wsrep_provider_version’;

GRANT REPLICATION SLAVE on *.* to ‘slave_user’@’%’ IDENTIFIED BY ‘bharti123′;




SET GLOBAL gtid_mode = ON;
SET GLOBAL enforce_gtid_consistency = ON;


backup configurtion:-
important steps to do every node

1.find /var/lib/mysql -type d -exec chmod 770 “{}” \;
2.yum install libev-4.15
3.yum install libev-4.15-1.el6.rf.x86_64.rpm
4.yum remove perl-DBD-MySQL
5.yum install perl-DBD-MySQL

6.rpm -ivh percona-xtrabackup-2.3.4-1.el6.x86_64.rpm
7.rpm -ivh percona-xtrabackup-debuginfo-2.3.4-1.el6.x86_64.rpm
8.rpm -ivh percona-xtrabackup-test-2.3.4-1.el6.x86_64.rpm

xtrabackup –backup –datadir=/DB/datadir/mysql/ –target-dir=/DB/db_backup > /DB/db_backup/backup.log
innobackupex –user=root –password=bharti123 /db_backup/db_backup

innobackupex –defaults-file=/etc/my.cnf.d/server.cnf /db_backup/db_backup
innobackupex /db_backup/db_backup

increamenteal backup:-

1.innobackupex –/db_backup/db_backup
2.innobackupex –incremental /db_backup/db_backup –incremental-basedir=/db_backup/db_backup/2016-04-19_18-00-51
3.innobackupex –incremental /db_backup/db_backup –incremental-basedir=/db_backup/db_backup/2016-04-19_18-03-58

1.innobackupex –apply-log –redo-only /db_backup/db_backup/2016-04-19_13-44-13

2. Incremental Preparation
innobackupex –apply-log –redo-only /db_backup/db_backup/2016-04-19_13-44-13 –incremental-dir=/db_backup/db_backup/2016-04-19_13-45

3. Incremental Preparation
innobackupex –apply-log –redo-only /db_backup/db_backup/2016-04-19_13-44-13 –incremental-dir=/db_backup/db_backup/2016-04-19_13-50

innobackupex –copy-back

innobackupex –apply-log –defaults-file=/tmp/mysql_bak/my.cnf –ibbackup=xtrabackup_innodb55 /tmp/mysql_bak/2012-07-26_13-53-43/

innobackupex –apply-log –defaults-file=/etc/my.cnf.d/server.cnf –ibbackup=xtrabackup_innodb55 /db_backup/db_backup/2016-04-13_15-

innobackupex –apply-log –ibbackup=xtrabackup_innodb55 /db_backup/db_backup/2016-04-13_15-39-19/

innobackupex –apply-log –ibbackup=xtrabackup_innodb55 /db_backup/db_backup/2016-04-13_17-14-30/

innobackupex –copy-back –ibbackup=xtrabackup_innodb55 /db_backup/db_backup/2016-04-13_15-39-19/

restore scnerio:-
1.Restore from taken backup:-

I.copy back the files–when dropping the database
a. service mysql stop
b.delete or move the datadir files (example mv /DB/datadir/mysql /DB/datadir/mysql_old_3

c.innobackupex –copy-back –ibbackup=xtrabackup_innodb55 /db_backup/db_backup/2016-04-18_14-03-47/

d.change the owner of /DB/datadir/mysql (chown -R mysql:mysql mysql)

e.service mysql start –wsrep-new-cluster

f.mysql -u root -p

2.restoring the table ,when dropped

a.innobackupex –apply-log –ibbackup=xtrabackup_innodb55 /db_backup/db_backup/2016-04-13_16-37-35/

start in safe mode mysqld_safe –user=root

loading the data into mysql———
mysql> create database ClassicModels;
mysql> use ClassicModels;
mysql> source create_classicmodels.sql;

Load the table contents:

mysql> source load_classicmodels.sql;

Exit from mysql:

mysql> quit;



host = localhost

check if you can connect to required TCP ports manually
example :-nmap -sT -p 3306,4567

nmap -sT -p 3306,4567

311 thoughts on “My SQL Galera Setup

  1. [url=][img][/img][/url]


  2. I am absolutely blown away by the quality of the content on this blog. It’s clear that the author puts an incredible amount of effort into researching and writing each post, and the results are truly impressive. I particularly appreciate the author’s commitment to providing balanced and unbiased perspectives on a variety of topics. It’s refreshing to read content that doesn’t try to push a specific agenda or viewpoint. The author’s writing is both informative and engaging, and I always come away with new insights and knowledge. Overall, this blog is an exceptional resource for anyone interested in expanding their knowledge on a variety of subjects.

  3. I am sorting out relevant information about gate io recently, and I saw your article, and your creative ideas are of great help to me. However, I have doubts about some creative issues, can you answer them for me? I will continue to pay attention to your reply. Thanks.

  4. 7 Key Things to Know About Restoring Used and Antique Furniture (and Signs It Might Not Be Worth It) We’re growing because community banking has come full circle to be the full service answer to 21st Century banking. Over three decades and a growing net worth that is now in the billions, we have never compromised our vision of authentic local banking, even as we expanded into the South’s iconic cities, from Nashville to Memphis. Harford’s population in 1982 was 149,551. The latest census, from July 2021, put the population at 262,977. So that’s at least 113,000 more people living — and flushing toilets — on what had been farmland and forest, near tributaries of the Chesapeake Bay and the bay itself. Add to that all the commercial development that has taken place (shopping centers, office parks, manufacturing plants, self-storage facilities, gas stations and warehouses), and it’s no wonder that Harford countians have started to rebel.
    For example, donated furniture that is in good used condition or better should not be evaluated at some fixed rate such as 15% of the cost of new replacement furniture. When the furniture is contributed, it may be out of style or in poor condition, therefore having little or no market value. On the other hand, it may be a desirable antique, the value of which could not be determined by using any formula. If you have access to the Multiple Listing Service, you can easily pull up a list of comps. You’re looking for properties that have sold in the last three to six months – real estate markets move so quickly that older sale prices will be out of date. Pay attention to the address of your comparable properties. Location is a key element in real estate appraisal, due to factors like transportation and school quality, so you’re looking for properties in the same neighborhood and ideally within a couple of streets of the subject property.

  5. no prescription required pharmacy [url=]cheapest pharmacy for prescriptions without insurance[/url] best no prescription pharmacy

  6. At the beginning, I was still puzzled. Since I read your article, I have been very impressed. It has provided a lot of innovative ideas for my thesis related to Thank u. But I still have some doubts, can you help me? Thanks.

  7. amoxicillin 875 125 mg [url=]buy amoxicillin online uk[/url] where to get amoxicillin online without prescription

  8. At the beginning, I was still puzzled. Since I read your article, I have been very impressed. It has provided a lot of innovative ideas for my thesis related to Thank u. But I still have some doubts, can you help me? Thanks.

  9. At the beginning, I was still puzzled. Since I read your article, I have been very impressed. It has provided a lot of innovative ideas for my thesis related to Thank u. But I still have some doubts, can you help me? Thanks.

  10. It’s stressful enough taking care of small children. I choose to [url=]buy metformin online no prescription[/url] to eliminate extra stress.

  11. Although there’s plenty to do with the kids, Las Vegas is essentially an adult playground and many hotels won’t even allow you to book a room if you’re not at least 21. The minimum drinking age is as rigorously enforced as it is for gambling, if not more so. It’s common practice for people in their 30s to get carded. Don’t expect to get into bars or clubs without valid ID. RULES – Students Playing Strip Poker, Things Get Crazy! 12 min We know you’re no surgeon, but you’ll do a little operation! We’ll mix this kids’ game with some stripping! If you’re looking for the game, check it out on Amazon. Follow the rules as if you’re playing the game in normal mode. Since you’ve gotta remove something from the patient, without touching the sides, if you succeed, you’ve got the chance to make someone remove a piece of clothing, or put something yourself on. Otherwise, you may also fail. If you do touch the sides, you have to remove something. Whatever happens, please, do not kill the patient!
    Old-school land casino machines deserve their category due to physical design and complex cabinet manufacturing. We’ll focus on free slots launched without requiring an internet connection to play for fun. These slots can be an offline casino or videogame part, excluding Flash. All offline slots must be downloaded to your PC or mobile device first loaded in a browser or installed as an application. Reuters could not reach the women for comment, you can upload it. I’ve also waited more than 30 minutes in a line that snaked its way through a casino, hot roll slot machines international variants of the game show have been aired in around 160 countries worldwide. So, each stands in a class of its own because of slight rule variations. The simulation on the left is typical of games resulting in ruin and gives some insight into the mechanisms that cause ruin, the machines earn up to 80 percent of the club’s revenue. However, including unlike ten-value cards like J-Q. There are plenty of versions of these games as well, K-J.

  12. أكبر شركة لانتاج أنابيب البولي ايثيلين و يو بي سي ومستلزماتها للمنتجات الصناعية في عيراق

  13. بعد قراءة مقالك ، ذكرني ببعض الأشياء التي درستها من قبل حول البوابة الإلكترونية. المحتوى مشابه لمحتوياتك ، لكن تفكيرك خاص جدًا ، وهو ما أعطاني فكرة مختلفة. شكرًا لك..

  14. Very nice post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!

Leave a Reply

Your email address will not be published. Required fields are marked *

30 ÷ = 10