SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.1
Demo: Replica
Keith Hollman
MySQL Principal Sales Consultant
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3
El entorno de réplica
 1x Master & 1x esclavo
 Mismo host / servidor
 Mismo instalación de software / binarios.
 Puertos & rutas diferentes (3306 & 3307)
 Réplica asíncrona.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4
Master - esclavo
 Creamos una instancia ‘master’:
cd /usr/local/mysql
cp my.cnf my3306.cnf
 Añadimos una parametrización
más ideal para réplica (my3306.cnf)
Preparación
server-id =6
log-slave-updates =TRUE
gtid-mode =ON
enforce-gtid-consistency =TRUE
master-info-repository =TABLE
relay-log-info-repository =TABLE
sync_binlog =1
sync_master_info =1
slave-parallel-workers =2
slave_transaction_retries =0
binlog-checksum =CRC32
master-verify-checksum =1
slave-sql-verify-checksum =1
binlog-rows-query-log-events =1
report-port =3306
log-bin =khollman_3306
binlog_format =ROW
report-host =khollman_es
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5
Master - esclavo
 Usando los valores específicos para este entorno, para asegurar que es único
y no sobrescribimos nada:
port = 3306
datadir = /opt/mysql/3306/data
socket = /tmp/mysql_3306.sock
server-id = 6
mkdir -p /opt/mysql/3306/data
alias mysql3306='/usr/local/mysql/bin/mysql -uroot -poracle -S
/tmp/mysql_3306.sock'
Preparación II
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6
Master - esclavo
 Instanciando los directorios:
pwd = /usr/local/mysql
scripts/mysql_install_db --defaults-file=/usr/local/mysql/my3306.cnf 
--user=mysql --datadir=/opt/mysql/3306/data
 Lo arrancamos:
bin/mysqld_safe --defaults-file=/usr/local/mysql/my3306.cnf 
--user=mysql --datadir=/opt/mysql/3306/data &
 Ahora, alguna buena práctica de seguridad:
./bin/mysqladmin -u root password 'oracle' -S /tmp/mysql_3306.sock
Creando la instancia
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7
Master - esclavo
 Creamos algún dato para replicar:
create database nexus;
use nexus
source /home/mysql/cre_tab_replicant.sql;
source /home/mysql/insert_nexus.sql
select `First Name`, `Last Name`, `Replicant` from replicant;
 Y el usuario que se conectará del esclavo al master para traerse los
datos:
grant REPLICATION SLAVE on *.* to 'replicant'@'127.0.0.1' 
identified by 'pkdick' ;
Poblamos una base de datos.
create table replicant (
`Title` enum('Mr','Mrs','Miss','Ms','M.') not
null default 'M.',
`First name` varchar(40) not null default '',
`Middle name` varchar(40) not null default '',
`Last name` varchar(40) not null default '',
`Replicant` enum('Yes','No') not null default
'Yes'
) engine=InnoDB;
insert into `replicant` (`First name`,`Last
name`,`Replicant`)
VALUES
('Roy','Hauer','Yes'),
('Rutger','Batty','Yes'),
('Voight','Kampff','Yes'),
('Pris','Hannah','Yes'),
('Daryl','Stratton','Yes'),
('Rachael','Young','Yes'),
('Sean','Tyrell','Yes'),
('Rick','Ford','No'),
('Harrison','Deckard','Yes');
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8
Master - esclavo
 Sacamos una imagen consistente de los datos a replicar:
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
/usr/local/mysql/bin/mysqldump -uroot -poracle -S /tmp/mysql_3306.sock 
--set-gtid-purged=OFF --master-data=2 -B nexus > /home/mysql/nexus.sql
unlock tables;
Exportando los datos
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9
Creando el esclavo
 Es hora de crear el esclavo (3307).
alias mysql3307='/usr/local/mysql/bin/mysql -uroot -poracle -S
/tmp/mysql_3307.sock‘
prompt slave: R:m d>_
cd /usr/local/mysql
cp my3306.cnf my3307.cnf
:1,$ s/3306/3307/g
 Cambiamos: port, datadir, socket & server-id.
mkdir -p /opt/mysql/3307/data
Preparación, otra vez.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10
Creando el esclavo
 Creamos la instancia:
scripts/mysql_install_db --defaults-file=/usr/local/mysql/my3307.cnf 
--user=mysql --datadir=/opt/mysql/3307/data
 Arrancamos el esclavo:
bin/mysqld_safe --defaults-file=/usr/local/mysql/my3307.cnf 
--user=mysql --datadir=/opt/mysql/3307/data &
 Ahora, alguna buena práctica de seguridad:
