10
MySQL replication & cluster by Joeri de Bruin ProcoliX

MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

  • Upload
    dotu

  • View
    223

  • Download
    1

Embed Size (px)

Citation preview

Page 1: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

MySQL replication & cluster

by Joeri de BruinProcoliX

Page 2: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

Single vs Multiple

Multiple MySQL servers means that there are moreMySQL services, this will normaly be on more

servers.

Page 3: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

Why multiple

1. High availability 2. On line backup

Page 4: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

replication vs cluster

Page 5: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

ProcesReplication1. UPDATE on master2. UPDATE written in Binlog3. Binlog is read by slave4. UPDATE on slave

Cluster1. UPDATE on MySQL2. UPDATE written to Cluster filesystem

Page 6: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

Uses

Replication has 1 master and slavesCluster can read and write on all nodes

Page 7: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

Replication quick howto

Procedure:1. Configure master and slave2. Stop MySQL3. Copy data tot slave4. Start MySQL on master5. Start MySQL on slave

[mysqld]server-id=2master-host=db-master.mycompany.commaster-port=3306master-user=gooeymaster-password=octopus

Page 8: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

Cluster quick howto

Procedure:Install MySQL-MAXConfigure clusterConfigure MySQLStart MGM nodeStart ndb deamonStart MySQL

[MYSQLD]ndbclusterndb-connectstring=192.168.0.10

[MYSQL_CLUSTER]ndb-connectstring=192.168.0.10

# file "config.ini"[NDBD DEFAULT]NoOfReplicas= 1MaxNoOfOrderedIndexes=2500MaxNoOfUniqueHashIndexes=2500MaxNoOfAttributes=4000

Page 9: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

MySQL cluster and WebGUI

MySQL cluster uses NDB cluster engine in stead ofMyIsam tables

Alter create.sql to use with MySQL cluster

vi create.sql:0,$s/TYPE=MyISAM/ENGINE=NDBCLUSTER/g

Page 10: MySQLreplication & cluster - · PDF fileProces Replication 1. UPDATE on master 2. UPDATE written in Binlog 3. Binlog is read by slave 4. UPDATE on slave Cluster 1. UPDATE on MySQL

Tips and tricks

Always use the same MySQL versionUse the source: www.mysql.com

Replication:http://dev.mysql.com/doc/mysql/en/replication.html

Cluster:http://dev.mysql.com/doc/mysql/en/multi-computer.html