• 迁移 MySQL 数据到 OceanBase 集群


      1. 使用 mysqldump 将 mysql的表结构和数据同步到 OceanBase 的MySQL 租户中
        1. 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

        1. oceanbase数据库导入

    ##使用之前的test租户登录,导入

    obclient -h10.64.8.28 -P2883 -uroot@test#admin -p -A

    source teller.sql;

    obclient> show tables;

      1. datax 配置至少一个表的 MySQL 到 OceanBase 的 MySQL 租户的离线同步
        1. datax安装

    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

        1. 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": [

                                        "*"

                                    ]

                                }

                            ]

                        }

                    }

                }

            ]

        }

    }

        1. datax执行

    python2 /usr/local/datax/bin/datax.py /usr/local/datax/job/my2ob.json

    查看集群名称:

  • 相关阅读:
    C# 同步与异步方法
    基于Eigen的椭圆拟合
    【ElasticSearch】6亿文档存储的ES集群调优实战
    Apache ECharts数据可视化技术
    02-docker network
    sqlite3自动插入创建时间和更新时间
    Python的pandas库来实现将Excel文件转换为JSON格式的操作
    Uniswap V2 — 从代码解释 DeFi 协议
    神经网络理论及应用答案,神经网络收敛速度慢
    C++学习之:布隆过滤器与哈希切分
  • 原文地址:https://blog.csdn.net/shijian0916/article/details/133176817