SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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
 
Stacki - The1600+ Server Journey
Stacki - The1600+ Server JourneyStacki - The1600+ Server Journey
Stacki - The1600+ Server Journey
 
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
 
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
 

Plus de 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
 

Plus de 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
 

Dernier

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 

Dernier (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 

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