From 3f16123cc5a13856bb470807887b68f83ee79a8f Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Mon, 21 Feb 2022 23:57:25 -0800 Subject: [PATCH] Config docs (#37) * config docs * space * space * shards --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 37f6c77..b661737 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,32 @@ Meow. PgBouncer rewritten in Rust, with sharding, load balancing and failover su See `Dockerfile` for example deployment using Docker. The pooler is configured to spawn 4 workers so 4 CPUs are recommended for optimal performance. That setting can be adjusted to spawn as many (or as little) workers as needed. +### Config + +| **Name** | **Description** | **Examples** | +|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------| +| **`general`** | | | +| `host` | The pooler will run on this host, 0.0.0.0 means accessible from everywhere. | `0.0.0.0` | +| `port` | The pooler will run on this port. | `6432` | +| `pool_size` | Maximum allowed server connections per pool. Pools are separated for each user/shard/server role. The connections are allocated as needed. | `15` | +| `pool_mode` | The pool mode to use, i.e. `session` or `transaction`. | `transaction` | +| `connect_timeout` | Maximum time to establish a connection to a server (milliseconds). If reached, the server is banned and the next target is attempted. | `5000` | +| `healthcheck_timeout` | Maximum time to pass a health check (`SELECT 1`, milliseconds). If reached, the server is banned and the next target is attempted. | `1000` | +| `ban_time` | Ban time for a server (seconds). It won't be allowed to serve transactions until the ban expires; failover targets will be used instead. | `60` | +| `statsd_address` | StatsD host and port. Statistics will be sent there every 15 seconds. | `127.0.0.1:8125` | +| | | | +| **`user`** | | | +| `name` | The user name. | `sharding_user` | +| `password` | The user password in plaintext. | `hunter2` | +| | | | +| **`shards`** | Shards are numerically numbered starting from 0; the order in the config is preserved by the pooler to route queries accordingly. | `[shards.0]` | +| `servers` | List of servers to connect to and their roles. A server is: `[host, port, role]`, where `role` is either `primary` or `replica`. | `["127.0.0.1", 5432, "primary"]` | +| `database` | The name of the database to connect to. This is the same on all servers that are part of one shard. | | +| **`query_router`** | | | +| `default_role` | Traffic is routed to this role by default (round-robin), unless the client specifies otherwise. Default is `any`, for any role available. | `any`, `primary`, `replica` | +| `query_parser_enabled` | Enable the query parser which will inspect incoming queries and route them to a primary or replicas. | `false` | +| `primary_reads_enabled` | Enable this to allow read queries on the primary; otherwise read queries are routed to the replicas. | `true` | + ## Local development 1. Install Rust (latest stable will work great).