SlideShare a Scribd company logo
MySQL ReplicationMySQL Replication
&&
ScalingScaling
Presenter:
Avishek Kumar Sharma
Mindfire Solutions
Date: 29/10/2014
OCP MySQL 5.0 - Oracle Certified Professional
Connect Me :
Facebook: https://www.facebook.com/avishekkumar.sharma.5
LinkedIn: http://in.linkedin.com/pub/avishek-kumar-sharma/31/798/509
Twitter: https://twitter.com/sharma_avishek
Google+: https://plus.google.com/103775319893123886681/posts
Blog:
http://avisheksharma.wordpress.com
Contact Me :
Email: avisheks@mindfiresolutions.com
Skype: mfsi_avisheks
About Me
3
Today's Talk
1. Replication- brief introduction
2. Multiple MySQL Instances
3. Replication Topology
4. Setting up Replication (Demo)
- Master Configurations
- Binlog
- Replication User
- Slave Configurations
- Relaylog
- Replication Thread
- Start Slave
5. Trouble Shooting Replication
6. Replication Compatibility and Upgrading
7. Replication and Scaling-out
8. Backup and replication(HA/Fault Tolerance)
4
Replication- brief intro
- Capability that allows the databases on one server(the master) to
be made available on another servers(the slaves).
- Replication was introduced in MySQL version 3 and matured to a
robust, stable technology as of MySQL 4.0.2.
5
Multiple MySQL Instances
Multiple MySQL server instances on a single host.
- new release testing
- administrative work
Caution:
- separate data-dir(unless readonly)
- separate network interfaces
- TCP/IP port
- socket files
- separate log/PID file
6
Replication Topology
7
Setting up Replication (demo)
- Sync both databases.
- Master Configurations
- Enable binlog
- set log_bin = /var/log/mysql/mysql-bin.log
- Replication User
- CREATE USER `replicator`@localhost IDENTIFIED BY `mindfire`;
- GRANT REPLICATION SLAVE ON *.* TO replicator@localhost;
- Slave Configurations
- Relaylog(optional)
- relay-log = /var/lib/mysql/slave-relay.log
- Set Master host
- CHANGE MASTER TO
MASTER_HOST = 'localhost',
MASTER_USER = 'replicator',
MASTER_PORT = 3306,
MASTER_PASSWORD = "mindfire",
MASTER_LOG_FILE = 'mysql-bin.000001',
MASTER_LOG_POS = 120;
- Start Slave
- START SLAVE;
8
Trouble Shooting Replication
- If slave is running ?
- SHOW SLAVE [IO_THREAD/SQL_THREAD] STATUS;
if not, issue:
- START SLAVE [IO_THREAD/SQL_THREAD];
- monitor slave log.
- master/slave have unique server-ids ?
- binary_logging enabled on master ?
- SHOW VARIABLES LIKE "log_bin";
- connect master host from mysql client ?
- error information for “SHOW SLAVE STATUS”
9
Replication Compatibility and Upgrading
- Slave trouble parsing binary log file sent from master.
- replication compatibility is the best when both master and slave
run on same server version.
- as a general rule “upgrade slave before upgrading master”
10
Replication and “Scaling-out”
11
12
reads = 1200 - 2 * writes
13
Backup and replication(HA/Fault Tolerance)
14
before redundancy:
15
Master went down, Slave 1 as new Master.
(monitor replication heartbeat)
1. On each slave,
- STOP SLAVE IO_THREAD
(check the output of SHOW PROCESSLIST until you see Has read all relay log)
2. On the slave Slave 1,
- STOP SLAVE
- RESET MASTER.
3. On the other slaves Slave 2 and Slave 3,
- STOP SLAVE
- CHANGE MASTER TO MASTER_HOST='Slave1'
- START SLAVE
4. tell each Web Client to direct its statements to Slave 1.
NB: Slaves must be running with --log-bin and without –log-slave-updates.
16
after redundancy:
NB: after the master being available again, it has to become slave of “Slave 1” first for
being updated with all missed events before it become Master again.
17
References
http://dev.mysql.com/doc/refman/5.6/en/replication.html
http://dev.mysql.com/doc/refman/5.6/en/replication-solutions-scaleout.html
http://dev.mysql.com/doc/refman/5.6/en/replication-solutions-switch.html
www.mindfiresolutions.com
SAMPLE CASE STUDY
The client firm had a couple of social networking – video
sharing community websites that were hosted using a freely
available open source codebase that the client had acquired on
the web and wanted to enhance. Contracting work to another
firm and that too, another country was a double-challenge for
the client firm. Mindfire's immense experience in video
streaming and community/social application development,
helped establish the initial trust. This was well supported by
the different business engagement models Mindfire proposed
to the client firm. Two dedicated resources were assigned for
the first two months and this later became a long and healthy
relationship resulting in a full scale virtual team setup on the
video sharing community application development. Mindfire
delivered a full scale, extensible team setup, with experienced
resources involved in multiple technologies for both client
and server side application design and development.
Click to get detailed info >>
19
Thank you :)Thank you :)
20
https://www.facebook.com/MindfireSolutions
http://www.linkedin.com/company/mindfire-solutions
http://twitter.com/mindfires
www.mindfiresolutions.com
Contact Us @

