强制删除Citus节点

在某些情况下,比如worker节点宕机等情况发生时,允许丢失部分数据,以使服务可用时可能会用到。

  • 删除节点报错
test=# select master_remove_node('localhost', '1602');
ERROR:  you cannot remove the primary node of a node group which has shard placements
  • 查询节点的groupid
test=# select * from pg_dist_node;
 nodeid | groupid | nodename  | nodeport | noderack | hasmetadata | isactive | noderole | nodecluster | metadatasynced | shouldhaveshards 
--------+---------+-----------+----------+----------+-------------+----------+----------+-------------+----------------+------------------
      1 |       1 | localhost |     1601 | default  | f           | t        | primary  | default     | f              | t
      2 |       2 | localhost |     1602 | default  | f           | t        | primary  | default     | f              | t
(2 rows)

  • 删除关联信息
test=# delete from pg_dist_placement where groupid = 2;
-- 这个地方在删除前,也可以把pg_dist_placement备份一下
-- pg_dist_shard 最好也删除一下,要不全表扫描的时候也会报错
  • 删除节点
test=# select master_remove_node('localhost', '1602');
 master_remove_node 
--------------------

(1 row)

文章浏览总量 1,456 次

要发表评论,您必须先登录