SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
Prepared By: Ram Gautam email to :ramgau@gmail.com
Contents
1. Introduction ....................................................................................................................................2
2. Scope...............................................................................................................................................2
3. Intendant audience..........................................................................................................................2
4. Point to be considered/Further research .........................................................................................2
5. High Level diagram ..........................................................................................................................3
6. Used tools .......................................................................................................................................4
7. Configuration and setup ..................................................................................................................4
7.1 Asynchronous Communication between Master/Slave ..................................................................4
7.2 Percona XtraDB Cluster Configurations: .........................................................................................4
7.3 Master/Slave configuration for Asynchronous DB replication.........................................................5
STEP 1: Make a backup on TheMaster and prepare it.......................................................................5
STEP 2: Copy backed up data to TheSlave ........................................................................................7
STEP 3: Configure The Master’s MySQL server .................................................................................7
STEP 4: Start the replication.............................................................................................................8
STEP 5: Check the Master/Slave status.............................................................................................8
8. References.......................................................................................................................................8
Prepared By: Ram Gautam email to :ramgau@gmail.com
1. Introduction
This document is giving high level configuration about Percona 5.7, 3 node cluster with Master/Slave
database Replication for Disaster Recovery (DR) between Production Data Center (DC) and Disaster
Recovery Data Center.
2. Scope
This document covers about to configure Master/Save Database (DB) replication in centos using Percona
technologies.
3. Intendant audience
All configuration and setup are being done on Centos 6, Linux platform. So Database Administrator or
System Administrator or Developer should have basic knowledge of Linux command, MySQL database,
and Master /slave information to follow this document.
4. Point to be considered/Further research
Before start doing DB replication configuration, there may be following points to be considered.
 Network stability between Production Datacenter and DR Datacenter
 MySQL version at both Production DB and DR DB
 DB replication strategy for MySQL storage ENGINE. Like InnoDB, MyISAM
 Running query by Application.
Prepared By: Ram Gautam email to :ramgau@gmail.com
5. High Level diagram
This high level digram is showing two Application sets. i.e Production Set at Production Dataceter and
DR Set at Disaster Recovery Datacenter. Based on DR platform configuration we need to create identical
sets of components between Production and DR platform. For this, web server/Application server, Load
Balancer for both App & DB, and DB Cluster are the identified components for platform setup. Running
application does not often change compare to DB. So we are focusing on DB synchronization between
Production and DR platform. We cannot put synchronous communication medium to synch DB due to
network latency, each transaction cycle in DB. Due to this, we need to use Asynchronous mechanism for
DB synch.
In above figure, Red highlighted rectangle is detonated as the Virtual Private Network (VPN) between
Production DC and DR DC. Perconca tools to make Asynchronous DB replication/Hot Backup between
Production DB cluster and DR DB cluster. There is used Master/Slave concept for db replication as
source and destination DB server. One of the node from Production 3 node cluster as Master and One of
the node from DR Node Cluster.
Prepared By: Ram Gautam email to :ramgau@gmail.com
6. Used tools
 Percona 5.7 cluster
 Innobackupex/ xtrabackup
 Yum