More Related Content

What's hot

플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포
흥래 김
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
vnsavage
 

What's hot (20)

Virtualización de Escriorios VMWare View 5
Virtualización de Escriorios VMWare View 5Virtualización de Escriorios VMWare View 5
Virtualización de Escriorios VMWare View 5
 
Java EE 02-First Servlet
Java EE 02-First ServletJava EE 02-First Servlet
Java EE 02-First Servlet
 
Install and configure windows server 2016 core on hyper v 2016 step by step
Install and configure windows server 2016 core on hyper v 2016 step by stepInstall and configure windows server 2016 core on hyper v 2016 step by step
Install and configure windows server 2016 core on hyper v 2016 step by step
 
플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포
 
Iscsi storage in windows server 2016 step by step
Iscsi storage in windows server 2016 step by stepIscsi storage in windows server 2016 step by step
Iscsi storage in windows server 2016 step by step
 
How to Install UiPath on Azure from a Mac.
How to Install UiPath on Azure from a Mac.How to Install UiPath on Azure from a Mac.
How to Install UiPath on Azure from a Mac.
 
095 j boss_development_environmentconfig_pub
095 j boss_development_environmentconfig_pub095 j boss_development_environmentconfig_pub
095 j boss_development_environmentconfig_pub
 
Introducing CQ 5.1
Introducing CQ 5.1Introducing CQ 5.1
Introducing CQ 5.1
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
Fs
FsFs
Fs
 
Deploy apps in standalone with maven
Deploy apps in standalone with mavenDeploy apps in standalone with maven
Deploy apps in standalone with maven
 
Create and Configure Windows Server 2016 VM in the Azure Step by Step
Create and Configure Windows Server 2016 VM in the Azure Step by StepCreate and Configure Windows Server 2016 VM in the Azure Step by Step
Create and Configure Windows Server 2016 VM in the Azure Step by Step
 
Installing WampServer
Installing WampServerInstalling WampServer
Installing WampServer
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
How to Install Magento on Google Cloud Engine (GCE)
How to Install Magento on Google Cloud Engine (GCE)How to Install Magento on Google Cloud Engine (GCE)
How to Install Magento on Google Cloud Engine (GCE)
 
Novidades do Entity Framework Core 6
Novidades do Entity Framework Core 6Novidades do Entity Framework Core 6
Novidades do Entity Framework Core 6
 
Understanding a web server and types of web servers ppt
Understanding a web server and types of web servers pptUnderstanding a web server and types of web servers ppt
Understanding a web server and types of web servers ppt
 
Getting Started with CloudScript
Getting Started with CloudScriptGetting Started with CloudScript
Getting Started with CloudScript
 
My SQL 1
My SQL 1My SQL 1
My SQL 1
 
Managing VMware with PowerShell - VMworld 2008
Managing VMware with PowerShell - VMworld 2008Managing VMware with PowerShell - VMworld 2008
Managing VMware with PowerShell - VMworld 2008
 

Viewers also liked

Sphinxで作る貢献しやすい ドキュメント翻訳の仕組み
Sphinxで作る貢献しやすいドキュメント翻訳の仕組みSphinxで作る貢献しやすいドキュメント翻訳の仕組み
Sphinxで作る貢献しやすい ドキュメント翻訳の仕組み
Takayuki Shimizukawa
 

Viewers also liked (16)

Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話
 
sqldf for pandas
sqldf for pandassqldf for pandas
sqldf for pandas
 
3分でサーバオペレーションコマンドを作る技術
3分でサーバオペレーションコマンドを作る技術3分でサーバオペレーションコマンドを作る技術
3分でサーバオペレーションコマンドを作る技術
 
SekainoKAO by TeamKAO
SekainoKAO by TeamKAOSekainoKAO by TeamKAO
SekainoKAO by TeamKAO
 