./bin/mysqladmin -u root password 'oracle' -S /tmp/mysql_3307.sock
Preparación, otra vez II
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11
Creando el esclavo
 Comprobamos la conexión remota, del futuro esclavo al master:
bin/mysql -ureplicant -ppkdick -h127.0.0.1 -P3306 -e status
 Insertar / cargar los datos previamente exportados:
bin/mysql -uroot -poracle -h127.0.0.1 -P3307 < /home/mysql/nexus.sql
 Comprobamos:
bin/mysql -uroot -poracle -h127.0.0.1 -P3307 nexus
select `First Name`, `Last Name`, `Replicant` from replicant;
Preparación, otra vez III
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12
Replicando
show slave status G
 Nada. Bien.
 Le decimos al esclavo cual va a ser su master:
change master to master_host='127.0.0.1', master_port=3306,
master_user='replicant', master_password='pkdick',
master_auto_position=1 ;
start slave;
 Comprobamos:
show slave status G
Comenzamos a replicar
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13
Replicando
 Ver los errores, debido a las entradas en el bin-log. El "IO Thread" está
ok, pero el "SQL Thread" está parado.
drop database nexus;
start slave sql_thread;
show slave status G
 En el esclavo, 3307, creamos el usuario de réplica, por si en el futuro
queremos hacer switchover / failover:
grant REPLICATION SLAVE on *.* to 'replicant'@'127.0.0.1' identified by
'pkdick' ;
Comenzamos a replicar II
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14
Replicando
 Vamos a comprobar si funciona. En el master:
bin/mysql -uroot -poracle -h127.0.0.1 -P3306 nexus
show slave hosts;
insert into replicant (`First Name`,`Last Name`,`Replicant`) values
('Ridley', 'Tyrell','No'), ('Eldon','Scott', 'No');
select `First Name`, `Last Name`, `Replicant` from replicant;
 Ver el esclavo:
bin/mysql -uroot -poracle -h127.0.0.1 -P3307 nexus
show slave status G
use nexus; select `First Name`, `Last Name`, `Replicant` from replicant;
Comprobamos
 prompt master: R:m d>_
 prompt slave: R:m d>_
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15
Referencias
 MySQL Réplica tutorial:
http://www.mysql.com/why-mysql/white-papers/mysql-replication-tutorial/
 Introducción a réplica
http://www.mysql.com/why-mysql/white-papers/mysql-replication-introduction/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16
Questions?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.17
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18

Weitere ähnliche Inhalte

Was ist angesagt?

MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015Dave Stokes
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restoreVasudeva Rao
 
Xtrabackup工具使用简介 - 20110427
Xtrabackup工具使用简介 - 20110427Xtrabackup工具使用简介 - 20110427
Xtrabackup工具使用简介 - 20110427Jinrong Ye
 
NoSQL атакует: JSON функции в MySQL сервере.
NoSQL атакует: JSON функции в MySQL сервере.NoSQL атакует: JSON функции в MySQL сервере.
NoSQL атакует: JSON функции в MySQL сервере.Sveta Smirnova
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterI Goo Lee
 
Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retoreVasudeva Rao
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바NeoClova
 
Postgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud PlatformPostgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud PlatformSungJae Yun
 
Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7I Goo Lee
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document StoreI Goo Lee
 
MyAWR another mysql awr
MyAWR another mysql awrMyAWR another mysql awr
MyAWR another mysql awrLouis liu
 
MySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkMySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkLouis liu
 
My sql fabric ha and sharding solutions
My sql fabric ha and sharding solutionsMy sql fabric ha and sharding solutions
My sql fabric ha and sharding solutionsLouis liu
 
MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017Dave Stokes
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetAlexey Lesovsky
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionSveta Smirnova
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linuxVasudeva Rao
 

Was ist angesagt? (20)

MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
 
MySQL Backup & Recovery
MySQL Backup & RecoveryMySQL Backup & Recovery
MySQL Backup & Recovery
 
Xtrabackup工具使用简介 - 20110427
Xtrabackup工具使用简介 - 20110427Xtrabackup工具使用简介 - 20110427
Xtrabackup工具使用简介 - 20110427
 
NoSQL атакует: JSON функции в MySQL сервере.
NoSQL атакует: JSON функции в MySQL сервере.NoSQL атакует: JSON функции в MySQL сервере.
NoSQL атакует: JSON функции в MySQL сервере.
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
 
Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retore
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
 
Postgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud PlatformPostgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud Platform
 
Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document Store
 
MyAWR another mysql awr
MyAWR another mysql awrMyAWR another mysql awr
MyAWR another mysql awr
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
MySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkMySQL Tokudb engine benchmark
MySQL Tokudb engine benchmark
 
My sql fabric ha and sharding solutions
My sql fabric ha and sharding solutionsMy sql fabric ha and sharding solutions
My sql fabric ha and sharding solutions
 
MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication Cheatsheet
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linux
 

Ähnlich wie MySQL Replication: Demo Réplica en Español

StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce StackIQ
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestratorYoungHeon (Roy) Kim
 
Sending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old schoolSending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old schoolNahidul Kibria
 
MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016Dave Stokes
 
Basic Knowledge on MySql Replication
Basic Knowledge on MySql ReplicationBasic Knowledge on MySql Replication
Basic Knowledge on MySql ReplicationTasawr Interactive
 
Continuous deployment of puppet modules
Continuous deployment of puppet modulesContinuous deployment of puppet modules
Continuous deployment of puppet modulesWilliam O'Neill
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Simon McCartney
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful developmentConnor McDonald
 
Replication Tips & Tricks
Replication Tips & TricksReplication Tips & Tricks
Replication Tips & TricksMats Kindahl
 
Building and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning CBuilding and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning CDavid Wheeler
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet
 
Scala and Hadoop @ eBay
Scala and Hadoop @ eBayScala and Hadoop @ eBay
Scala and Hadoop @ eBayebaynyc
 

Ähnlich wie MySQL Replication: Demo Réplica en Español (20)

Go Replicator
Go ReplicatorGo Replicator
Go Replicator
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
Asterisk_MySQL_Cluster_Presentation.pdf
Asterisk_MySQL_Cluster_Presentation.pdfAsterisk_MySQL_Cluster_Presentation.pdf
Asterisk_MySQL_Cluster_Presentation.pdf
 
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
 
Stacki - The1600+ Server Journey
Stacki - The1600+ Server JourneyStacki - The1600+ Server Journey
Stacki - The1600+ Server Journey
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
Sending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old schoolSending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old school
 
MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016
 
Basic Knowledge on MySql Replication
Basic Knowledge on MySql ReplicationBasic Knowledge on MySql Replication
Basic Knowledge on MySql Replication
 
Continuous deployment of puppet modules
Continuous deployment of puppet modulesContinuous deployment of puppet modules
Continuous deployment of puppet modules
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful development
 
Replication Tips & Tricks
Replication Tips & TricksReplication Tips & Tricks
Replication Tips & Tricks
 
Building and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning CBuilding and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning C
 
Node.js - A Quick Tour
Node.js - A Quick TourNode.js - A Quick Tour
Node.js - A Quick Tour
 
Mysql S&M
Mysql S&MMysql S&M
Mysql S&M
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Scala and Hadoop @ eBay
Scala and Hadoop @ eBayScala and Hadoop @ eBay
Scala and Hadoop @ eBay
 
Chef solo the beginning
Chef solo the beginning Chef solo the beginning
Chef solo the beginning
 

Mehr von Keith Hollman

MySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR ScenariosMySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR ScenariosKeith Hollman
 
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...Keith Hollman
 
MySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & DemoMySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & DemoKeith Hollman
 
MySQL Technology Overview
MySQL Technology OverviewMySQL Technology Overview
MySQL Technology OverviewKeith Hollman
 
MySQL 8.0 Released Update
MySQL 8.0 Released UpdateMySQL 8.0 Released Update
MySQL 8.0 Released UpdateKeith Hollman
 
MySQL Enterprise Edition - Complete Guide (2019)
MySQL Enterprise Edition - Complete Guide (2019)MySQL Enterprise Edition - Complete Guide (2019)
MySQL Enterprise Edition - Complete Guide (2019)Keith Hollman
 
MySQL 8.0 InnoDB Cluster demo
MySQL 8.0 InnoDB Cluster demoMySQL 8.0 InnoDB Cluster demo
MySQL 8.0 InnoDB Cluster demoKeith Hollman
 
MySQL NoSQL JSON JS Python "Document Store" demo
MySQL NoSQL JSON JS Python "Document Store" demoMySQL NoSQL JSON JS Python "Document Store" demo
MySQL NoSQL JSON JS Python "Document Store" demoKeith Hollman
 