7. Configuration and setup
7.1 Asynchronous Communication between Master/Slave
Asynchronous Replication uses the approach of lazy replication. The master database asynchronously
propagates replica updates to other slave nodes. Percona comes with a tool that allows you to perform
Asynchronous DB replication/Hot Backup s of a running MySQL database, with no blocking. It’s able to
do this because of Innodb & multi-version concurrency control (MVCC). Luckily we don’t need to dig into
the guts to enjoy the benefits of this great technology.
7.2 Percona XtraDB Cluster Configurations:
Percona is an open source software company specializing in MySQL, MongoDB, and other open source
database support, consulting, managed services, and training.
Percona XtraDB Cluster is an active/active high availability and high scalability open source solution for
MySQL clustering. It integrates Percona Server and Percona XtraBackup with the Codership Galera
library of MySQL high availability solutions in a single package that enables you to create a cost-effective
MySQL high availability cluster.
We can found more information
https://www.percona.com/software/mysql-database/percona-xtradb-cluster
Installation Documentation: https://www.percona.com/downloads/Percona-XtraDB-Cluster-57/LATEST/
In other document already described about how to configure Percona cluster 5.7 cluster with High
Availability. This document consists about configuration about DB replication between two sets of db
cluster. Each Cluster consists 3 nodes because 3 nodes clusters is best practice for clustering. DB
replication configuration step starts once all Cluster successfully configuration at both Production DC and
DR DC. Then we will pick one node as Master form Production DC and one node as from DR DC
Prepared By: Ram Gautam email to :ramgau@gmail.com
7.3 Master/Slave configuration for Asynchronous DB replication
Based on High level diagram, configuration will be as follows:
- TheMaster ,Node at Production Cluster-Node3 (192.168.2.6)
- TheSlave ,Node at DR Cluster – Node 1 (192.168.3.4)
TheMaster, A system with a MySQL-based server installed, configured and running. This system will be
called TheMaster, as it is where your data is stored and the one to be replicated. We will assume the
following about this system:
 the MySQL server is able to communicate with others by the standard TCP/IP port;
 the SSH server is installed and configured;
 you have a user account in the system with the appropriate permissions;
 you have a MySQL’s user account with appropriate privileges.
 server has binlogs enabled and unique server-id set up.
TheSlave Another system, with a MySQL-based server installed on it. We will refer to this machine as
TheSlave and we will assume the same things we did about TheMaster, except that the server-id on
TheSlave .
Percona XtraBackup, The backup tool we will use. It should be installed in both computers for
convenience.
STEP 1: Make a backup on TheMaster and prepare it
Binary logs on PXC
Binary logs are not strictly needed in PXC for replication, but you may be using them for backups or for
asynchronous slaves of the cluster. To set them up properly, we need the following settings added to
our config . For this, following configuration needs to be added in TheMaster, my.cnf config file.
# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW
#For DB replication
server_id=19216826
#binlog_format=ROW
log_slave_updates=1
log_bin=binlog
Prepared By: Ram Gautam email to :ramgau@gmail.com
Sample TheMaster, My.cnf will be ,After adding Replication parameter
[mysqld]
datadir=/var/lib/mysql
user=mysql
#log-error=/var/log/mysqld.log
# Path to Galera library
wsrep_provider=/usr/lib64/libgalera_smm.so
# Cluster connection URL contains the IPs of node#1, node#2 and
node#3wsrep_cluster_address=gcomm://192.168.2.4,192.168.2.5,192.168.2.6
# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW
#For DB replication
server_id=19216826
#binlog_format=ROW
log_slave_updates=1
log_bin=binlog
#gtid_mode=ON
#enforce_gtid_consistency=1
# MyISAM storage engine has only experimental support
default_storage_engine=InnoDB
# This InnoDB autoincrement locking mode is a requirement for Galera
innodb_autoinc_lock_mode=2
# Node 1 address
wsrep_node_address=192.168.2.6
# SST method
wsrep_sst_method=xtrabackup-v2
# Cluster name
wsrep_cluster_name=test_5_7cluster_node
# Authentication for SST method
wsrep_sst_auth="sstuser:s3cret"
Prepared By: Ram Gautam email to :ramgau@gmail.com
TO get snapshot from Master DB:
TheMaster # innobackupex --host=127.0.0.1 --user=bkpuser --password=bkppassword --port=3306
/data/backups/new_backup/
After this is finished you should get :
innobackupex: completed OK!
This will make a copy of your MySQL data dir to the /data/backups/new_backup/$TIMESTAMP. You
have told Percona XtraBackup (through the innobackupex script) to connect to the database server
using your database user and password, and do a hot backup of all your data in it (all MyISAM, InnoDB
tables and indexes in them).
In order for snapshot to be consistent you need to prepare the data:
TheMaster # innobackupex --apply-log --host=127.0.0.1 --user=bkpuser --password=bkppassword
/data/backups/new_backup/$TIMESTAMP
STEP 2: Copy backed up data to TheSlave
 TheMaster # scp -r /data/backups/new_backup/$TIMESTAMP root@ TheSlave:/data/
 Stop mysql at slave after successfully copied file from Master
 At minimum you need to set the server_id to a unique value. The IP address with the
periods removed can make a good server_id. Like 19216834
 Update mysql data directory with just copied from Master.
