Databases 3 min read

How We Built a Cloud‑Native Distributed PostgreSQL + Citus Cluster for Sentry Backend

The article explains how to boost a distributed system's throughput by optimizing middleware clusters—using Longhorn for storage, Citus for sharding Sentry's nodestore_node table into 64 shards across six workers, and adding PgPool, repmgr, and PgAdmin for read‑write splitting, high availability, and management.

Hacker Afternoon Tea
Hacker Afternoon Tea
Hacker Afternoon Tea
How We Built a Cloud‑Native Distributed PostgreSQL + Citus Cluster for Sentry Backend

Distributed Storage Cluster (Longhorn)

Longhorn provides persistent storage for the Citus coordinator and worker nodes.

https://longhorn.io/

Distributed PostgreSQL Cluster (Citus)

Citus shards the large Sentry event source table nodestore_node.

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

Read‑Write Splitting and High Availability (PgPool + repmgr)

PgPool and repmgr implement read‑write splitting and primary‑standby high availability for the Citus coordinator and worker nodes.

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

https://repmgr.org/

Cluster Management (PgAdmin)

PgAdmin is used to manage the PostgreSQL cluster.

https://www.pgadmin.org/

nodestore_node Table Sharding

A distributed key is selected and the table is converted to a distributed table with 64 shards evenly distributed across six worker nodes.

# Create distributed table
SELECT create_distributed_table('nodestore_node', 'id', colocate_with => 'none', shard_count => 64);
# Rebalance shards
SELECT rebalance_table_shards();
# List shards
SELECT * FROM citus_shards;

Conclusion

Middleware cluster infrastructure involves many details and can be treated as a separate domain; the described setup illustrates one practical approach.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

kubernetesdistributed-databaseSentryPostgreSQLCitusLonghorn
Hacker Afternoon Tea
Written by

Hacker Afternoon Tea

You might find something interesting here ^_^

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.