Top Banner
©Continuent 2013 Juggle your data with Tungsten Replicator Giuseppe Maxia, Director of QA Continuent, Inc 1 Sunday, September 22, 13
63

Juggle your data with Tungsten Replicator

Nov 07, 2014

Download

Technology

Giuseppe Maxia

Juggle your data in different replication topologies, using Tungsten replicator. Make all-masters, fan-in, star topologies, and more complex ones
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Juggle your data with Tungsten Replicator

©Continuent 2013

Juggle your data with Tungsten Replicator

Giuseppe Maxia, Director of QAContinuent, Inc

1Sunday, September 22, 13

Page 2: Juggle your data with Tungsten Replicator

©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

2Sunday, September 22, 13

Page 3: Juggle your data with Tungsten Replicator

©Continuent 2013

A Review of Tungsten Replicator

3

3Sunday, September 22, 13

Page 4: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten Replicator Overview

4

Master

(Transactions + Metadata)

Slave

THL

DBMSLogs

Replicator

(Transactions + Metadata)

THLReplicator

Download transactions via network

Apply using JDBC

4Sunday, September 22, 13

Page 5: Juggle your data with Tungsten Replicator

©Continuent 2013

Master Replication Service

5

Extract Filter Apply

StageExtract Filter Apply

Stage

Pipeline

MySQLMaster

TransactionHistory Log

In-MemoryQueue

Slave ReplicatorsBinlog

tcp/ip

5Sunday, September 22, 13

Page 6: Juggle your data with Tungsten Replicator

©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

6Sunday, September 22, 13

Page 7: Juggle your data with Tungsten Replicator

©Continuent 2013

star

master-slave Heterogeneous

fan-in slave all-masters

MySQL

Oracle

Oracle

MySQL Oracle

Oracle

MySQL MySQL

7Sunday, September 22, 13

Page 8: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten Replicator 2.1.1

8

8Sunday, September 22, 13

Page 9: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten Replicator 2.1.2• Releases as GA

• 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

9Sunday, September 22, 13

Page 10: Juggle your data with Tungsten Replicator

©Continuent 2013

Working with Tungsten

10

10Sunday, September 22, 13

Page 11: Juggle your data with Tungsten Replicator

©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

11Sunday, September 22, 13

Page 12: Juggle your data with Tungsten Replicator

©Continuent 2013

How tungsten-installer Works for Basic Master/Slave Deployment

12

db1

db2

db3

Staging copy of files

check prereqscopy codeconfigure

12Sunday, September 22, 13

Page 13: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten master/slave replication

13

host1 host2

host3

alpha alpha

alpha

THL THL

THL

installer

Old installationand

New installation

13Sunday, September 22, 13

Page 14: Juggle your data with Tungsten Replicator

©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

14Sunday, September 22, 13

Page 15: Juggle your data with Tungsten Replicator

©Continuent 2013

Bi-directional replication

15

host1 host2

alphaalpha

bravobravo

NEW INSTALLATION

Install all master and slave services on all hosts at once

installer

15Sunday, September 22, 13

Page 16: Juggle your data with Tungsten Replicator

©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

16Sunday, September 22, 13

Page 17: Juggle your data with Tungsten Replicator

©Continuent 2013

4 nodes all-masters

17

host1

host4

host2

host3

alphaalpha

bravobravo

charlie

charlie

delta

delta

bravobravo

alpha

delta

delta

charlie

charlie

alpha

17Sunday, September 22, 13

Page 18: Juggle your data with Tungsten Replicator

©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

18Sunday, September 22, 13

Page 19: Juggle your data with Tungsten Replicator

©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

19Sunday, September 22, 13

Page 20: Juggle your data with Tungsten Replicator

©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

20Sunday, September 22, 13

Page 21: Juggle your data with Tungsten Replicator

©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

21Sunday, September 22, 13

Page 22: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten replicator without security

22

replicatorservices

host1

host4

host2

host3

alpha

alpha

alpha alpha

master

slave

THL

THL

THLTHL

plain text

22Sunday, September 22, 13

Page 23: Juggle your data with Tungsten Replicator

©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

23Sunday, September 22, 13

Page 24: Juggle your data with Tungsten Replicator

©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

24Sunday, September 22, 13

Page 25: Juggle your data with Tungsten Replicator

©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

25Sunday, September 22, 13

Page 26: Juggle your data with Tungsten Replicator

©Continuent 2013

Demo : security

26

26Sunday, September 22, 13

Page 27: Juggle your data with Tungsten Replicator

©Continuent 2013

Advanced Installation using Cookbook

27

27Sunday, September 22, 13

Page 28: Juggle your data with Tungsten Replicator

©Continuent 2013

Installing Master/Slave Replication ...

28

./cookbook/install_master_slave

host1 host2

host3

alpha alpha

alpha

THL THL

