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

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

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Kürzlich hochgeladen (20)

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

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