TheSlave$ mv /path/to/mysql/datadir /path/to/mysql/datadir_bak
and move the snapshot from TheMaster in its place:
TheSlave$ mv /path/to/mysql/$TIMESTAMP /path/to/mysql/datadir
After you copy data over, make sure MySQL has proper permissions to access them.
TheSlave$ chown mysql:mysql /path/to/mysql/datadir
In case the ibdata and iblog files are located in different directories outside of the datadir,
you will have to put them in their proper place after the logs have been applied
STEP 3: Configure The Master’s MySQL server
Add the appropriate grant in order for slave to be able to connect to master:
TheMaster|mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'$slaveip' IDENTIFIED BY '$slavepass';
Also make sure that firewall rules are correct and that TheSlave can connect to TheMaster. Test that you
can run the mysql client on TheSlave, connect to TheMaster, and authenticate.
TheSlave$ mysql --host=TheMaster --user=repl --password=$slavepass
Verify the privileges.
mysql> SHOW GRANTS;
Prepared By: Ram Gautam email to :ramgau@gmail.com
STEP 4: Start the replication
 Start/restat MySQL on TheSlave
 Look at the content of the file xtrabackup_binlog_info, it will be something like:
TheSlave$ cat /var/lib/mysql/xtrabackup_binlog_info
TheMaster-bin.000001 481
 Execute the CHANGE MASTER statement on a MySQL console and use the username and
password you’ve set up in STEP 3:
TheSlave|mysql> CHANGE MASTER TO
MASTER_HOST='$masterip',
MASTER_USER='repl',
MASTER_PASSWORD='$slavepass',
MASTER_LOG_FILE='TheMaster-bin.000001',
MASTER_LOG_POS=481;
 and start the slave:
TheSlave|mysql> START SLAVE;
STEP 5: Check the Master/Slave status
You should check that everything went OK with:
TheSlave|mysql> SHOW SLAVE STATUS G
...
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
...
Seconds_Behind_Master: 13
...
8. References
https://www.percona.com/blog/2015/07/16/bypassing-sst-pxc-binary-logs/
https://www.percona.com/doc/percona-xtrabackup/2.1/howtos/setting_up_replication.html
https://www.handybackup.net/mysql-replication.shtml
http://www.iheavy.com/2012/04/17/easy-mysql-replication-with-hotbackups-2/

Mais conteúdo relacionado

Mais procurados

Security features In MySQL 8.0
Security features In MySQL 8.0Security features In MySQL 8.0
Security features In MySQL 8.0Mydbops
 
Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10Vasudeva Rao
 
Parallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQLParallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQLMydbops
 
Postgres plus cloud_database_getting_started_guide
Postgres plus cloud_database_getting_started_guidePostgres plus cloud_database_getting_started_guide
Postgres plus cloud_database_getting_started_guideice1oog
 
Percona XtraDB 集群文档
Percona XtraDB 集群文档Percona XtraDB 集群文档
Percona XtraDB 集群文档YUCHENG HU
 
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored ProceduresM|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored ProceduresMariaDB plc
 
How to Become Cloud Backup Provider
How to Become Cloud Backup ProviderHow to Become Cloud Backup Provider
How to Become Cloud Backup ProviderCloudian
 
How to become cloud backup provider
How to become cloud backup providerHow to become cloud backup provider
How to become cloud backup providerCLOUDIAN KK
 
Database Tools by Skype
Database Tools by SkypeDatabase Tools by Skype
Database Tools by Skypeelliando dias
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
 
My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage enginesVasudeva Rao
 
Inside HDFS Append
Inside HDFS AppendInside HDFS Append
Inside HDFS AppendYue Chen
 
MySQL High Availability Deep Dive
MySQL High Availability Deep DiveMySQL High Availability Deep Dive
MySQL High Availability Deep Divehastexo
 
Installing and configuring a dhcp on windows server 2016 step by step
Installing and configuring a dhcp on windows server 2016 step by stepInstalling and configuring a dhcp on windows server 2016 step by step
Installing and configuring a dhcp on windows server 2016 step by stepAhmed Abdelwahed
 
Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Sameer Kumar
 
Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3maclean liu
 
HBase 2.0 cluster topology
HBase 2.0 cluster topologyHBase 2.0 cluster topology
HBase 2.0 cluster topologyMikhail Antonov
 
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014Laurynas Biveinis
 