THL

28Sunday, September 22, 13

Page 29: Juggle your data with Tungsten Replicator

©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

29Sunday, September 22, 13

Page 30: Juggle your data with Tungsten Replicator

©Continuent 2013

Installing Fan-In Replication

30

./cookbook/install_fan_in

host1

host4

host2

host3

alphabravo

charliebravo

charlie

alpha

30Sunday, September 22, 13

Page 31: Juggle your data with Tungsten Replicator

©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

31Sunday, September 22, 13

Page 32: Juggle your data with Tungsten Replicator

©Continuent 2013

Install Multi-Master replication

32

./cookbook/install_all_masters

host1 host2

alphaalpha

bravobravo

32Sunday, September 22, 13

Page 33: Juggle your data with Tungsten Replicator

©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

33Sunday, September 22, 13

Page 34: Juggle your data with Tungsten Replicator

©Continuent 2013

Extend multi-master-replication

34

host1 host2

alphaalpha

bravobravo

host1 host2

host3

alphaalpha

bravobravo

charlie

charlie

bravo

alpha

charlie

34Sunday, September 22, 13

Page 35: Juggle your data with Tungsten Replicator

©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

35Sunday, September 22, 13

Page 36: Juggle your data with Tungsten Replicator

©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

36Sunday, September 22, 13

Page 37: Juggle your data with Tungsten Replicator

©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

37Sunday, September 22, 13

Page 38: Juggle your data with Tungsten Replicator

©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

38Sunday, September 22, 13

Page 39: Juggle your data with Tungsten Replicator

©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

39Sunday, September 22, 13

Page 40: Juggle your data with Tungsten Replicator

©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

40Sunday, September 22, 13

Page 41: Juggle your data with Tungsten Replicator

©Continuent 2012.

More complex topologies

41

41Sunday, September 22, 13

Page 42: Juggle your data with Tungsten Replicator

©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

42Sunday, September 22, 13

Page 43: Juggle your data with Tungsten Replicator

©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

43Sunday, September 22, 13

Page 44: Juggle your data with Tungsten Replicator

©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

44Sunday, September 22, 13

Page 45: Juggle your data with Tungsten Replicator

©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

45Sunday, September 22, 13

Page 46: Juggle your data with Tungsten Replicator

©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

46Sunday, September 22, 13

Page 47: Juggle your data with Tungsten Replicator

©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

47Sunday, September 22, 13

Page 48: Juggle your data with Tungsten Replicator

©Continuent 2013

four all-masters with attached slaves5: !nal step: install

48

#5./tools/tpm install

48Sunday, September 22, 13

Page 49: Juggle your data with Tungsten Replicator

©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

49Sunday, September 22, 13

Page 50: Juggle your data with Tungsten Replicator

©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

50Sunday, September 22, 13

Page 51: Juggle your data with Tungsten Replicator

©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

51Sunday, September 22, 13

Page 52: Juggle your data with Tungsten Replicator

©Continuent 2013

DEMO:multi master installation

52

52Sunday, September 22, 13

Page 53: Juggle your data with Tungsten Replicator

©Continuent 2012.

Overview of Tungsten Cookbook

53

53Sunday, September 22, 13

Page 54: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten Cookbook

tungsten-replicator-2.1.1-230 | +--/cluster-home +--/cookbook +--/tools +--/tungsten-replicator

54

54Sunday, September 22, 13

Page 55: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten Cookbook

tungsten-replicator-2.1.1-230 | +--/cookbook | +--COMMON_NODES.sh +--USER_VALUES.sh +--show_cluster +--test_cluster +--clear_cluster...

55

55Sunday, September 22, 13

Page 56: Juggle your data with Tungsten Replicator

©Continuent 2013

Tungsten Cookbook

$ cat COMMON_NODES.sh

export NODE1=host1export NODE2=host2export NODE3=host3export NODE4=host4

56

56Sunday, September 22, 13

Page 57: Juggle your data with Tungsten Replicator

©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

57Sunday, September 22, 13

Page 58: Juggle your data with Tungsten Replicator

©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

58Sunday, September 22, 13

Page 59: Juggle your data with Tungsten Replicator

©Continuent 2013

DEMO:cookbook main tools

* show status* show logs* edit con!guration* show services

59

59Sunday, September 22, 13

Page 60: Juggle your data with Tungsten Replicator

©Continuent 2013

Joining the Community

60

60Sunday, September 22, 13

Page 61: Juggle your data with Tungsten Replicator

©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

61Sunday, September 22, 13

Page 62: Juggle your data with Tungsten Replicator

©Continuent 2013

Wrapping Up

62

62Sunday, September 22, 13

Page 63: Juggle your data with Tungsten Replicator

©Continuent 2012.

Continuent Web Page:http://www.continuent.com

Tungsten Replicator 2.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]

63Sunday, September 22, 13