1. ******************************************************
MySQL Tutorial (1)
autor: manuel.contreras@oracle.com
Actualización: Noviembre 13, 2014
******************************************************
Pre-requisitos:
Aprovisionamiento de entorno Virtual
1) Descargar e Instalar MySQL Vagrant
https://www.vagrantup.com/downloads.html
2) Descargar box Oracle Linux 6.5
vagrant box add oel65-64 https://storage.us2.oraclecloud.com/v1/istoilis-istoilis/vagrant/oel65-64.box
3) Inicializar VM instance
vagrant init oel65-64
4) Ingresar a consola:
vagrant ssh
Una vez instalado la maquina virtual con Oracle Linux, continuar con la instalación de:
– MySQL Fabric Controller, MySQL Server version 5.6.10 ó superior.
– MySQL Utilities ( mysqlfabric 1.5.2 ) requiere Python 2.6 ó superior ) &
Connector/Python 2.0 ó superior.
Para descargar binarios en:
edelivery.oracle.com ( Registro Trial 30 días )
o bien
http://dev.mysql.com/downloads/ ( Binarios GPL )
************************** Laboratorio 1 *****************************
Instalación MySQL Server 5.6.10+ & MySQL Fabric 1.5
*************************************************************************
1. Instalar MySQL Enterprise Server 5.6.19+
Remover MySQL Community Server
sudo rpm -qa|grep mysql
sudo rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
2. Una vez removido MySQL Community & Libs, continuar instalando MySQL Enterprise
5.6.10 ó superior
sudo rpm -Uvh MySQL-server-advanced-5.6.19-1.el6.x86_64.rpm
sudo rpm -Uvh MySQL-client-advanced-5.6.19-1.el6.x86_64.rpm
sudo chown -R mysql:mysql /var/lib/mysql/
sudo passwd mysql
*** Nota.- Asignar password oracle
sudo /etc/init.d/mysql start
Nota.- visualizar el password asignado por default para root MySQL
sudo cat /root/.mysql_secret
mysql -uroot -p
Enter password:
Nota.- ingresar password indicando en el archivo /root/.mysql_secret
mysql>show schemas;
Nota.- debe mostrar únicamente los schemas de sistema: information_schema, mysql,
performance_schema
sudo mysql_secure_installation
Nota.- Asignar password oracle
2. Instalar MySQL Python Connector
sudo rpm -Uvh mysql-connector-python-2.0.1-1.el6.noarch
3. Instalar MySQL Utilities ( Fabric 1.5 )
sudo rpm -Uvh mysql-utilities-commercial-1.5.2-1.el6.noarch.rpm
sudo rpm -Uvh mysql-utilities-commercial-extra-1.5.2-1.el6.noarch.rpm
sudo vi /etc/mysql/fabric.cfg
Nota.- asignar password oracle en todas la lineas que requiera “password”
************************** Laboratorio 2 *****************************
Configuración MySQL Fabric 1.5
*************************************************************************
1. Configuración Privilegios MySQL Fabric
mysql>GRANT ALL ON fabric.* TO 'fabric'@'localhost' identified by 'oracle';
mysql>GRANT ALL ON *.* TO 'fabric'@'localhost' identified by 'oracle' with grant
option;
mysql>flush privileges;
3. 2. Configurar Backing Store Tables
su – mysql
mysqlfabric manage setup
[INFO] 1414161265.564337 - MainThread - Initializing persister: user (fabric), server
(localhost:3306), database (fabric).
[INFO] 1414161266.288218 - MainThread - Initial password for admin/mysql set
Password set for admin/mysql from configuration file.
[INFO] 1414161266.291762 - MainThread - Password set for admin/mysql from configuration
file.
[INFO] 1414161266.292421 - MainThread - Initial password for admin/xmlrpc set
Password set for admin/xmlrpc from configuration file.
[INFO] 1414161266.295928 - MainThread - Password set for admin/xmlrpc from configuration
file.
Nota.- el comando anterior, crea el schema fabric en el nodo State Store
( Fabric Controller )
Verificar que el schema fabric aparece con el siguiente comando:
mysql -uroot -p -e "show schemas;"
Enter password:
+--------------------+
| Database |
+--------------------+
| information_schema |
| fabric |
| mysql |
| performance_schema |
| test |
+--------------------+
5. 4 2 1.41416e+09 Executing action (_create_group).
5 2 1.41416e+09 Executed action (_create_group).
mysqlfabric group lookup_groups
Fabric UUID: 5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1
group_id description failure_detector master_uuid
----------- ----------- ---------------- ------------------------------------
groupTest None 0 None
En este punto, no hay servers asociados al grupo
6. 4.- Agregar nodos a Grupo
Antes de agregar nodos, el nodo debe cumplir con:
– Tener instalado MySQL 5.6.10 ó superior
Usuario fabric
mysql>GRANT ALL ON fabric.* TO 'fabric'@'localhost' identified by 'oracle';
mysql -uroot -p -S /tmy.
mysql>GRANT ALL ON *.* TO 'fabric'@'localhost' identified by 'oracle' with grant
option;
mysql>flush privileges;
b) Contener un Server UUID único
$DATDIR/auto.cnf
Importante.- el Serer UUID, debe ser un valor único para cada server
mysqlfabric group add groupTest localhost:1300
mysqlfabric group add groupTest localhost:1301
mysqlfabric group lookup_servers groupTest
mysqlfabric group health groupTest
mysqlfabric group promote groupTest
mysqlfabric group lookup_servers groupTest
mysqlfabric group activate ha_group_nombre