Mysql high availability and scalability
Mysql high availability and scalabilityMysql high availability and scalability
Mysql high availability and scalabilityyin gong
 
Percona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiPercona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiNilnandan Joshi
 

Mais procurados (20)

Security features In MySQL 8.0
Security features In MySQL 8.0Security features In MySQL 8.0
Security features In MySQL 8.0
 
Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10
 
Parallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQLParallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQL
 
Postgres plus cloud_database_getting_started_guide
Postgres plus cloud_database_getting_started_guidePostgres plus cloud_database_getting_started_guide
Postgres plus cloud_database_getting_started_guide
 
Percona XtraDB 集群文档
Percona XtraDB 集群文档Percona XtraDB 集群文档
Percona XtraDB 集群文档
 
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored ProceduresM|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
 
How to Become Cloud Backup Provider
How to Become Cloud Backup ProviderHow to Become Cloud Backup Provider
How to Become Cloud Backup Provider
 
How to become cloud backup provider
How to become cloud backup providerHow to become cloud backup provider
How to become cloud backup provider
 
Database Tools by Skype
Database Tools by SkypeDatabase Tools by Skype
Database Tools by Skype
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage engines
 
Inside HDFS Append
Inside HDFS AppendInside HDFS Append
Inside HDFS Append
 
MySQL High Availability Deep Dive
MySQL High Availability Deep DiveMySQL High Availability Deep Dive
MySQL High Availability Deep Dive
 
Installing and configuring a dhcp on windows server 2016 step by step
Installing and configuring a dhcp on windows server 2016 step by stepInstalling and configuring a dhcp on windows server 2016 step by step
Installing and configuring a dhcp on windows server 2016 step by step
 
Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3
 
Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3
 
HBase 2.0 cluster topology
HBase 2.0 cluster topologyHBase 2.0 cluster topology
HBase 2.0 cluster topology
 
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
 
Mysql high availability and scalability
Mysql high availability and scalabilityMysql high availability and scalability
Mysql high availability and scalability
 
Percona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiPercona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ Mumbai
 

Destaque

Percona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityPercona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityRam Gautam
 
Master and slave relationship in Robinson Crusoe
Master and slave relationship in Robinson CrusoeMaster and slave relationship in Robinson Crusoe
Master and slave relationship in Robinson CrusoeDharaba Gohil
 
Industrial communication 2016 English
Industrial communication 2016 EnglishIndustrial communication 2016 English
Industrial communication 2016 Englishifm electronic gmbh
 
Distributed computing
Distributed computingDistributed computing
Distributed computingKeshab Nath
 
Industrial Networking - Profibus
Industrial Networking - ProfibusIndustrial Networking - Profibus
Industrial Networking - ProfibusYogesh Kumar
 

Destaque (6)

Percona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityPercona Cluster Installation with High Availability
Percona Cluster Installation with High Availability
 
Master and slave relationship in Robinson Crusoe
Master and slave relationship in Robinson CrusoeMaster and slave relationship in Robinson Crusoe
Master and slave relationship in Robinson Crusoe
 
Industrial communication 2016 English
Industrial communication 2016 EnglishIndustrial communication 2016 English
Industrial communication 2016 English
 
Distributed system
Distributed systemDistributed system
Distributed system
 
Distributed computing
Distributed computingDistributed computing
Distributed computing
 
Industrial Networking - Profibus
Industrial Networking - ProfibusIndustrial Networking - Profibus
Industrial Networking - Profibus
 

Semelhante a Percona Cluster with Master_Slave for Disaster Recovery

How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...Cloudian
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSudheer Kondla
 
Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2benjaminwootton
 
Pandora FMS: Raven DB Plugin
Pandora FMS: Raven DB PluginPandora FMS: Raven DB Plugin
Pandora FMS: Raven DB PluginPandora FMS
 
Webcenter application performance tuning guide
Webcenter application performance tuning guideWebcenter application performance tuning guide
Webcenter application performance tuning guideVinay Kumar
 
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning GuideWebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning GuideTan Nguyen Phi
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and ShardingTharun Srinivasa
 
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSMariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSJelastic Multi-Cloud PaaS
 
