doris-1.1.5集群副本修改

Viewed 356

doris-1.1.5集群创建表默认为3个副本,但在创建的时候指定了PROPERTIES "replication_allocation" = "tag.location.default: 1",我想要修改表副本为3

看官方给出以下四条语句:

ALTER TABLE example_db.mysql_table SET ("replication_num" = "2");
ALTER TABLE example_db.mysql_table SET ("default.replication_num" = "2");
ALTER TABLE example_db.mysql_table SET ("replication_allocation" = "tag.location.default: 1");
ALTER TABLE example_db.mysql_table SET ("default.replication_allocation" = "tag.location.default: 1");

我通过设置"default.replication_allocation" = "tag.location.default: 3" 查看表结构已经改了,但通过SHOW TABLETS FROM 查看副本还是分布在一台机器。
而我接着设置"replication_allocation" = "tag.location.default: 3"通过SHOW TABLETS FROM 观察副本已经分布在三台机器上了。
我想了解一下想从1个副本改为3个副本,需要设置哪个参数即可,还是需要组合设置?

2 Answers

副本修改:

  1. 首先机器节点数需要 >= 副本数
  2. 修改历史分区副本数:alter table modify partition(*) set ("replication_num" = "3");
  3. 动态分区修改未来分区副本数:ALTER TABLE example_db.mysql_table SET ("dynamic_partition.replication_num" = "3");
  4. 非分区表:ALTER TABLE example_db.mysql_table SET ("replication_num" = "3");

检查:

  1. 先对测试表进行操作,看测试表的状态是否符合预期,进行show partitions from table 和 show create table 进行查看核对,show partitions from 是实际的副本数。

您好,
我通过设置ALTER TABLE test1 SET ("replication_num" = "3");并通过SHOW TABLETS FROM检查副本已分布在三个节点。
通过show partitions from test1检查的结果为:tag.location.default: 3,但通过show create table这个表的值还为tag.location.default: 1。
image.png