searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

Doris CCR初探

2024-05-28 05:55:33
51
0

简介

目前只有selectdb的知乎号一篇文章,这里补充一下具体细节

编译

因为是golang编写的,避免编译出来的包在linux上不能用,需要下载go v1.22版本进行安装

wget https://studygolang.com/dl/golang/go1.22.0.linux-amd64.tar.gz
 
mv /root/go1.22.0.linux-amd64.tar.gz  ~/go
 
tar -C /usr/local -zxvf go1.22.0.linux-amd64.tar.gz
 
vi /etc/profile
```末尾加入
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
```
source /etc/profile
go env -w GOPROXY=https://goproxy.cn,direct
 
go env -w GOOS=linux

 

下载代码

mkdir /usr/local/go/bin
mkdir /usr/local/go/pkg
mkdir /usr/local/go/src
mkdir -p /root/go/pkg/mod
cd /usr/local/go/src
git clone https://github.com/selectdb/ccr-syncer.git

 

编译&结果文件

bash build.sh output

 

网络配置

syncers需要连接源集群的FE 目标集群的FE/BE 所以要打通网络

syncers会根据ip获取host,进行http请求,所以 域名解析/etc/hosts文件需要加所有节点的域名解析

实测源BE不会用到,但是syncers第一次获取源fe,会获取所有源be并尝试http连接

  syncers本地 源fe 源be 目标fe 目标be
域名解析 Y Y Y Y Y
端口(http 和 brpc Y Y Y Y Y

使用前提

配置文件,需要重启

be.conf和fe.conf

enable_feature_binlog=1

对表启用CCR

ALTER TABLE 库名.表名 SET ("binlog.enable" = "true");

 

启动命令 

bash bin/start_syncer.sh --daemon --db_type mysql --db_host mysql的IP --db_port Mysql端口 --db_user 用户名 --db_password 密码

 

创建任务

curl -X POST -H "Content-Type: application/json" -d '{
    "name": "ccr_smoke",
    "src": {
    "host": "源ip",
    "port": "9030",
    "thrift_port": "9020",
    "user": "root",
    "password": "密码",
    "database": "源库",
    "table": "源表"
    },
    "dest": {
    "host": "目标ip",
    "port": "9030",
    "thrift_port": "9020",
    "user": "mysql用户",
    "password": "密码",
    "database": "目标库",
    "table": "目标表"
    },
    "skip_error": false
}' http://syncer的ip:9190/create_ccr

校验

去目标doris上查看库表数据

0条评论
0 / 1000
w****n
6文章数
0粉丝数
w****n
6 文章 | 0 粉丝
w****n
6文章数
0粉丝数
w****n
6 文章 | 0 粉丝
原创

Doris CCR初探

2024-05-28 05:55:33
51
0

简介

目前只有selectdb的知乎号一篇文章,这里补充一下具体细节

编译

因为是golang编写的,避免编译出来的包在linux上不能用,需要下载go v1.22版本进行安装

wget https://studygolang.com/dl/golang/go1.22.0.linux-amd64.tar.gz
 
mv /root/go1.22.0.linux-amd64.tar.gz  ~/go
 
tar -C /usr/local -zxvf go1.22.0.linux-amd64.tar.gz
 
vi /etc/profile
```末尾加入
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
```
source /etc/profile
go env -w GOPROXY=https://goproxy.cn,direct
 
go env -w GOOS=linux

 

下载代码

mkdir /usr/local/go/bin
mkdir /usr/local/go/pkg
mkdir /usr/local/go/src
mkdir -p /root/go/pkg/mod
cd /usr/local/go/src
git clone https://github.com/selectdb/ccr-syncer.git

 

编译&结果文件

bash build.sh output

 

网络配置

syncers需要连接源集群的FE 目标集群的FE/BE 所以要打通网络

syncers会根据ip获取host,进行http请求,所以 域名解析/etc/hosts文件需要加所有节点的域名解析

实测源BE不会用到,但是syncers第一次获取源fe,会获取所有源be并尝试http连接

  syncers本地 源fe 源be 目标fe 目标be
域名解析 Y Y Y Y Y
端口(http 和 brpc Y Y Y Y Y

使用前提

配置文件,需要重启

be.conf和fe.conf

enable_feature_binlog=1

对表启用CCR

ALTER TABLE 库名.表名 SET ("binlog.enable" = "true");

 

启动命令 

bash bin/start_syncer.sh --daemon --db_type mysql --db_host mysql的IP --db_port Mysql端口 --db_user 用户名 --db_password 密码

 

创建任务

curl -X POST -H "Content-Type: application/json" -d '{
    "name": "ccr_smoke",
    "src": {
    "host": "源ip",
    "port": "9030",
    "thrift_port": "9020",
    "user": "root",
    "password": "密码",
    "database": "源库",
    "table": "源表"
    },
    "dest": {
    "host": "目标ip",
    "port": "9030",
    "thrift_port": "9020",
    "user": "mysql用户",
    "password": "密码",
    "database": "目标库",
    "table": "目标表"
    },
    "skip_error": false
}' http://syncer的ip:9190/create_ccr

校验

去目标doris上查看库表数据

文章来自个人专栏
文章 | 订阅
0条评论
0 / 1000
请输入你的评论
0
0