Percona and Continuent present: Multi-Data Center MySQL with Continuent Tungsten
Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten Replicator 2.1.1
-
Upload
continuent -
Category
Technology
-
view
266 -
download
0
description
Transcript of Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten Replicator 2.1.1
©Continuent 2013
MySQL Multi-Master Operations Made Simple
Featuring Tungsten Replicator 2.1.1
Giuseppe Maxia, Director of QA - Continuent, IncRobert Hodges, CEO - Continuent, Inc
©Continuent 2013
Introducing Continuent
2
• The leading provider of clustering and replication for open source DBMS
• Our Product: Continuent Tungsten
• Clustering - Commercial-grade HA, performance scaling and data management for MySQL
• Replication - Flexible, high-performance data movement
©Continuent 2013
A Review of Tungsten Replicator
3
©Continuent 2013
Tungsten Replicator Overview
4
Master
(Transactions + Metadata)
Slave
THL
DBMSLogs
Replicator
(Transactions + Metadata)
THLReplicator
Download transactions via network
Apply using JDBC
©Continuent 2013
Master Replication Service
5
Extract Filter Apply
StageExtract Filter Apply
Stage
Pipeline
MySQLMaster
TransactionHistory Log
In-MemoryQueue
Slave ReplicatorsBinlog
tcp/ip
©Continuent 2013
Slave Replication Service
6
Extract Filter Apply
StageExtract Filter Apply
StageExtract Filter Apply
Stage
Pipeline
TransactionHistory Log
In-MemoryQueue
SlaveDBMS
MasterReplicator
tcp/
ip
©Continuent 2013
star
master-slave Heterogeneous
fan-in slave all-masters
MySQL
Oracle
Oracle
MySQL Oracle
Oracle
MySQL MySQL
©Continuent 2013
Tungsten Replicator 2.1.1
8
©Continuent 2013
Tungsten Replicator 2.1.1• Releases as GA on August 21, 2013
• Main features:
• installation with tpm
• security layer
• full support for MySQL 5.6
• improved management tools
• trepctl properties
• trepctl services [-full] [-json]
• trepctl clients
• trepctl status [-json]
• thl list [-headers] [-json]
9
©Continuent 2013
Working with Tungsten
10
©Continuent 2013
Overview of Installation Process
1. Set up hosts
2. Prepare MySQL replicas
3. Download software
4. Install using tungsten-installer & con!gure-service tpm
11
Amazon Setup:https://docs.continuent.com/wiki/display/TEDOC/
Preparing+EC2+Servers
©Continuent 2013
How tungsten-installer Works for Basic Master/Slave Deployment
12
db1
db2
db3
Staging copy of files
check prereqscopy codeconfigure
©Continuent 2013
Tungsten master/slave replication
13
host1 host2
host3
alpha alpha
alpha
THL THL
THL
installer
Old installationand
New installation
©Continuent 2013
Bi-directional replication
14
host1 host2
alphaalpha
bravobravo
Install master on host1
installer
install master on host2
installer
install slave service on host1
installer
install slave service on host2
installer
OLD INSTALLATION
©Continuent 2013
Bi-directional replication
15
host1 host2
alphaalpha
bravobravo
NEW INSTALLATION
Install all master and slave services on all hosts at once
installer
©Continuent 2013 16
./tools/tungsten-installer --master-slave --master-host=$MASTER2 --datasource-user=tungsten --datasource-password=secret --service-name=bravo --home-directory=$TUNGSTEN_HOME --cluster-hosts=$MASTER2 --start
$TUNGSTEN_HOME/tungsten/tools/configure-service -C --quiet --host=$MASTER1 --datasource=$MASTER1 --local-service-name=alpha --role=slave --service-type=remote --release-directory=$TUNGSTEN_HOME/tungsten --skip-validation-check=THLStorageCheck --master-thl-host=$MASTER2 --master-thl-port=2112 --svc-start bravo
./tools/tungsten-installer --master-slave --master-host=$MASTER1 --datasource-user=tungsten --datasource-password=secret --service-name=alpha --home-directory=$TUNGSTEN_HOME --cluster-hosts=$MASTER1 --start
$TUNGSTEN_HOME/tungsten/tools/configure-service -C --quiet --host=$MASTER2 --datasource=$MASTER2 --local-service-name=bravo --role=slave --service-type=remote --release-directory=$TUNGSTEN_HOME/tungsten --skip-validation-check=THLStorageCheck --master-thl-host=$MASTER1 --master-thl-port=2112 --svc-start alpha
1 2
3
4
Multi-master installation(2 nodes) until TR 2.1.0
~ 3 minutes
using tungsten-installer
©Continuent 2013
4 nodes all-masters
17
host1
host4
host2
host3
alphaalpha
bravobravo
charlie
charlie
delta
delta
bravobravo
alpha
delta
delta
charlie
charlie
alpha
©Continuent 2013 18
Multi-master installation(4 nodes) until TR 2.1.0
~ 8 minutes
tungsten-installerhost1 - alpha 1
tungsten-installerhost2 - bravo 2
tungsten-installerhost3 - charlie 3
tungsten-installerhost4 - delta 4
con!gure-servicehost1 - bravo 5
con!gure-servicehost1 - charlie 6
con!gure-servicehost1 - delta 7
con!gure-servicehost2 - alpha 8
con!gure-servicehost2 - charlie 9
con!gure-servicehost2 - delta 10
con!gure-servicehost3 - alpha 11
con!gure-servicehost3 - bravo 12
con!gure-servicehost3 - delta 13
con!gure-servicehost4 - alpha 14
con!gure-servicehost4 - bravo 15
con!gure-servicehost4 - charlie 16
using tungsten-installer
©Continuent 2013 19
./tools/tpm install my_cluster \ --topology=all-masters \ --home-directory=$TUNGSTEN_HOME \ --replication-user=tungsten \ --replication-password=secret \ --masters=host1,host2 \ --master-services=alpha,bravo \ --start
Multi-master installation(2 nodes) with TR 2.1.1
~ 40 seconds
using tpm
©Continuent 2013 20
./tools/tpm install my_cluster \ --topology=all-masters \ --home-directory=$TUNGSTEN_HOME \ --replication-user=tungsten \ --replication-password=secret \ --masters=host1,host2,host3,host4 \ --master-services=alpha,bravo,charlie,delta \ --start
Multi-master installation(4 nodes) with TR 2.1.1
~ 45 seconds
using tpm
©Continuent 2013
One more reason why tpm is better
• Security:
• all data in transit (transaction history logs, or THL) is encrypted using SSL
• all administrative tra"c is encrypted with SSL
• Transparent to the user
• Independent of the database server (works also for heterogeneous replication)
21
©Continuent 2013
Tungsten replicator without security
22
replicatorservices
host1
host4
host2
host3
alpha
alpha
alpha alpha
master
slave
THL
THL
THLTHL
plain text
©Continuent 2013
Tungsten Replicator with security
23
replicatorservices
host1
host4
host2
host3
alpha
alpha
alpha alpha
master
slave
THL
THL
THLTHL
SSL
SSL SSL
SSL
©Continuent 2013
Installing with security1: create keys
24
./cookbook/create-security-keys HarryPotter
...
...# Options for tpm (stored in ./cookbook/security.options) --thl-ssl=true \ --rmi-ssl=true \ --rmi-authentication=true \ --rmi-user=cookbook \ --java-keystore-password=HarryPotter \ --java-truststore-password=HarryPotter \ --java-truststore-path=$PWD/cookbook/truststore.ts \ --java-keystore-path=$PWD/cookbook/keystore.jks \ --java-jmxremote-access-path=$PWD/cookbook/jmxremote.access \ --java-passwordstore-path=$PWD/cookbook/passwords.store
©Continuent 2013
Installing with security - 2: run tpm
25
./tools/tpm install alpha \ --topology=master-slave \ --home-directory=/opt/continuent/replicator \ --replication-user=tungsten \ --replication-password=secret \ --master=host1 \ --slaves=host2,host3,host4 \ $(cat ./cookbook/security.options) \ --start
./tools/tpm install my_cluster \ --topology=all-masters \ --home-directory=$TUNGSTEN_HOME \ --replication-user=tungsten \ --replication-password=secret \ --masters=host1,host2,host3,host4 \ $(cat ./cookbook/security.options) \ --master-services=alpha,bravo,charlie,delta \ --start
©Continuent 2013
Demo : security
26
©Continuent 2013
Advanced Installation using Cookbook
27
©Continuent 2013
Installing Master/Slave Replication ...
28
./cookbook/install_master_slave
host1 host2
host3
alpha alpha
alpha
THL THL
THL
©Continuent 2013
master/slave using tpm
29
./tools/tpm install alpha \ --topology=master-slave \ --home-directory=/opt/continuent/replicator \ --replication-user=tungsten \ --replication-password=secret \ --master=host1 \ --slaves=host2,host3,host4 \ --start
©Continuent 2013
Installing Fan-In Replication
30
./cookbook/install_fan_in
host1
host4
host2
host3
alphabravo
charliebravo
charlie
alpha
©Continuent 2013
fan-in using tpm
31
./tools/tpm install many_towns \ --replication-user=tungsten \ --replication-password=secret \ --home-directory=/opt/continuent/replication \ --masters=host1,host2,host3 \ --slaves=host4 \ --master-services=alpha,bravo,charlie \ --topology=fan-in \ --start
©Continuent 2013
Install Multi-Master replication
32
./cookbook/install_all_masters
host1 host2
alphaalpha
bravobravo
©Continuent 2013
multi-master using tpm
33
../tools/tpm install musketeers \ --reset \ --topology=all-masters \ --home-directory=/opt/continuent/replicator \ --replication-user=tungsten \ --replication-password=secret \ --masters=host1,host2 \ --master-services=alpha,bravo \ --start
©Continuent 2013
Extend multi-master-replication
34
host1 host2
alphaalpha
bravobravo
host1 host2
host3
alphaalpha
bravobravo
charlie
charlie
bravo
alpha
charlie
©Continuent 2013
extending multi-master (1:install)
35
../tools/tpm install musketeers \ --reset \ --topology=all-masters \ --home-directory=/opt/continuent/replicator \ --replication-user=tungsten \ --replication-password=secret \ --masters=host1,host2 \ --master-services=alpha,bravo \ --start
©Continuent 2013
extending multi-master (2: add a node)
36
./tools/tpm configure musketeers \ --topology=all-masters \ --home-directory=/opt/continuent/replicator \ --replication-user=tungsten \ --replication-password=secret \ --masters=host1,host2,host3 \ --master-services=alpha,bravo,charlie \ --start
./tools/tpm update
©Continuent 2013
Extending further ...
37
host1
host4
host2
host3
alphaalpha
bravobravo
charlie
charlie
delta
delta
bravobravo
alpha
delta
delta
charlie
charlie
alpha
host1 host2
host3
alphaalpha
bravobravo
charlie
charlie
bravo
alpha
charlie
©Continuent 2013
extending multi-master (3: add one more node)
38
./tools/tpm configure musketeers \ --topology=all-masters \ --home-directory=/opt/continuent/replicator \ --replication-user=tungsten \ --replication-password=secret \ --masters=host1,host2,host3,host4 \ --master-services=alpha,bravo,charlie,delta \ --start
./tools/tpm update
©Continuent 2013
Install a Star Topology
39
./cookbook/install_star
host1
host4
host2
host3
alpha
bravo
charlie
charlie
delta
bravo
alpha
delta
charlie
charlie
hub
©Continuent 2013
star using tpm
40
./tools/tpm install constellation \ --replication-user=tungsten \ --replication-password=secret \ --home-directory=/opt/continuent/replication \ --masters=host1,host2,host4 \ --hub=host3 \ --hub-service=charlie \ --master-services=alpha,bravo,delta \ --topology=star \ --start
©Continuent 2012.
More complex topologies
41
©Continuent 2013
all-masters with attached slaves
42
host1
host4
host2
host3
alphaalpha
bravobravo
bravo
alpha
data from goes to
host1 host2,host3
host2 host1,host4
©Continuent 2013
all-masters with attached slaves
43
host1
host4
host2
host3
alphaalpha
bravobravo
charlie
charlie
delta
delta
bravobravo
alpha
delta
delta
charlie
charlie
alpha
host6host5 deltacharlie
data from goes tohost1 host2,host3,host4host2 host1,host3,host4host3 host1,host2,host4,host5host4 host1,host2,host3,host6
©Continuent 2013
four all-masters with attached slaves1: con!gure defaults
44
#1./tools/tpm configure defaults \ --reset \ --replication-user=tungsten \ --replication-password=secret \ --home-directory=/home/tungsten/installs/cookbook \ --start
©Continuent 2013
four all-masters with attached slaves2: con!gure main all-masters
45
#2./tools/tpm configure four_musketeers \ --masters=host1,host2,host3,host4 \ --master-services=alpha,bravo,charlie,delta \ --topology=all-masters
©Continuent 2013
four all-masters with attached slaves3: con!gure !rst slave
46
#3./tools/tpm configure charlie \ --hosts=host3,host5 \ --slaves=host5 \ --master=host3
©Continuent 2013
four all-masters with attached slaves4: con!gure second slave
47
#4./tools/tpm configure delta \ --hosts=host4,host6 \ --slaves=host6 \ --master=host4
#5./tools/tpm install
©Continuent 2013
four all-masters with attached slaves5: !nal step: install
48
#5./tools/tpm install
©Continuent 2013
all-masters with attached mongoDB slave
49
host1
host4
host2
host3
alphaalpha
bravobravo
charlie
charlie
delta
delta
bravobravo
alpha
delta
delta
charlie
charlie
alpha
host5 alpha
©Continuent 2013
all-masters with mongodb slave1: install masters with heterogeneous options
50
./tools/tpm configure all_masters \ --reset \ --log=timestamp \ --replication-port=3306 \ --replication-user=tungsten \ --replication-password=secret \ --home-directory=/home/tungsten/installs/cookbook \ --repl-disable-relay-logs=true -a \ --masters=ubuntu1,ubuntu2,ubuntu3,ubuntu4 \ --master-services=alpha,bravo,charlie,delta \ --topology=all-masters \ --java-file-encoding=UTF8 \ --mysql-use-bytes-for-string=false \ --mysql-enable-enumtostring=true \ --mysql-enable-settostring=true \ --svc-extractor-filters=colnames,pkey --start-and-report
©Continuent 2013
all-masters with mongodb slave2: add mongodb slave and install
51
./tools/tpm configure alpha \ --datasource-type=mongodb \ --hosts=host1 \ --master=ubuntu1 \ --replication-port=6700 \ --home-directory=~/deploy/mongodb \ --slaves=host1 \ --role=slave \ --master-thl-port=2112 \ --thl-port=2113 \ --rmi-port=10100 --start-and-report
./tools/tpm install --verbose
©Continuent 2013
DEMO:multi master installation
52
©Continuent 2012.
Overview of Tungsten Cookbook
53
©Continuent 2013
Tungsten Cookbook
tungsten-replicator-2.1.1-230 | +--/cluster-home +--/cookbook +--/tools +--/tungsten-replicator
54
©Continuent 2013
Tungsten Cookbook
tungsten-replicator-2.1.1-230 | +--/cookbook | +--COMMON_NODES.sh +--USER_VALUES.sh +--show_cluster +--test_cluster +--clear_cluster...
55
©Continuent 2013
Tungsten Cookbook
$ cat COMMON_NODES.sh
export NODE1=host1export NODE2=host2export NODE3=host3export NODE4=host4
56
©Continuent 2013
Tungsten Cookbook
$ cat USER_VALUES.sh# User defined values for the cluster to be installed.
export TUNGSTEN_BASE=$HOME/installs/cookbookexport DATABASE_USER=tungstenexport BINLOG_DIRECTORY=/var/lib/mysqlexport MY_CNF=/etc/my.cnfexport DATABASE_PASSWORD=secretexport DATABASE_PORT=3306export TUNGSTEN_SERVICE=cookbookexport RMI_PORT=10000export THL_PORT=2112export START_OPTION=start
57
©Continuent 2013
Sample all-masters Installation
• edit cookbook/COMMON_NODES.sh
• edit cookbook/USER_VALUES.sh
• run cookbook/install_all_masters
• and then:
• run cookbook/show_cluster
• run cookbook/test_cluster
58
©Continuent 2013
DEMO:cookbook main tools
* show status* show logs* edit con!guration* show services
59
©Continuent 2013
Joining the Community
60
©Continuent 2013
Tungsten Replicator is Open Source
61
• Project home:
http://code.google.com/p/tungsten-replicator/
• Log bugs, !nd builds, post in replicator discussion group
• Documentation:
https://docs.continuent.com/wiki/display/TEDOC/Tungsten+Documentation+Home
©Continuent 2013
Wrapping Up
62
©Continuent 2013
Tungsten University Sessions
63
• Con!gure & Provision Tungsten Clusters- Thursday September 5th- Tuesday September 10th
• Setup & Operate Tungsten Replicator- Thursday October 17th- Tuesday October 22nd
• Send any feedback to: [email protected]
©Continuent 2012.
Continuent Web Page:http://www.continuent.com
Tungsten Replicator 2.1.1:http://code.google.com/p/tungsten-replicator
Our Blogs:http://scale-out-blog.blogspot.comhttp://datacharmer.blogspot.comhttp://www.continuent.com/news/blogs
560 S. Winchester Blvd., Suite 500 San Jose, CA 95128 Tel +1 (866) 998-3642 Fax +1 (408) 668-1009e-mail: [email protected]