MySQL单表迁移至Hubble
步骤一:导出需要迁移的表
mysqldump -uroot -p123456  sysbench sbtest1_500 > /opt/willynew/newhubble/mysql.sql
步骤二:将导出的数据文件放置于集群可访问到的位置
Hubble集群中的每个节点都需要访问到需导入的数据文件。可使用httpd服务。
URL必须使用以下格式:
[scheme]://[host]/[path]?[parameters]
当前支持的类型如下:
| 类型 | schema | host | 参数 | 示例 | 
|---|---|---|---|---|
| http | http | 主机地址 | N/A | http://localhost:8080/mydatest.sql | 
| NFS/Local | nodelocal | 节点ID或为空 | N/A | nodelocal:///path/mydatest,nodelocal://n/path/mydatest | 
nodelocal://n/path/mydatest,n是节点数,不能省略,地址这块与3.7.9版本是有区别的。
步骤三:导入MySQL导出的文件
mysql 导出单个表
mysqldump -uhadoop -p  hilbert_3  vertexlable >  /data/path/vertexlable_test.sql;
把数据导入hubble中
create database if not exists hubble_demo;
use hubble_demo;
IMPORT MYSQLDUMP 'http://localhost:3000/vertexlable_test.sql';
IMPORT MYSQLDUMP 'http://localhost:3000/vertexlable_test.sql';
job_id   | status | fraction_completed | rows | index_entries | system_records | bytes +
---------+--------+--------------------+------+---------------+----------------+-------+
535405586715115521 | succeeded |     1 |    5 |            10 |              0 |  1152  
(1 row)
MySQL整库迁移至Hubble
步骤一:导出需要迁移的整库
mysqldump -uhadoop -p  hilbert_3   >  /data/path/hilbert_v3.sql;
步骤二:将导出的数据文件放置于集群可访问到的位置
如同mysql单表导入的步骤二操作一致
步骤三:导入MySQL导出的整库数据
用户导出了整个数据库,可以通过以下的 IMPORT 语句从导出文件中读取全部数据和 DDL 语句
create database if not exists hubble_demo;
use  hubble_demo;
import mysqldump 'http://localhosts:3000/hilbert_v3.sql';
import mysqldump 'http://localhost:3000/hilbert_v3.sql';
        job_id       |  status   | fraction_completed | rows | index_entries | system_records | bytes  
+--------------------+-----------+--------------------+------+---------------+----------------+-------+
  535411573412855809 | succeeded |                  1 |   45 |             1 |              0 |  2101  
(1 row)