-
- 使用 mysqldump 将 mysql的表结构和数据同步到 OceanBase 的MySQL 租户中
- Mysql数据库导出
- 使用 mysqldump 将 mysql的表结构和数据同步到 OceanBase 的MySQL 租户中
mysqldump -h127.0.0.1 -P3306 -uroot –p '' --single-transaction --hex-blob --routines --events --triggers --set-gtid-purged=OFF --databases teller >teller.sql
mysql> use tell;
mysql> show tables;
…………192 rows
-
-
- oceanbase数据库导入
-
##使用之前的test租户登录,导入
obclient -h10.64.8.28 -P2883 -uroot@test#admin -p -A
source teller.sql;
obclient> show tables;
-
- datax 配置至少一个表的 MySQL 到 OceanBase 的 MySQL 租户的离线同步
- datax安装
- datax 配置至少一个表的 MySQL 到 OceanBase 的 MySQL 租户的离线同步
wget http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz
tar -xf datax.tar.gz -C /usr/local/
cd /usr/local/datax
yum install -y python2 java
##生成模板文件
python2 /usr/local/datax/bin/datax.py -r mysqlreader -w oceanbasev10writer > /usr/local/datax/job/my2ob.json
-
-
- datax配置参数
-
##根据实际环境修改
vi /usr/local/datax/job/my2ob.json
[root@iZm5e08jeuiuif0rds45vvZ log]# cat /usr/local/datax/job/my2ob.json
{
"job": {
"setting": {
"speed": {
"channel": 2,
},
"errorLimit": {
"record": 10
}
},
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "root",
"password": "xxxxx",
"splitPk": "id",
"column": ["*"],
"connection": [
{
"jdbcUrl": [
"jdbc:mysql://xxx.xxx.xxx.xxx:3306/teller"
],
"table": [
"*"
]
}
]
}
},
"writer": {
"name": "oceanbasev10writer",
"parameter": {
"writeMode": "insert",
"username": "root",
"password": "root123",
"writerThreadCount": 5,
"column": [
"*"
],
"connection": [
{
"jdbcUrl": "jdbc:oceanbase://192.168.0.26:2883/teller?useUnicode=true&characterEncoding=utf-8mb4",
"table": [
"*"
]
}
]
}
}
}
]
}
}
-
-
- datax执行
-
python2 /usr/local/datax/bin/datax.py /usr/local/datax/job/my2ob.json
查看集群名称: