SlideShare a Scribd company logo
1 of 13
Ngô Anh Tuấn
Developer at Webtretho
»   What is My SQL Data Replication?
»   Why we use?
»   Setup on Master
»   Setup on Slave
»   Code Example
»   Other Replication
»   Q&A
»   Replication.
»   Asynchronous data from Master to Slave.
»   Master – Can Read and Write.
»   Slave – Only Read.
» Database server is overloaded.
» Security.
» A solution for backup.
» My.cnf (Linux) or My.ini (Windows)
» Don’t use skip-networking param.
» Enable binary log for mysql
  log-bin=mysql-bin
  binlog_format=mixed (recommend)
» Set server ID
  server-id=1
» Create user for replication (optional)
  CREATE USER 'replication_user'@'%';
  GRANT REPLICATION SLAVE , REPLICATION
  CLIENT ON * . * TO
  'replication_user'@'%';
» My.cnf (Linux) or My.ini (Win)
» Set server ID
  server-id=2
» Go to mysql from command line
  CHANGE MASTER TO
  MASTER_HOST=’192.168.2.248′,
  MASTER_PORT=3306,
  MASTER_USER=’replication_user’,
  MASTER_PASSWORD=’PASSWORD’;
» START SLAVE;
» SHOW SLAVE STATUS G;
» Read more:
  http://dev.mysql.com/doc/refman/5.5/en/repli
  cation-howto.html

  http://www.jamiehurst.co.uk/mysql-tutorial-
  replication/
DEMO
» Config.php.
» Example.php.
» Using adodb.
» Multi Master Replication
  http://mysql-mmm.org/

» My SQL proxy
  http://dev.mysql.com/downloads/mysql-proxy/

» My SQL Cluster
  http://dev.mysql.com/doc/index-cluster.html
Q&A
Thank you!

More Related Content

What's hot

What's hot (20)

Galera Cluster DDL and Schema Upgrades 220217
Galera Cluster DDL and Schema Upgrades 220217Galera Cluster DDL and Schema Upgrades 220217
Galera Cluster DDL and Schema Upgrades 220217
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
 
How to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScaleHow to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScale
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group Replication
 
MySQL High Availability with Group Replication
MySQL High Availability with Group ReplicationMySQL High Availability with Group Replication
MySQL High Availability with Group Replication
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
 
MySQLおじさんの逆襲
MySQLおじさんの逆襲MySQLおじさんの逆襲
MySQLおじさんの逆襲
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HA
 
MySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - TutorialMySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - Tutorial
 
MySQL Router REST API
MySQL Router REST APIMySQL Router REST API
MySQL Router REST API
 
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
 
Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기
 
MySQL Shell for DBAs
MySQL Shell for DBAsMySQL Shell for DBAs
MySQL Shell for DBAs
 
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a nutshell  hands-on tutorialMySQL InnoDB Cluster and Group Replication in a nutshell  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial
 
Sql server これだけはやっておこう 最終版
Sql server これだけはやっておこう 最終版Sql server これだけはやっておこう 最終版
Sql server これだけはやっておこう 最終版
 
MySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & OperationsMySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & Operations
 
Maxscale 소개 1.1.1
Maxscale 소개 1.1.1Maxscale 소개 1.1.1
Maxscale 소개 1.1.1
 

Viewers also liked

Introduction to Hadoop
Introduction to HadoopIntroduction to Hadoop
Introduction to Hadoop
Joey Jablonski
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
suhasreddy1
 

Viewers also liked (14)

Introduction to Hadoop
Introduction to HadoopIntroduction to Hadoop
Introduction to Hadoop
 
Data Replication - Synchronization Tool for TCIA
Data Replication - Synchronization Tool for TCIAData Replication - Synchronization Tool for TCIA
Data Replication - Synchronization Tool for TCIA
 
Database Replication
Database ReplicationDatabase Replication
Database Replication
 
Lect 07 data replication
Lect 07 data replicationLect 07 data replication
Lect 07 data replication
 
IBM InfoSphere Data Replication for Big Data
IBM InfoSphere Data Replication for Big DataIBM InfoSphere Data Replication for Big Data
IBM InfoSphere Data Replication for Big Data
 
Sharding using MySQL and PHP
Sharding using MySQL and PHPSharding using MySQL and PHP
Sharding using MySQL and PHP
 
Data Replication Options in AWS (ARC302) | AWS re:Invent 2013
Data Replication Options in AWS (ARC302) | AWS re:Invent 2013Data Replication Options in AWS (ARC302) | AWS re:Invent 2013
Data Replication Options in AWS (ARC302) | AWS re:Invent 2013
 