Maxscale_메뉴얼
Maxscale_메뉴얼Maxscale_메뉴얼
Maxscale_메뉴얼NeoClova
 
Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )varasteh65
 
Database Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David IzahkDatabase Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David Izahksqlserver.co.il
 
How to scale your web app
How to scale your web appHow to scale your web app
How to scale your web appGeorgio_1999
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replicationPoguttuezhiniVP
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsMydbops
 
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdfseo18
 
CUBRID Developer's Course
CUBRID Developer's CourseCUBRID Developer's Course
CUBRID Developer's CourseCUBRID
 
SAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business ObjectsSAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business ObjectsSitesh Patel
 

Semelhante a Percona Cluster with Master_Slave for Disaster Recovery (20)

Magento Hosting on AWS
Magento Hosting on AWS Magento Hosting on AWS
Magento Hosting on AWS
 
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
 
Nt1330 Unit 1
Nt1330 Unit 1Nt1330 Unit 1
Nt1330 Unit 1
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
 
Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2
 
Pandora FMS: Raven DB Plugin
Pandora FMS: Raven DB PluginPandora FMS: Raven DB Plugin
Pandora FMS: Raven DB Plugin
 
Webcenter application performance tuning guide
Webcenter application performance tuning guideWebcenter application performance tuning guide
Webcenter application performance tuning guide
 
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning GuideWebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
 
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSMariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
 
Network Manual
Network ManualNetwork Manual
Network Manual
 
Maxscale_메뉴얼
Maxscale_메뉴얼Maxscale_메뉴얼
Maxscale_메뉴얼
 
Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )
 
Database Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David IzahkDatabase Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David Izahk
 
How to scale your web app
How to scale your web appHow to scale your web app
How to scale your web app
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replication
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient Backups
 
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
 
CUBRID Developer's Course
CUBRID Developer's CourseCUBRID Developer's Course
CUBRID Developer's Course
 
SAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business ObjectsSAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business Objects
 