MySQL Cluster: El ‘qué’ y el ‘cómo’.
MySQL Cluster: El ‘qué’ y el ‘cómo’.MySQL Cluster: El ‘qué’ y el ‘cómo’.
MySQL Cluster: El ‘qué’ y el ‘cómo’.Keith Hollman
 
MySQL Una Introduccion Tecnica
MySQL Una Introduccion TecnicaMySQL Una Introduccion Tecnica
MySQL Una Introduccion TecnicaKeith Hollman
 
A MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole CrossoverA MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole CrossoverKeith Hollman
 

Mehr von Keith Hollman (11)

MySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR ScenariosMySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR Scenarios
 
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
 
MySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & DemoMySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & Demo
 
MySQL Technology Overview
MySQL Technology OverviewMySQL Technology Overview
MySQL Technology Overview
 
MySQL 8.0 Released Update
MySQL 8.0 Released UpdateMySQL 8.0 Released Update
MySQL 8.0 Released Update
 
MySQL Enterprise Edition - Complete Guide (2019)
MySQL Enterprise Edition - Complete Guide (2019)MySQL Enterprise Edition - Complete Guide (2019)
MySQL Enterprise Edition - Complete Guide (2019)
 
MySQL 8.0 InnoDB Cluster demo
MySQL 8.0 InnoDB Cluster demoMySQL 8.0 InnoDB Cluster demo
MySQL 8.0 InnoDB Cluster demo
 
MySQL NoSQL JSON JS Python "Document Store" demo
MySQL NoSQL JSON JS Python "Document Store" demoMySQL NoSQL JSON JS Python "Document Store" demo
MySQL NoSQL JSON JS Python "Document Store" demo
 
MySQL Cluster: El ‘qué’ y el ‘cómo’.
MySQL Cluster: El ‘qué’ y el ‘cómo’.MySQL Cluster: El ‘qué’ y el ‘cómo’.
MySQL Cluster: El ‘qué’ y el ‘cómo’.
 
MySQL Una Introduccion Tecnica
MySQL Una Introduccion TecnicaMySQL Una Introduccion Tecnica
MySQL Una Introduccion Tecnica
 
A MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole CrossoverA MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole Crossover
 

Kürzlich hochgeladen

Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 

Kürzlich hochgeladen (20)

Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 