pandasによるデータ加工時の注意点やライブラリの話
pandasによるデータ加工時の注意点やライブラリの話pandasによるデータ加工時の注意点やライブラリの話
pandasによるデータ加工時の注意点やライブラリの話
 
日本のオープンデータプラットフォームをPythonでつくる
日本のオープンデータプラットフォームをPythonでつくる日本のオープンデータプラットフォームをPythonでつくる
日本のオープンデータプラットフォームをPythonでつくる
 
tse - Pythonによるテキスト整形ユーティリティ
tse - Pythonによるテキスト整形ユーティリティtse - Pythonによるテキスト整形ユーティリティ
tse - Pythonによるテキスト整形ユーティリティ
 
Ry pyconjp2015 karaoke
Ry pyconjp2015 karaokeRy pyconjp2015 karaoke
Ry pyconjp2015 karaoke
 
PyLadies Tokyo - 初心者向けPython体験ワークショップ開催の裏側
PyLadies Tokyo - 初心者向けPython体験ワークショップ開催の裏側PyLadies Tokyo - 初心者向けPython体験ワークショップ開催の裏側
PyLadies Tokyo - 初心者向けPython体験ワークショップ開催の裏側
 
Sphinxで作る貢献しやすい ドキュメント翻訳の仕組み
Sphinxで作る貢献しやすいドキュメント翻訳の仕組みSphinxで作る貢献しやすいドキュメント翻訳の仕組み
Sphinxで作る貢献しやすい ドキュメント翻訳の仕組み
 
Python と型ヒント (Type Hints)
Python と型ヒント (Type Hints)Python と型ヒント (Type Hints)
Python と型ヒント (Type Hints)
 
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
 
アドネットワークのデータ解析チームを支える技術
アドネットワークのデータ解析チームを支える技術アドネットワークのデータ解析チームを支える技術
アドネットワークのデータ解析チームを支える技術
 
強くなるためのプログラミング -プログラミングに関する様々なコンテストとそのはじめ方-#pyconjp
強くなるためのプログラミング -プログラミングに関する様々なコンテストとそのはじめ方-#pyconjp強くなるためのプログラミング -プログラミングに関する様々なコンテストとそのはじめ方-#pyconjp
強くなるためのプログラミング -プログラミングに関する様々なコンテストとそのはじめ方-#pyconjp
 
野球Hack!~Pythonを用いたデータ分析と可視化 #pyconjp
野球Hack!~Pythonを用いたデータ分析と可視化 #pyconjp野球Hack!~Pythonを用いたデータ分析と可視化 #pyconjp
野球Hack!~Pythonを用いたデータ分析と可視化 #pyconjp
 
PythonとPyCoRAMでお手軽にFPGAシステムを開発してみよう
PythonとPyCoRAMでお手軽にFPGAシステムを開発してみようPythonとPyCoRAMでお手軽にFPGAシステムを開発してみよう
PythonとPyCoRAMでお手軽にFPGAシステムを開発してみよう
 

Similar to My SQL Replication and Scaling

Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Sean Hull
 

Similar to My SQL Replication and Scaling (20)

Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
Sql installation
Sql installationSql installation
Sql installation
 
2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Mysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50minsMysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50mins
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
Experiences of SOACS
Experiences of SOACSExperiences of SOACS
Experiences of SOACS
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and Scalability
 
UKOUG Tech17 - Stay Secure With Oracle Solaris
UKOUG Tech17 - Stay Secure With Oracle SolarisUKOUG Tech17 - Stay Secure With Oracle Solaris
UKOUG Tech17 - Stay Secure With Oracle Solaris
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
 
WebLogic FAQs
WebLogic FAQsWebLogic FAQs
WebLogic FAQs
 
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
 
MySQL Latest News
MySQL Latest NewsMySQL Latest News
MySQL Latest News
 
Getting Modern With MySQL
Getting Modern With MySQLGetting Modern With MySQL
Getting Modern With MySQL
 
Getting modern with my sql
Getting modern with my sqlGetting modern with my sql
Getting modern with my sql
 
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replication
 
1 my sql20151219-kaji_ivan
1 my sql20151219-kaji_ivan1 my sql20151219-kaji_ivan
1 my sql20151219-kaji_ivan
 

More from Mindfire Solutions

More from Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Recently uploaded (20)

10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
How To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfHow To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdf
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
A Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationA Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data Migration
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with StrimziStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Benefits of Employee Monitoring Software
Benefits of  Employee Monitoring SoftwareBenefits of  Employee Monitoring Software
Benefits of Employee Monitoring Software
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 