Percona Cluster with Master_Slave for Disaster Recovery

  • 1. Prepared By: Ram Gautam email to :ramgau@gmail.com Contents 1. Introduction ....................................................................................................................................2 2. Scope...............................................................................................................................................2 3. Intendant audience..........................................................................................................................2 4. Point to be considered/Further research .........................................................................................2 5. High Level diagram ..........................................................................................................................3 6. Used tools .......................................................................................................................................4 7. Configuration and setup ..................................................................................................................4 7.1 Asynchronous Communication between Master/Slave ..................................................................4 7.2 Percona XtraDB Cluster Configurations: .........................................................................................4 7.3 Master/Slave configuration for Asynchronous DB replication.........................................................5 STEP 1: Make a backup on TheMaster and prepare it.......................................................................5 STEP 2: Copy backed up data to TheSlave ........................................................................................7 STEP 3: Configure The Master’s MySQL server .................................................................................7 STEP 4: Start the replication.............................................................................................................8 STEP 5: Check the Master/Slave status.............................................................................................8 8. References.......................................................................................................................................8
  • 2. Prepared By: Ram Gautam email to :ramgau@gmail.com 1. Introduction This document is giving high level configuration about Percona 5.7, 3 node cluster with Master/Slave database Replication for Disaster Recovery (DR) between Production Data Center (DC) and Disaster Recovery Data Center. 2. Scope This document covers about to configure Master/Save Database (DB) replication in centos using Percona technologies. 3. Intendant audience All configuration and setup are being done on Centos 6, Linux platform. So Database Administrator or System Administrator or Developer should have basic knowledge of Linux command, MySQL database, and Master /slave information to follow this document. 4. Point to be considered/Further research Before start doing DB replication configuration, there may be following points to be considered.  Network stability between Production Datacenter and DR Datacenter  MySQL version at both Production DB and DR DB  DB replication strategy for MySQL storage ENGINE. Like InnoDB, MyISAM  Running query by Application.
  • 3. Prepared By: Ram Gautam email to :ramgau@gmail.com 5. High Level diagram This high level digram is showing two Application sets. i.e Production Set at Production Dataceter and DR Set at Disaster Recovery Datacenter. Based on DR platform configuration we need to create identical sets of components between Production and DR platform. For this, web server/Application server, Load Balancer for both App & DB, and DB Cluster are the identified components for platform setup. Running application does not often change compare to DB. So we are focusing on DB synchronization between Production and DR platform. We cannot put synchronous communication medium to synch DB due to network latency, each transaction cycle in DB. Due to this, we need to use Asynchronous mechanism for DB synch. In above figure, Red highlighted rectangle is detonated as the Virtual Private Network (VPN) between Production DC and DR DC. Perconca tools to make Asynchronous DB replication/Hot Backup between Production DB cluster and DR DB cluster. There is used Master/Slave concept for db replication as source and destination DB server. One of the node from Production 3 node cluster as Master and One of the node from DR Node Cluster.
  • 4. Prepared By: Ram Gautam email to :ramgau@gmail.com 6. Used tools  Percona 5.7 cluster  Innobackupex/ xtrabackup  Yum 7. Configuration and setup 7.1 Asynchronous Communication between Master/Slave Asynchronous Replication uses the approach of lazy replication. The master database asynchronously propagates replica updates to other slave nodes. Percona comes with a tool that allows you to perform Asynchronous DB replication/Hot Backup s of a running MySQL database, with no blocking. It’s able to do this because of Innodb & multi-version concurrency control (MVCC). Luckily we don’t need to dig into the guts to enjoy the benefits of this great technology. 7.2 Percona XtraDB Cluster Configurations: Percona is an open source software company specializing in MySQL, MongoDB, and other open source database support, consulting, managed services, and training. Percona XtraDB Cluster is an active/active high availability and high scalability open source solution for MySQL clustering. It integrates Percona Server and Percona XtraBackup with the Codership Galera library of MySQL high availability solutions in a single package that enables you to create a cost-effective MySQL high availability cluster. We can found more information https://www.percona.com/software/mysql-database/percona-xtradb-cluster Installation Documentation: https://www.percona.com/downloads/Percona-XtraDB-Cluster-57/LATEST/ In other document already described about how to configure Percona cluster 5.7 cluster with High Availability. This document consists about configuration about DB replication between two sets of db cluster. Each Cluster consists 3 nodes because 3 nodes clusters is best practice for clustering. DB replication configuration step starts once all Cluster successfully configuration at both Production DC and DR DC. Then we will pick one node as Master form Production DC and one node as from DR DC
  • 5. Prepared By: Ram Gautam email to :ramgau@gmail.com 7.3 Master/Slave configuration for Asynchronous DB replication Based on High level diagram, configuration will be as follows: - TheMaster ,Node at Production Cluster-Node3 (192.168.2.6) - TheSlave ,Node at DR Cluster – Node 1 (192.168.3.4) TheMaster, A system with a MySQL-based server installed, configured and running. This system will be called TheMaster, as it is where your data is stored and the one to be replicated. We will assume the following about this system:  the MySQL server is able to communicate with others by the standard TCP/IP port;  the SSH server is installed and configured;  you have a user account in the system with the appropriate permissions;  you have a MySQL’s user account with appropriate privileges.  server has binlogs enabled and unique server-id set up. TheSlave Another system, with a MySQL-based server installed on it. We will refer to this machine as TheSlave and we will assume the same things we did about TheMaster, except that the server-id on TheSlave . Percona XtraBackup, The backup tool we will use. It should be installed in both computers for convenience. STEP 1: Make a backup on TheMaster and prepare it Binary logs on PXC Binary logs are not strictly needed in PXC for replication, but you may be using them for backups or for asynchronous slaves of the cluster. To set them up properly, we need the following settings added to our config . For this, following configuration needs to be added in TheMaster, my.cnf config file. # In order for Galera to work correctly binlog format should be ROW binlog_format=ROW #For DB replication server_id=19216826 #binlog_format=ROW log_slave_updates=1 log_bin=binlog
  • 6. Prepared By: Ram Gautam email to :ramgau@gmail.com Sample TheMaster, My.cnf will be ,After adding Replication parameter [mysqld] datadir=/var/lib/mysql user=mysql #log-error=/var/log/mysqld.log # Path to Galera library wsrep_provider=/usr/lib64/libgalera_smm.so # Cluster connection URL contains the IPs of node#1, node#2 and node#3wsrep_cluster_address=gcomm://192.168.2.4,192.168.2.5,192.168.2.6 # In order for Galera to work correctly binlog format should be ROW binlog_format=ROW #For DB replication server_id=19216826 #binlog_format=ROW log_slave_updates=1 log_bin=binlog #gtid_mode=ON #enforce_gtid_consistency=1 # MyISAM storage engine has only experimental support default_storage_engine=InnoDB # This InnoDB autoincrement locking mode is a requirement for Galera innodb_autoinc_lock_mode=2 # Node 1 address wsrep_node_address=192.168.2.6 # SST method wsrep_sst_method=xtrabackup-v2 # Cluster name wsrep_cluster_name=test_5_7cluster_node # Authentication for SST method wsrep_sst_auth="sstuser:s3cret"
  • 7. Prepared By: Ram Gautam email to :ramgau@gmail.com TO get snapshot from Master DB: TheMaster # innobackupex --host=127.0.0.1 --user=bkpuser --password=bkppassword --port=3306 /data/backups/new_backup/ After this is finished you should get : innobackupex: completed OK! This will make a copy of your MySQL data dir to the /data/backups/new_backup/$TIMESTAMP. You have told Percona XtraBackup (through the innobackupex script) to connect to the database server using your database user and password, and do a hot backup of all your data in it (all MyISAM, InnoDB tables and indexes in them). In order for snapshot to be consistent you need to prepare the data: TheMaster # innobackupex --apply-log --host=127.0.0.1 --user=bkpuser --password=bkppassword /data/backups/new_backup/$TIMESTAMP STEP 2: Copy backed up data to TheSlave  TheMaster # scp -r /data/backups/new_backup/$TIMESTAMP root@ TheSlave:/data/  Stop mysql at slave after successfully copied file from Master  At minimum you need to set the server_id to a unique value. The IP address with the periods removed can make a good server_id. Like 19216834  Update mysql data directory with just copied from Master. TheSlave$ mv /path/to/mysql/datadir /path/to/mysql/datadir_bak and move the snapshot from TheMaster in its place: TheSlave$ mv /path/to/mysql/$TIMESTAMP /path/to/mysql/datadir After you copy data over, make sure MySQL has proper permissions to access them. TheSlave$ chown mysql:mysql /path/to/mysql/datadir In case the ibdata and iblog files are located in different directories outside of the datadir, you will have to put them in their proper place after the logs have been applied STEP 3: Configure The Master’s MySQL server Add the appropriate grant in order for slave to be able to connect to master: TheMaster|mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'$slaveip' IDENTIFIED BY '$slavepass'; Also make sure that firewall rules are correct and that TheSlave can connect to TheMaster. Test that you can run the mysql client on TheSlave, connect to TheMaster, and authenticate. TheSlave$ mysql --host=TheMaster --user=repl --password=$slavepass Verify the privileges. mysql> SHOW GRANTS;
  • 8. Prepared By: Ram Gautam email to :ramgau@gmail.com STEP 4: Start the replication  Start/restat MySQL on TheSlave  Look at the content of the file xtrabackup_binlog_info, it will be something like: TheSlave$ cat /var/lib/mysql/xtrabackup_binlog_info TheMaster-bin.000001 481  Execute the CHANGE MASTER statement on a MySQL console and use the username and password you’ve set up in STEP 3: TheSlave|mysql> CHANGE MASTER TO MASTER_HOST='$masterip', MASTER_USER='repl', MASTER_PASSWORD='$slavepass', MASTER_LOG_FILE='TheMaster-bin.000001', MASTER_LOG_POS=481;  and start the slave: TheSlave|mysql> START SLAVE; STEP 5: Check the Master/Slave status You should check that everything went OK with: TheSlave|mysql> SHOW SLAVE STATUS G ... Slave_IO_Running: Yes Slave_SQL_Running: Yes ... Seconds_Behind_Master: 13 ... 8. References https://www.percona.com/blog/2015/07/16/bypassing-sst-pxc-binary-logs/ https://www.percona.com/doc/percona-xtrabackup/2.1/howtos/setting_up_replication.html https://www.handybackup.net/mysql-replication.shtml http://www.iheavy.com/2012/04/17/easy-mysql-replication-with-hotbackups-2/