0
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.1
Demo: Utilities
Keith Hollman
MySQL Principal Sales Consultant
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3
Demo: Utilities
cd /usr/local
tar zxvf /media/sf_sw/...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4
Demo: Utilities
cd /usr/local
tar zxvf /media/sf_sw/...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5
MySQL Utilities
mysqlrplcheck --master=root:oracle@1...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6
MySQL Utilities
 Arranca la instancia 3306:
mysqlre...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7
MySQL Utilities
 Primero, reseteamos las 2 instanci...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8
MySQL Utilities
 Para MULTISOURCE añademos:
my3308....
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9
Creando el esclavo
 Creamos la instancia:
scripts/m...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10
Poblamos los masters
mysql –uroot –poracle –S /tmp/...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11
Poblamos los masters
 Y ahora montamos el multisou...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12
Multi-source
mysql3308
select `First Name`, `Last N...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13
Questions?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15
Upcoming SlideShare
Loading in...5
×

MySQL Utilities: ejemplos técnicos de como usar las Utilities en un entorno Réplica

272

Published on

Unos ejemplos de como instalar y usar las MySQL Utilities sobre un entorno de réplica. Incluye un ejemplo de convertir un master-esclavo en una réplica multi-source.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
272
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "MySQL Utilities: ejemplos técnicos de como usar las Utilities en un entorno Réplica"

  1. 1. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.1
  2. 2. Demo: Utilities Keith Hollman MySQL Principal Sales Consultant
  3. 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3 Demo: Utilities cd /usr/local tar zxvf /media/sf_sw/Utilities/mysql-connector-python-1.0.12.tar.gz cd mysql-connector-python-1.0.12  Comprobamos quepython está todo ok: python >>> from distutils.sysconfig import get_python_lib >>> print get_python_lib() /usr/lib/python2.6/site-packages >>> print (get_python_lib()) /usr/lib/python2.6/site-packages >>> quit()  python setup.py install 1. Instalando el Connector/python
  4. 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4 Demo: Utilities cd /usr/local tar zxvf /media/sf_sw/Utilities/mysql-utilities-1.3.5_Linux.tar.gz cd mysql-utilities-1.3.5 python ./setup.py build python ./setup.py install  ¡A funcionar! $ mysqluc Launching console ... mysqluc> help utilities 2. Instalando las Utilities Welcome to the MySQL Utilities Client (mysqluc) version 1.4.3 Copyright (c) 2010, 2014 Oracle and/or its affiliates. All rights reserved. …
  5. 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5 MySQL Utilities mysqlrplcheck --master=root:oracle@127.0.0.1:3306 --slave=root:oracle@localhost:3307 -s mysqlrpladmin health --master=root:oracle@127.0.0.1:3306 --slaves=root:oracle@127.0.0.1:3307 mysqlrplshow --master=root:oracle@127.0.0.1:3306 -p -l --discover-slaves-login=root:oracle mysqlfailover --master=root:oracle@127.0.0.1:3306 --log=utilfailover.log --discover-slaves-login=root:oracle --force --failover-mode=auto  Mata el proceso mysqld de la instancia 3306. Usando el entorno de réplica…
  6. 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6 MySQL Utilities  Arranca la instancia 3306: mysqlreplicate --master=root:oracle@127.0.0.1:3306 --slave=root:oracle@localhost:3307 --rpl-user=replicant:pkdick –vvv  Para cuando queremos cortar el master para cuestiones de mantenimiento y promocionar el esclavo a master: mysqlrpladmin switchover --master=root:oracle@127.0.0.1:3306 --new-master=root:oracle@127.0.0.1:3307 --discover-slaves-login=root:oracle --force Usando el entorno de réplica… II
  7. 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7 MySQL Utilities  Primero, reseteamos las 2 instancias que tenemos, 3306 & 3307: bin/mysql -uroot -poracle -h127.0.0.1 -P3306 reset master; reset slave; bin/mysql -uroot -poracle -h127.0.0.1 -P3307 reset master; reset slave;  Luego, creamos un esclavo 3308: cd /usr/local/mysql cp my3306.cnf my3308.cnf :1,$ s/3306/3308/g  Cambiamos: port, datadir, socket & server-id. Multi-source: 2 masters y 1 esclavo
  8. 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8 MySQL Utilities  Para MULTISOURCE añademos: my3308.cnf: replicate-do-db =nexus06 replicate-do-db =nexus07 replicate-ignore-db =nexus mkdir -p /opt/mysql/3308/data alias mysql3308='/usr/local/mysql/bin/mysql -uroot -poracle -S /tmp/mysql_3308.sock‘ prompt slave: R:m d>_ Multi-source: 2 masters y 1 esclavo
  9. 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9 Creando el esclavo  Creamos la instancia: scripts/mysql_install_db --defaults-file=/usr/local/mysql/my3308.cnf --user=mysql --datadir=/opt/mysql/3308/data  Y arrancamos el esclavo: bin/mysqld_safe --defaults-file=/usr/local/mysql/my3308.cnf --user=mysql --datadir=/opt/mysql/3308/data &  Seguridad por favor: ./bin/mysqladmin -u root password 'oracle' -S /tmp/mysql_3308.sock
  10. 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10 Poblamos los masters mysql –uroot –poracle –S /tmp/mysql_3306.sock nexus06 source /home/mysql/nexus06_cre_tab_replicant.sql source /home/mysql/insert_nexus.sql mysql –uroot –poracle –S /tmp/mysql_3306.sock nexus06 source /home/mysql/nexus07_cre_tab_replicant.sql source /home/mysql/insert_nexus.sql  O: mysqldbcopy --source=root:oracle@127.0.0.1:3306 -- destination=root:oracle@127.0.0.1:3308 nexus06:nexus06 --skip-gtid mysqldbcopy --source=root:oracle@127.0.0.1:3307 -- destination=root:oracle@127.0.0.1:3308 nexus07:nexus07 --skip-gtid Antes de montar el multi-source:
  11. 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11 Poblamos los masters  Y ahora montamos el multisource: mysqlrplms --slave=root:oracle@localhost:3308 --masters=root:oracle@localhost:3306,root:oracle@localhost:3307 mysql3308 show databases; show slave status G  O: mysqlrplms --slave=root:oracle@localhost:3308 --masters=root:oracle@localhost:3306,root:oracle@localhost:3307 --daemon=start --log=/opt/mysql/3308/data/multisource.log tail -100f /opt/mysql/3308/data/multisource.log Antes de montar el multi-source:
  12. 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12 Multi-source mysql3308 select `First Name`, `Last Name`, `Replicant` from nexus06.replicant; select `First Name`, `Last Name`, `Replicant` from nexus07.replicant; mysql3306 nexus06 insert into replicant (`First Name`,`Last Name`,`Replicant`) values ('Ridley', 'Tyrell','No'), ('Eldon','Scott', 'No'); select `First Name`, `Last Name`, `Replicant` from replicant; mysql3307 nexus07 delete from replicant where `First Name` = 'Harrison' and `Replicant` = 'Yes'; select `First Name`, `Last Name`, `Replicant` from replicant; mysql3308 select `First Name`, `Last Name`, `Replicant` from nexus06.replicant; select `First Name`, `Last Name`, `Replicant` from nexus07.replicant; Probémoslo.
  13. 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13 Questions?
  14. 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14
  15. 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×