Selective Data Replication with Geographically Distributed Hadoop
Selective Data Replication with Geographically Distributed HadoopSelective Data Replication with Geographically Distributed Hadoop
Selective Data Replication with Geographically Distributed Hadoop
 
Introduction to Cassandra: Replication and Consistency
Introduction to Cassandra: Replication and ConsistencyIntroduction to Cassandra: Replication and Consistency
Introduction to Cassandra: Replication and Consistency
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal ScalingMySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
 
Replication in Data Science
Replication in Data ScienceReplication in Data Science
Replication in Data Science
 
Oracle veritabanı yonetiminde onemli teknikler
Oracle veritabanı yonetiminde onemli tekniklerOracle veritabanı yonetiminde onemli teknikler
Oracle veritabanı yonetiminde onemli teknikler
 

Similar to Mysql data replication

Basic Replication in MongoDB
Basic Replication in MongoDBBasic Replication in MongoDB
Basic Replication in MongoDB
MongoDB
 
Replication and replica sets
Replication and replica setsReplication and replica sets
Replication and replica sets
Randall Hunt
 
20131003 pizzasessie db-security
20131003 pizzasessie db-security20131003 pizzasessie db-security
20131003 pizzasessie db-security
Jelmer de Reus
 
Where to start with power cli
Where to start with power cliWhere to start with power cli
Where to start with power cli
Chris Halverson
 

Similar to Mysql data replication (20)

MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017
 
Mysql
MysqlMysql
Mysql
 
Performance Schema for MySQL Troubleshooting
 Performance Schema for MySQL Troubleshooting Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
DPC Tutorial
DPC TutorialDPC Tutorial
DPC Tutorial
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replication
 
Tek tutorial
Tek tutorialTek tutorial
Tek tutorial
 
Exploring the replication in MongoDB
Exploring the replication in MongoDBExploring the replication in MongoDB
Exploring the replication in MongoDB
 
Basic Replication in MongoDB
Basic Replication in MongoDBBasic Replication in MongoDB
Basic Replication in MongoDB
 
Replication and replica sets
Replication and replica setsReplication and replica sets
Replication and replica sets
 
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert VanderkelenOSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
 
20131003 pizzasessie db-security
20131003 pizzasessie db-security20131003 pizzasessie db-security
20131003 pizzasessie db-security
 
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
 
My SQL 101
My SQL 101My SQL 101
My SQL 101
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Where to start with power cli
Where to start with power cliWhere to start with power cli
Where to start with power cli
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
 
Mysql replication @ gnugroup
Mysql replication @ gnugroupMysql replication @ gnugroup
Mysql replication @ gnugroup
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 

Mysql data replication

  • 2. » What is My SQL Data Replication? » Why we use? » Setup on Master » Setup on Slave » Code Example » Other Replication » Q&A
  • 3.
  • 4. » Replication. » Asynchronous data from Master to Slave. » Master – Can Read and Write. » Slave – Only Read.
  • 5. » Database server is overloaded. » Security. » A solution for backup.
  • 6. » My.cnf (Linux) or My.ini (Windows) » Don’t use skip-networking param. » Enable binary log for mysql log-bin=mysql-bin binlog_format=mixed (recommend) » Set server ID server-id=1 » Create user for replication (optional) CREATE USER 'replication_user'@'%'; GRANT REPLICATION SLAVE , REPLICATION CLIENT ON * . * TO 'replication_user'@'%';
  • 7. » My.cnf (Linux) or My.ini (Win) » Set server ID server-id=2 » Go to mysql from command line CHANGE MASTER TO MASTER_HOST=’192.168.2.248′, MASTER_PORT=3306, MASTER_USER=’replication_user’, MASTER_PASSWORD=’PASSWORD’; » START SLAVE; » SHOW SLAVE STATUS G;
  • 8. » Read more: http://dev.mysql.com/doc/refman/5.5/en/repli cation-howto.html http://www.jamiehurst.co.uk/mysql-tutorial- replication/
  • 11. » Multi Master Replication http://mysql-mmm.org/ » My SQL proxy http://dev.mysql.com/downloads/mysql-proxy/ » My SQL Cluster http://dev.mysql.com/doc/index-cluster.html
  • 12. Q&A

Editor's Notes

  1. Server-id = 0  master refuses connections from all slaves.Optimize for InnoDByou should use innodb_flush_log_at_trx_commit=1 and sync_binlog=1 in the master my.cnf file.Turn off firewall to make sure can connect mysql of other machine
  2. In My.inimaster-connect-retry=60replicate-do-db=exampledb
  3. Multi master for master overload