2

云原生分布式 PostgreSQL+Citus 集群在 Sentry 后端的实践

 1 year ago
source link: https://www.51cto.com/article/721079.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

云原生分布式 PostgreSQL+Citus 集群在 Sentry 后端的实践

作者:为少 2022-10-21 16:16:42
优化一个分布式系统的吞吐能力,除了应用本身代码外,很大程度上是在优化它所依赖的中间件集群处理能力。如:kafka/redis/rabbitmq/postgresql​/分布式存储(CephFS,JuiceFS,C urve,Longhorn)等集群的处理能力。

优化一个分布式系统的吞吐能力,除了应用本身代码外,很大程度上是在优化它所依赖的中间件集群处理能力。如:kafka/redis/rabbitmq/postgresql/分布式存储(CephFS,JuiceFS,C urve,Longhorn)等集群的处理能力。

分布式存储集群(Longhorn)

这里主要用于 Citus 集群的协调器(coordinator)和工作器(worker) 节点的数据持久化。

具体文档,请参阅:https://longhorn.io/

图片
图片

分布式 PostgreSQL 集群(Citus)

这里主要用于对 Sentry 事件源数据大表 nodestore_node 的分片。

具体文档,请参阅:

https://docs.citusdata.com/en/v11.1/

图片

读写分离和高可用(PgPool+Repmgr)

这里主要用于对 Citus 节点(协调器/工作器)进行读写分离和主备高可用。

具体文档,请参阅:

https://www.pgpool.net/docs/pgpool-II-4.2.3/en/html/example-kubernetes.html

https://repmgr.org/

图片
图片

管理集群节点(PgAdmin)

具体文档,请参阅:

https://www.pgadmin.org/

图片

nodestore_node 大表分片

选择分布式 key,并将表转换分布式表,这里将表划分为 64 个分片,数据平均分配到 6 台 worker 节点:

# 创建分布式表
SELECT create_distributed_table('nodestore_node', 'id', colocate_with => 'none', shard_count => 64);
# 平衡分片
SELECT rebalance_table_shards();
# 查询分片
SELECT * FROM citus_shards;
图片

中间件集群基础设施建设,本身涉及细节较多,可以说是另一个领域。

本文提供了一种笔者的实践思路,抛砖引玉。

责任编辑:武晓燕 来源: 黑客下午茶

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK