Multi-Region App Setup Guide (Yugabyte PGSQL)

MD
R
Markdown

Enable an app to tolerate zone/region level outages using Google Cloud multi-region architecture.

============================== Setup Steps

Select Regions: Choose us_east_1, us_west_1, us_central_2. Deploy App: Roll out the API and Client across the selected regions. Traffic Routing: Implement a Global Load Balancer to manage traffic via one virtual IP. Database Setup: Deploy YugaByte across the same regions as your application. Verify with: select * from pg_extension in DataGrip.

============================== Design Patterns

== Global Database Pattern: YugaByte uses Raft for shard synchronization. R/W operations are directed to the preferred region. Data replication is set up for the other regions. In case the preferred region fails, failover to the next prioritized one. All apps should connect to the database in their local region.

== Latency-Optimized Geo-Partitioning: Partition data in PostgreSQL using a geo-partitioning column. Steps: Create TableSpaces for each region's node. Establish a Partition Column. Create partitioned tables with the Partition Of command, assigning them to the correct tablespace.

== Follower Reads: Configure for eventual consistency, considering replication lag. Use enable_follower_reads for read-heavy workloads to minimize latency. Establish multiple connection pools for various read types (follower reads, normal reads).

============================== Notes: Use DataGrip for database management with PG_SQL. Run select * from pg_extension to list extensions and set up Vector Similarity Search as needed.

Created on 3/1/2024