订阅Hologres Binlog
要求
- Hologres V0.9及以上版本。
开启Binlog
Hologres默认关闭Binlog,可以通过binlog.level
和binlog.ttl
开启该功能。
列存表开启Binlog的成本大于行存表。
使用限制
- V0.10以下版本,已存在的表无法通过修改表属性的方式开启Binlog,如需开启必须重建表。
- 不支持消费分区表的Binlog。
- 对于更新频繁的场景,建议使用行存表开启Binlog。
使用示例
begin;
create table test_message_src(
id int primary key,
title text not null,
body text);
call set_table_property('test_message_src', 'orientation', 'row');--创建行存表test_message_src
call set_table_property('test_message_src', 'clustering_key', 'id');--在id列建立聚簇索引
call set_table_property('test_message_src', 'binlog.level', 'replica');--设置表属性开启Binlog功能
call set_table_property('test_message_src', 'binlog.ttl', '86400');--binlog.ttl,Binlog的TTL,单位为秒
commit;
参数说明:
binlog.level
:是否开启Binlog,replica(开启) 、none(关闭)。binlog.ttl
:Binlog的TTL,单位秒。默认30天,即2592000。
按需开启Binlog
HologresV1.1之后版本支持。
-
开启binlog
-- 设置表属性开启Binlog功能 begin; call set_table_property('test_message_src', 'binlog.level', 'replica');</