MySQL Replication: Demo Réplica en Español

  • 1. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.1
  • 2. Demo: Replica Keith Hollman MySQL Principal Sales Consultant
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3 El entorno de réplica  1x Master & 1x esclavo  Mismo host / servidor  Mismo instalación de software / binarios.  Puertos & rutas diferentes (3306 & 3307)  Réplica asíncrona.
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4 Master - esclavo  Creamos una instancia ‘master’: cd /usr/local/mysql cp my.cnf my3306.cnf  Añadimos una parametrización más ideal para réplica (my3306.cnf) Preparación server-id =6 log-slave-updates =TRUE gtid-mode =ON enforce-gtid-consistency =TRUE master-info-repository =TABLE relay-log-info-repository =TABLE sync_binlog =1 sync_master_info =1 slave-parallel-workers =2 slave_transaction_retries =0 binlog-checksum =CRC32 master-verify-checksum =1 slave-sql-verify-checksum =1 binlog-rows-query-log-events =1 report-port =3306 log-bin =khollman_3306 binlog_format =ROW report-host =khollman_es
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5 Master - esclavo  Usando los valores específicos para este entorno, para asegurar que es único y no sobrescribimos nada: port = 3306 datadir = /opt/mysql/3306/data socket = /tmp/mysql_3306.sock server-id = 6 mkdir -p /opt/mysql/3306/data alias mysql3306='/usr/local/mysql/bin/mysql -uroot -poracle -S /tmp/mysql_3306.sock' Preparación II
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6 Master - esclavo  Instanciando los directorios: pwd = /usr/local/mysql scripts/mysql_install_db --defaults-file=/usr/local/mysql/my3306.cnf --user=mysql --datadir=/opt/mysql/3306/data  Lo arrancamos: bin/mysqld_safe --defaults-file=/usr/local/mysql/my3306.cnf --user=mysql --datadir=/opt/mysql/3306/data &  Ahora, alguna buena práctica de seguridad: ./bin/mysqladmin -u root password 'oracle' -S /tmp/mysql_3306.sock Creando la instancia
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7 Master - esclavo  Creamos algún dato para replicar: create database nexus; use nexus source /home/mysql/cre_tab_replicant.sql; source /home/mysql/insert_nexus.sql select `First Name`, `Last Name`, `Replicant` from replicant;  Y el usuario que se conectará del esclavo al master para traerse los datos: grant REPLICATION SLAVE on *.* to 'replicant'@'127.0.0.1' identified by 'pkdick' ; Poblamos una base de datos. create table replicant ( `Title` enum('Mr','Mrs','Miss','Ms','M.') not null default 'M.', `First name` varchar(40) not null default '', `Middle name` varchar(40) not null default '', `Last name` varchar(40) not null default '', `Replicant` enum('Yes','No') not null default 'Yes' ) engine=InnoDB; insert into `replicant` (`First name`,`Last name`,`Replicant`) VALUES ('Roy','Hauer','Yes'), ('Rutger','Batty','Yes'), ('Voight','Kampff','Yes'), ('Pris','Hannah','Yes'), ('Daryl','Stratton','Yes'), ('Rachael','Young','Yes'), ('Sean','Tyrell','Yes'), ('Rick','Ford','No'), ('Harrison','Deckard','Yes');
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8 Master - esclavo  Sacamos una imagen consistente de los datos a replicar: FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS; /usr/local/mysql/bin/mysqldump -uroot -poracle -S /tmp/mysql_3306.sock --set-gtid-purged=OFF --master-data=2 -B nexus > /home/mysql/nexus.sql unlock tables; Exportando los datos
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9 Creando el esclavo  Es hora de crear el esclavo (3307). alias mysql3307='/usr/local/mysql/bin/mysql -uroot -poracle -S /tmp/mysql_3307.sock‘ prompt slave: R:m d>_ cd /usr/local/mysql cp my3306.cnf my3307.cnf :1,$ s/3306/3307/g  Cambiamos: port, datadir, socket & server-id. mkdir -p /opt/mysql/3307/data Preparación, otra vez.
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10 Creando el esclavo  Creamos la instancia: scripts/mysql_install_db --defaults-file=/usr/local/mysql/my3307.cnf --user=mysql --datadir=/opt/mysql/3307/data  Arrancamos el esclavo: bin/mysqld_safe --defaults-file=/usr/local/mysql/my3307.cnf --user=mysql --datadir=/opt/mysql/3307/data &  Ahora, alguna buena práctica de seguridad: ./bin/mysqladmin -u root password 'oracle' -S /tmp/mysql_3307.sock Preparación, otra vez II
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11 Creando el esclavo  Comprobamos la conexión remota, del futuro esclavo al master: bin/mysql -ureplicant -ppkdick -h127.0.0.1 -P3306 -e status  Insertar / cargar los datos previamente exportados: bin/mysql -uroot -poracle -h127.0.0.1 -P3307 < /home/mysql/nexus.sql  Comprobamos: bin/mysql -uroot -poracle -h127.0.0.1 -P3307 nexus select `First Name`, `Last Name`, `Replicant` from replicant; Preparación, otra vez III
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12 Replicando show slave status G  Nada. Bien.  Le decimos al esclavo cual va a ser su master: change master to master_host='127.0.0.1', master_port=3306, master_user='replicant', master_password='pkdick', master_auto_position=1 ; start slave;  Comprobamos: show slave status G Comenzamos a replicar
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13 Replicando  Ver los errores, debido a las entradas en el bin-log. El "IO Thread" está ok, pero el "SQL Thread" está parado. drop database nexus; start slave sql_thread; show slave status G  En el esclavo, 3307, creamos el usuario de réplica, por si en el futuro queremos hacer switchover / failover: grant REPLICATION SLAVE on *.* to 'replicant'@'127.0.0.1' identified by 'pkdick' ; Comenzamos a replicar II
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14 Replicando  Vamos a comprobar si funciona. En el master: bin/mysql -uroot -poracle -h127.0.0.1 -P3306 nexus show slave hosts; insert into replicant (`First Name`,`Last Name`,`Replicant`) values ('Ridley', 'Tyrell','No'), ('Eldon','Scott', 'No'); select `First Name`, `Last Name`, `Replicant` from replicant;  Ver el esclavo: bin/mysql -uroot -poracle -h127.0.0.1 -P3307 nexus show slave status G use nexus; select `First Name`, `Last Name`, `Replicant` from replicant; Comprobamos  prompt master: R:m d>_  prompt slave: R:m d>_
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15 Referencias  MySQL Réplica tutorial: http://www.mysql.com/why-mysql/white-papers/mysql-replication-tutorial/  Introducción a réplica http://www.mysql.com/why-mysql/white-papers/mysql-replication-introduction/
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16 Questions?
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.17
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18