-
StarRocks Olap 外表同步 Bitmap
# 目标集群建表
CREATE TABLE `t1` (
`c1` int(11) NULL COMMENT "",
`c2` bitmap BITMAP_UNION NULL COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(`c1`)
DISTRIBUTED BY HASH(`c1`)
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"enable_persistent_index" = "false",
"replicated_storage" = "true",
"fast_schema_evolution" = "true",
"compression" = "LZ4"
);
# 源集群建表
CREATE TABLE `t1` (
`c1` int(11) NULL COMMENT "",
`c2` bitmap BITMAP_UNION NULL COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(`c1`)
DISTRIBUTED BY HASH(`c1`)
ORDER BY()
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"enable_persistent_index" = "false",
"replicated_storage" = "true",
"compression" = "LZ4"
);
# 源表数据
mysql> select c1, bitmap_to_string(c2) from t1;
+------+----------------------+
| c1 | bitmap_to_string(c2) |
+------+----------------------+
| 1 | 1,2,3,4 |
+------+----------------------+
# 写入外表
insert into t1_external select * from t1;
-
backup/restore
# 创建备份路径
create repository lxh_repo with broker on location "hdfs://emr-header-1.cluster-49091:9000/lxh/backup";
# backup
backup snapshot t1_bak to lxh_repo on (t1);
SHOW SNAPSHOT ON lxh_repo;
# restore
restore snapshot t1_bak from lxh_repo on (t1) properties("backup_timestamp"="2023-12-29-17-45-05-120", "replication_num"="1");