Managing and Visualizing your Replication Topologies with Orchestrator
Tungsten University: Set Up And Manage Advanced Replication Topologies
-
Upload
continuent -
Category
Technology
-
view
470 -
download
2
description
Transcript of Tungsten University: Set Up And Manage Advanced Replication Topologies
©Continuent 2013
Tungsten University: Set Up and Manage
Advanced Replication Topologies Robert Hodges, CEO
Giuseppe Maxia, Director of QA
©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
Overview of Installation Process
1. Set up hosts
2. Prepare MySQL replicas
3. Download software
4. Install using tungsten-installer & con"gure-service
7
Amazon Setup:https://docs.continuent.com/wiki/display/TEDOC/
Preparing+EC2+Servers
©Continuent 2013
How tungsten-installer Works for Basic Master/Slave Deployment
8
db1
db2
db3
Staging copy of files
check prereqscopy codeconfigure
©Continuent 2013
From Master/Slave Replication ...
9
db1Replicator
db3
Service alpha
db2
Replicator
Service alpha
Replicator
Service alpha
Install master and slaves on the whole cluster
tungsten-installertungsten-installertungsten-installer
©Continuent 2013
To Multi-Master
10
db1 Replicator
Service alpha
Service bravo
db2Replicator
Service bravo
Service alpha
Install master on db1
tungsten-installer
install master on db2
tungsten-installer
install slave service on db1
con!gure-service
install slave service on db2
con!gure-service
©Continuent 2013
tungsten-installer master 1
11
TUNGSTEN_HOME=/home/tungsten/installs/cookbook
./tools/tungsten-installer --master-slave --master-host=$MASTER1 --datasource-port=3306 --datasource-user=tungsten --datasource-password=secret --datasource-log-directory=/var/lib/mysql --service-name=alpha --home-directory=$TUNGSTEN_HOME --cluster-hosts=$MASTER1 --start
creating service 'alpha'Notice: --cluster-hosts has only one host
©Continuent 2013
tungsten-installer master 2
12
TUNGSTEN_HOME=/home/tungsten/installs/cookbook
./tools/tungsten-installer --master-slave --master-host=$MASTER2 --datasource-port=3306 --datasource-user=tungsten --datasource-password=secret --datasource-log-directory=/var/lib/mysql --service-name=bravo --home-directory=$TUNGSTEN_HOME --cluster-hosts=$MASTER2 --start
creating service 'bravo'Notice: --cluster-hosts has only one host
©Continuent 2013
Con"gure Service master 1
13
TUNGSTEN_HOME=/home/tungsten/installs/cookbook
$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
Notice: bravo is the master service in host 2
©Continuent 2013
Con"gure Service master 2
14
TUNGSTEN_HOME=/home/tungsten/installs/cookbook
$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
Notice: alpha is the master service in host 1
©Continuent 2013
Advanced Installation using Cookbooks
15
©Continuent 2013
From Master/Slave Replication ...
16
db1Replicator
db3
Service db1
db2
Replicator
Service db1
Replicator
Service db1
./cooobook/install_master_slave.sh
©Continuent 2013
How Do I Install Fan-In Replication?
17
db1Replicator
db3
Service db1
db2Replicator
Service db2
Replicator
Service db1
Service db2
./cooobook/install_fan_in.sh
©Continuent 2013
How Do I Install Multi-Master?
18
db1 Replicator
Service db1
Service db2
db2
Replicator
Service db1
Service db2
./cooobook/install_all_masters.sh
©Continuent 2013
How Do I Extend Multi-Master?
19
db1 Replicator
Service db1
Service db2
Service db3db3
Service db1
Service db2
Service db3db2
Replicator
Service db1
Service db2
Service db3
Replicator
©Continuent 2013
How Do I Extend Multi-Master?
20
db1 db3Service db1
Service db2
Service db3
db2
Replicator
db4Service db1
Service db2
Service db4
Replicator
Service db3
Service db4
Service db1
Service db2
Service db3
Replicator
Service db4
Service db1
Service db2
Service db3
Replicator
Service db4
©Continuent 2013
How Do I Install a Star Topology?
21
db1Replicator
Service db1
Service db3db3
Service db1
Service db2
Service db3db2
Replicator
Service db2
Service db3
HUB
Replicator
./cooobook/install_star.sh
©Continuent 2013
How Do I Extend a Star Topology?
22
db1Replicator
Service db1
Service db3db3Service db1
Service db2
Service db3
db2Replicator
Service db2
Service db3
db4
Replicator
Service db3
Service db4
HUB
Service db4
©Continuent 2013
How Do I Extend a Star Topology?
23
db1Replicator
Service db1
Service db3db3Service db1
Service db2
Service db3
db2Replicator
Service db2
Service db3
db4
Replicator
Service db3
Service db4
HUB
Service db4
db5
Replicator
Service db5
Service db3
Service db5
©Continuent 2012.
Overview of Tungsten Cookbook
24
©Continuent 2013
Tungsten Cookbook
tungsten-replicator-2.0.7-278 | +--/cluster-home +--/cookbook +--/tools +--/tungsten-replicator
25
©Continuent 2013
Tungsten Cookbook
tungsten-replicator-2.0.7-278 | +--/cookbook | +--COMMON_NODES.sh +--USER_VALUES.sh +--NODES_MASTER_SLAVE.sh +--show_master_slave.sh +--test_master_slave.sh +--clear_cluster_master_slave.sh...
26
©Continuent 2013
Tungsten Cookbook
tungsten-replicator-2.0.7-278 | +--/cookbook | +--COMMON_NODES.sh +--USER_VALUES.sh +--NODES_STAR.sh +--show_star.sh +--test_star.sh +--clear_cluster_star.sh...
27
©Continuent 2013
Tungsten Cookbook
tungsten-replicator-2.0.7-278 | +--/cookbook | +--COMMON_NODES.sh +--USER_VALUES.sh +--NODES_ALL_MASTERS.sh +--show_all_masters.sh +--test_all_masters.sh +--clear_cluster_all_masters.sh...
28
©Continuent 2013
Tungsten Cookbook
tungsten-replicator-2.0.7-278 | +--/cookbook | +--COMMON_NODES.sh +--USER_VALUES.sh +--NODES_FAN_IN.sh +--show_fan_in.sh +--test_fan_in.sh +--clear_cluster_fan_in.sh...
29
©Continuent 2013
Tungsten Cookbook
$ cat COMMON_NODES.sh
export NODE1=host1export NODE2=host2export NODE3=host3export NODE4=host4
30
©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
31
©Continuent 2013
Sample Star Installation
• edit cookbook/COMMON_NODES.sh
• edit cookbook/USER_VALUES.sh
• run cookbook/install_star.sh
• and then:
• run cookbook/show_star.sh
• run cookbook/test_star.sh
32
©Continuent 2013
CONFLICTS
33
©Continuent 2013
Con#ict Handling Strategies• resolving
• after the fact
• Needs information that is missing in async replication
• avoiding
• requires synchronous replication with 2pc
• preventing
• setting and enforcing a split sources policy
• transforming and resolving
• all records are converted to INSERTs
• con"icts are resolved within a given time window
34
available now
planned forfuture
planned forfuture
©Continuent 2012.
Multi-Master:Con#ict Prevention
35
©Continuent 2013
Tungsten Con#ict Prevention Facts
• Sharded by database
• De"ned dynamically
• Applied on the slave services
• methods:
• error: make replication fail
• drop: drop silently
• warn: drop with warning
36
©Continuent 2013
Tungsten Con#ict Prevention Applicability
• unknown shards
• The schema being updated is not planned
• actions: accept, drop, warn, error
• unwanted shards
• the schema is updated from the wrong master
• actions: accept, drop, warn, error
• whitelisted shards
• can be updated by any master
37
©Continuent 2013
Con#ict Prevention Directives
--svc-extractor-filters=shardfilter
replicator.filter.shardfilter.unknownShardPolicy=error
replicator.filter.shardfilter.unwantedShardPolicy=error
replicator.filter.shardfilter.enforceHomes=false
replicator.filter.shardfilter.allowWhitelisted=false
38
©Continuent 2013
Con#ict Prevention in a Star Topology
39
Host1master: alphadatabase: employees
Host2master: bravodatabase: buildings
Host3master: charlie (hub)database: vehicles
A
B
CB
A
C
C
©Continuent 2013
Setting Con#ict Prevention Rules
trepctl -host host1 -service charlie \ shard -insert < shards.map
cat shards.mapshard_id master criticalpersonnel alpha falsebuildings bravo falsevehicles charlie falsetest whitelisted false
# charlie is slave service in host 1
40
©Continuent 2013
Sample Correct Operation (1)
mysql #1> create table employees.names( ... )
# all servers receive the table# all servers keep working well
41
©Continuent 2013
Sample Correct Operation (2)
mysql #2> create table buildings.homes( ... )
# all servers receive the table# all servers keep working well
42
©Continuent 2013
Sample Incorrect Operation (1)
mysql #2> create table employees.nicknames( ... )
# Only server #2 receives the table# slave service in hub gets an error# slave service in #1 does not receive anything
43
©Continuent 2013
Sample Incorrect Operation (2)
#3 $ trepct services | simple_services alpha [slave]seqno: 7 - latency: 0.136 - ONLINE
bravo [slave]seqno: -1 - latency: -1.000 - OFFLINE:ERROR
charlie [master]seqno: 66 - latency: 0.440 - ONLINE
44
©Continuent 2013
Sample Incorrect Operation (3)
#3 $ trepct -service bravo statusNAME VALUE---- -----appliedLastEventId : NONEappliedLastSeqno : -1appliedLatency : -1.0(...)offlineRequests : NONEpendingError : Stage task failed: q-to-dbmspendingErrorCode : NONEpendingErrorEventId : mysql-bin.000002:0000000000001241;0pendingErrorSeqno : 7pendingExceptionMessage: Rejected event from unknown shard: seqno=7 shard ID=employees(...)
45
©Continuent 2013
Fixing the Issue
mysql #1> drop table if exists employees.nicknames;mysql #1> create table if exists employees.nicknames ( ... ) ;
#3 $ trepct -service bravo online -skip-seqno 7
# all servers receive the new table
46
©Continuent 2013
Joining the Community
47
©Continuent 2013
Tungsten Replicator is Open Source
48
• 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
49
©Continuent 2013
Tungsten University Sessions
50
• Zero-Downtime Maintenance And Upgrade- Thursday March 21st- Tuesday March 26th
• Geographically Distributed Tungsten Clusters- Thursday April 11th- Tuesday April 16th
• Replicate Between MySQL And Oracle- Thursday May 2nd- Tuesday May 7th
• Send any feedback to: [email protected]
©Continuent 2012.
Continuent Web Page:http://www.continuent.com
Tungsten Replicator 2.0:http://code.google.com/p/tungsten-replicator
Our Blogs:http://scale-out-blog.blogspot.comhttp://datacharmer.org/bloghttp://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]