My SQL Replication and Scaling

  • 1. MySQL ReplicationMySQL Replication && ScalingScaling Presenter: Avishek Kumar Sharma Mindfire Solutions Date: 29/10/2014
  • 2. OCP MySQL 5.0 - Oracle Certified Professional Connect Me : Facebook: https://www.facebook.com/avishekkumar.sharma.5 LinkedIn: http://in.linkedin.com/pub/avishek-kumar-sharma/31/798/509 Twitter: https://twitter.com/sharma_avishek Google+: https://plus.google.com/103775319893123886681/posts Blog: http://avisheksharma.wordpress.com Contact Me : Email: avisheks@mindfiresolutions.com Skype: mfsi_avisheks About Me
  • 3. 3 Today's Talk 1. Replication- brief introduction 2. Multiple MySQL Instances 3. Replication Topology 4. Setting up Replication (Demo) - Master Configurations - Binlog - Replication User - Slave Configurations - Relaylog - Replication Thread - Start Slave 5. Trouble Shooting Replication 6. Replication Compatibility and Upgrading 7. Replication and Scaling-out 8. Backup and replication(HA/Fault Tolerance)
  • 4. 4 Replication- brief intro - Capability that allows the databases on one server(the master) to be made available on another servers(the slaves). - Replication was introduced in MySQL version 3 and matured to a robust, stable technology as of MySQL 4.0.2.
  • 5. 5 Multiple MySQL Instances Multiple MySQL server instances on a single host. - new release testing - administrative work Caution: - separate data-dir(unless readonly) - separate network interfaces - TCP/IP port - socket files - separate log/PID file
  • 7. 7 Setting up Replication (demo) - Sync both databases. - Master Configurations - Enable binlog - set log_bin = /var/log/mysql/mysql-bin.log - Replication User - CREATE USER `replicator`@localhost IDENTIFIED BY `mindfire`; - GRANT REPLICATION SLAVE ON *.* TO replicator@localhost; - Slave Configurations - Relaylog(optional) - relay-log = /var/lib/mysql/slave-relay.log - Set Master host - CHANGE MASTER TO MASTER_HOST = 'localhost', MASTER_USER = 'replicator', MASTER_PORT = 3306, MASTER_PASSWORD = "mindfire", MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 120; - Start Slave - START SLAVE;
  • 8. 8 Trouble Shooting Replication - If slave is running ? - SHOW SLAVE [IO_THREAD/SQL_THREAD] STATUS; if not, issue: - START SLAVE [IO_THREAD/SQL_THREAD]; - monitor slave log. - master/slave have unique server-ids ? - binary_logging enabled on master ? - SHOW VARIABLES LIKE "log_bin"; - connect master host from mysql client ? - error information for “SHOW SLAVE STATUS”
  • 9. 9 Replication Compatibility and Upgrading - Slave trouble parsing binary log file sent from master. - replication compatibility is the best when both master and slave run on same server version. - as a general rule “upgrade slave before upgrading master”
  • 11. 11
  • 12. 12 reads = 1200 - 2 * writes
  • 15. 15 Master went down, Slave 1 as new Master. (monitor replication heartbeat) 1. On each slave, - STOP SLAVE IO_THREAD (check the output of SHOW PROCESSLIST until you see Has read all relay log) 2. On the slave Slave 1, - STOP SLAVE - RESET MASTER. 3. On the other slaves Slave 2 and Slave 3, - STOP SLAVE - CHANGE MASTER TO MASTER_HOST='Slave1' - START SLAVE 4. tell each Web Client to direct its statements to Slave 1. NB: Slaves must be running with --log-bin and without –log-slave-updates.
  • 16. 16 after redundancy: NB: after the master being available again, it has to become slave of “Slave 1” first for being updated with all missed events before it become Master again.
  • 18. www.mindfiresolutions.com SAMPLE CASE STUDY The client firm had a couple of social networking – video sharing community websites that were hosted using a freely available open source codebase that the client had acquired on the web and wanted to enhance. Contracting work to another firm and that too, another country was a double-challenge for the client firm. Mindfire's immense experience in video streaming and community/social application development, helped establish the initial trust. This was well supported by the different business engagement models Mindfire proposed to the client firm. Two dedicated resources were assigned for the first two months and this later became a long and healthy relationship resulting in a full scale virtual team setup on the video sharing community application development. Mindfire delivered a full scale, extensible team setup, with experienced resources involved in multiple technologies for both client and server side application design and development. Click to get detailed info >>