MySQL replication for Tungsten

Source: Internet
Author: User

Tungsten itself is a data replication middleware that supports data transmission between different data. This tool is basically used for data stream platforms.
Simply put, you do not have to build a master-slave MySQL replication relationship, but also copy data.

I have already introduced what tunsten is, and I will introduce how to use it.
It is very easy to install tunsten of master-slave, because I have installed master and slave on one of my machines, so I need to install tunststen twice.
After MySQL is deployed, set up the master-slave replication relationship and execute stop slave on slave;
Then install the following tunsten commands:
MASTER:
Go to the home directory of tunsten and execute

1./Tools/tunststen-Installer \2-Master-Slave \3-Master-host =X. x \4-- Cluster-hosts =X. x \5-Datasource-user =Root \6-Datasource-Password =123\7-Service-name =Sys \8-Home-directory =/home/DDB/zty/Liky \9-Start

Check whether the permission is correct before installation.
SLAVE:

 1 ./Tools/tunststen- Installer \  2 -- Master- Slave \  3 -- Cluster-hosts = X. x \  4 -- Master-host = X. x \  5 -- Master-Thl-Port = 2112  \  6 -- Datasource-Port = 6999  \  7 -- Datasource-mysql-conf = ./ My2.cnf \  8 -- Datasource-user = Zty \  9 -- Datasource-Password = Zty \  10 -- Service-name = Sys \  11 -- Home-directory =/home/DDB/ Liky1 \  12 -- Thl-Port = 4112  \  13 -- RMI-Port =12000  \  14 -- Start-and-Report

Before the same installation, you need to confirm that the permissions are correct. At the same time, Thl-port and RMI-port are all specified. Because the default value of the master is used, slave cannot be used any more.
-- Datasource-mysql-conf is also manually specified. Otherwise, an error will occur.
For more configuration details, refer:

./Tools/tunststen-installer -- Help-all

Note that the server-name of the master and slave must be the same.

Check whether the installation is successful:

 1   MASTER:  2 DDB @ DB- 35 :~ /Zty/liky1/tunststen-Replicator/bin $ ./ Trepctl services  3   Processing Services Command... 4   NAME value  5 --------- 6 Appliedlastseqno: 1614963  7 Appliedlatency: 0.212  8   Role: Master  9   Servicename: SYS  10   Servicetype: Local  11 Started: True 12   State: Online  13   Finished Services Command...  14   15   SLAVE:  16 DDB @ DB- 35 :~ /Zty/liky1/tunststen-Replicator/bin $./trepctl-Port 12000  Services  17   Processing Services Command...  18   NAME value 19 --------- 20 Appliedlastseqno: 1614963  21 Appliedlatency: 0.994  22   Role: slave  23   Servicename: SYS  24   Servicetype: Local  25 Started: True  26   State: Online 27 Finished Services Command...

Next we simulate the insert data to the master to see the format of data generated by tunststen.

The command for viewing data is simple:
View on slave.

 1 DDB @ DB- 35 :~ /Zty/liky1/Tungsten/tungsten-Replicator/bin $./Thl-conf ../CONF/ Static -SYS. properties list | Less  2   3 SEQ # = 14 /Frag # = 0  (Last frag)  4 -Time =2012 - 08 - 17   12 : 38 : 08.0  5 -Epoch # = 1  6 -Eventid = mysql-bin. 000034 : 0000000000002494 ; 0  7 -Sourceid = DB- 35 8 -Metadata = [mysql_server_id = 999 ; Service = sys; shard = Test]  9 -Type = com. Continuent. tunsten. Replicator. Event  . Repldbmsevent  10 -SQL ( 0 ) = 11 -Action = Insert  12 -Schema = Test  13 -Table =T1  14 -Row # = 0  15 -Col ( 1 :) = 11  16 -Col ( 2 :) = 1 

Adding an SQL statement after the command is easier to observe.

DDB @ db-35 :~ /Zty/liky1/tunststen-Replicator/bin $./Thl-conf ../CONF/static-sys.properties list-SQL

 1 Insert into test. T1 (B) values ( 1 ) /* ___ Service ___ = [sys]  */  ;  2 -Metadata = [mysql_server_id = 999 ; Service = sys; shard = Test]  3 -Type = com. Continuent. tunsten. Replicator. Event  . Repldbmsevent  4 Set insert_id = 1629496  5 -Options = [# charset = iso8859_1, autocommit = 1 , SQL _auto_is_null =0 , Foreign_key_checks = 1 , Unique_checks = 1 , SQL _mode = '' , Character_set_client = 8 , Collation_connection = 8 , Collation_server = 8  ]  6 Use;

The tunsten log will be in the installation directory/Thl/Server-name/, which can be viewed separately using the Thl tool.
If MySQL uses the BINLOG-format of row base, tunsten does not support-SQL Parameter Parsing:

# SQL output on Row change eventsIsNot Supported yet.-Metadata = [mysql_server_id =999; Service = sys; shard =Test]-Type = com. Continuent. tunsten. Replicator.Event. Repldbmsevent # SQL output on Row change eventsIsNot Supported yet.

You can also use this command to view the write status of tunsten logs.

./Trepctl-port 12000 status.

Tunsten supports receiving binlogs from any post. Practice:

./Trepctl offline
./Trcpctl online-from-enent

If a problem occurs during the write process, you can also drop the location of the SKIP:

./Trcpctl online-Skip-seqno
For details, see:
./Trcpctl help

Tunsten will create a database in MySQL with some tables in it. The trep_commit_seqno table will record the real-time changes of the BINLOG. If the BINLOG keeps changing, there will always be an update statement to update the table,
This table has only one record, so it may be affected accordingly.

I don't know. You didn't notice that when I installed two tunnels, I always specified-master-slave. Actually there are two types: {-- direct | -- master-slave}
What does it mean? See the figure below:

Master-slave

Direct

At the same time tunsten also supports the M-M is the master-master, but look at it, there is no special place, or a single time can only have a master write, second Master do temporary switching. Let's take a look at the document.

Http://code.google.com/p/tungsten-replicator/wiki/TRCMultiMasterInstallation#Multi-Master_Installation

 

Http://code.google.com/p/tungsten-replicator/wiki/TRCMultiMasterInstallation#Multi-Master_Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.