GBase 8a
安装配置
文章

南大通用数据库-Gbase-8a-MPP-Cluster-Gbase8a到Gbase8a的集群同步工具RSync

发表于2024-12-31 08:57:4916次浏览0个评论

1、简介

集群间同步工具是基于镜像集群的底层二进制同步的工具,其同步的对象是库内的数据,通过解析、比对二进制文件的变化进行同步; 包含增量同步和全量同步。
2、支持功能
 

序号功能点描述
1支持增量和全量两种数据同步方式;
2支持落盘数据的回读校验;
3支持主备分片同时同步(不保备份集群的表的数据安全性);
4支持先同步主分片,主分片成功后再同步备份分片;
5集群间同步支持使用普通数据库用户进行同步;

3、注意点
 

序号注意点描述
1主备集群版本必须一致。
2主备集群的被同步表至少有一组可用分片。
3系统表、Nocopies不做同步。;

三、测试

1、部署软件
[root@xdw0 pkg]# tar -xvf gcluster_rsynctool-8.6.2_build43-R33-redhat7.3-x86_64.tar.bz2
 
[root@xdw0 pkg]# chown -R gbase:gbase /opt/pkg/gcluster_rsynctool
 
[root@xdw0 pkg]# chmod 777 -R /opt/pkg/gcluster_rsynctool
 
[root@xdw0 gcluster_rsynctool]# su - gbase
上一次登录:日 8月 21 09:01:43 CST 2022
 
[gbase@xdw0 ~]$ cd /opt/pkg/gcluster_rsynctool/
 
[gbase@xdw0 gcluster_rsynctool]$ ll
总用量 216
drwxr-xr-x 3 gbase gbase   273 7月  13 2021 GBaseConnector
-rw-r--r-- 1 gbase gbase  5633 7月  13 2021 GCClusterTopo.py
-rw-r--r-- 1 gbase gbase  6361 7月  13 2021 GCCommon.py
-rw-r--r-- 1 gbase gbase  1661 7月  13 2021 GCConnection.py
-rw-r--r-- 1 gbase gbase   225 7月  13 2021 GCException.py
-rw-r--r-- 1 gbase gbase  2895 7月  13 2021 GCFile.py
-rwxr-xr-x 1 gbase gbase  2110 7月  13 2021 GCIPMapping.py
-rw-r--r-- 1 gbase gbase 59555 7月  13 2021 gcluster_rsynctool.py
-rw-r--r-- 1 gbase gbase 17974 7月  13 2021 GCParameter.py
-rw-r--r-- 1 gbase gbase  4835 7月  13 2021 GCThreadPool.py
-rw-r--r-- 1 gbase gbase   421 7月  13 2021 Makefile
-rwxr-xr-x 1 gbase gbase   206 7月  13 2021 master_mapping
-rwxr-xr-x 1 gbase gbase 75990 7月  13 2021 pexpect.py
-rw-r--r-- 1 gbase gbase    13 7月  13 2021 release_version
-rwxr-xr-x 1 gbase gbase   205 7月  13 2021 slave_mapping
drwxr-xr-x 2 gbase gbase   252 7月  13 2021 test
-rw-r--r-- 1 gbase gbase    73 7月  13 2021 Version.py

2,源端生成测试数据

gbase> create table qwe (a int,b double,c varchar(100),d text,e blob,f longblob,g date,h timestamp);
Query OK, 0 rows affected (Elapsed: 00:00:00.22)
 
gbase> insert into qwe values(1,1.1,'asd','小天使','qwertasdsdfzxczxxv','gregergjsfishfuieehfuiew','1995-09-18','2022-08-03 09:24:00.000');
Query OK, 1 row affected (Elapsed: 00:00:00.14)
 
gbase> insert into qwe values(2,1.1,'asd','小天使','qwertasdsdfzxczxxv','gregergjsfishfuieehfuiew','1995-09-18','2022-08-03 09:24:00.000');
Query OK, 1 row affected (Elapsed: 00:00:00.03)
 
gbase> insert into qwe select * from zxc;
Query OK, 2 rows affected (Elapsed: 00:00:00.17)
Records: 2  Duplicates: 0  Warnings: 0
 
gbase> insert into qwe select * from zxc;
Query OK, 4 rows affected (Elapsed: 00:00:00.14)
Records: 4  Duplicates: 0  Warnings: 0
 
gbase> select * from qwe;

 3、目的端添加表结构

gbase> desc qwe;
+-------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type         | Null | Key | Default           | Extra                       |
+-------+--------------+------+-----+-------------------+-----------------------------+
| a     | int(11)      | YES  |     | NULL              |                             |
| b     | double       | YES  |     | NULL              |                             |
| c     | varchar(100) | YES  |     | NULL              |                             |
| d     | text         | YES  |     | NULL              |                             |
| e     | blob         | YES  |     | NULL              |                             |
| f     | longblob     | YES  |     | NULL              |                             |
| g     | date         | YES  |     | NULL              |                             |
| h     | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+-------+--------------+------+-----+-------------------+-----------------------------+
8 rows in set (Elapsed: 00:00:00.00)

4、配置同步的表

[gbase@xdw0 gcluster_rsynctool]$ cat SyncTab.txt

5、测试同步

[gbase@xdw0 gcluster_rsynctool]$  ./gcluster_rsynctool.py --master_mpp_ip=192.168.142.10 --slave_mpp_ip=192.168.142.11 --table_list_file=SyncTab.txt --rsync_mode=1 --log_level=5
*************Gcluster Sync Tool Start*************************
Table [                 czg:                 sun] Sync Start 
Table [                 czg:                 sun] Sync End     cost : <0 s,818 ms>
*************Gcluster Sync Tool End With Success**************

 

 

 

评论

登录后才可以发表评论