diff --git a/docs/configuration/pgdog.toml/databases.md b/docs/configuration/pgdog.toml/databases.md index 5a71cb5..f49a38a 100644 --- a/docs/configuration/pgdog.toml/databases.md +++ b/docs/configuration/pgdog.toml/databases.md @@ -87,6 +87,14 @@ Overrides the [`default_pool_size`](general.md#default_pool_size) setting. All c !!! note "Recommendation" We strongly recommend keeping this value well below the supported connections of the backend database(s) to allow connections for maintenance in high load scenarios. +### `pooler_mode` + +Overrides the [`pooler_mode`](general.md#pooler_mode) setting. Connections to this database will use this connection pool mode. + +### `min_pool_size` + +Overrides the [`min_pool_size`](general.md#min_pool_size) setting. The connection pool will maintain at minimum this many connections. + ### `statement_timeout` This setting configures the `statement_timeout` connection parameter on all connections to Postgres for this database. diff --git a/docs/configuration/pgdog.toml/general.md b/docs/configuration/pgdog.toml/general.md index 6277a2c..36dcedd 100644 --- a/docs/configuration/pgdog.toml/general.md +++ b/docs/configuration/pgdog.toml/general.md @@ -212,6 +212,12 @@ Maximum amount of time new clients have to complete authentication. Clients that Default: **`60_000`** (60s) +### `server_lifetime` + +Maximum amount of time a server connection is allowed to exist. Any connections exceeding this limit will be closed once they are checked back into the pool. + +Default: **`86400000`** (24h) + ## Load balancer ### `load_balancing_strategy` @@ -401,3 +407,11 @@ Default: **`true`** (enabled) How often to calculate averages shown in `SHOW STATS` [admin](../../administration/index.md) command and the [Prometheus](../../features/metrics.md) metrics. Default: **`15_000`** (15s) + +## DNS + +### `dns_ttl` + +Overrides the TTL set on DNS records received from DNS servers. Allows for faster failover when the primary/replica hostnames are changed by the database hosting provider. + +Default: **none** (disabled) diff --git a/docs/configuration/pgdog.toml/network.md b/docs/configuration/pgdog.toml/network.md index 8bb04dc..6dbf7cb 100644 --- a/docs/configuration/pgdog.toml/network.md +++ b/docs/configuration/pgdog.toml/network.md @@ -20,7 +20,7 @@ To be consistent with the rest of PgDog documentation, units of time are in mill !!! note "Support for keep-alives" Not all networks support or play well with TCP keep-alives. If you see an increased number of dropped connections after enabling these settings, you may have to disable them. -### `keepalives` +### `keepalive` Enable TCP keep-alives. When enabled, idle client & server connections will send keep-alive packets to make sure the TCP connections are healthy. diff --git a/docs/migrating-to-pgdog/.pages b/docs/migrating-to-pgdog/.pages new file mode 100644 index 0000000..0cf8d2f --- /dev/null +++ b/docs/migrating-to-pgdog/.pages @@ -0,0 +1 @@ +title: Migrating to PgDog diff --git a/docs/migrating-to-pgdog/from-pgbouncer.md b/docs/migrating-to-pgdog/from-pgbouncer.md new file mode 100644 index 0000000..94ae641 --- /dev/null +++ b/docs/migrating-to-pgdog/from-pgbouncer.md @@ -0,0 +1,318 @@ +--- +icon: material/swap-horizontal +--- + +# Migrating from PgBouncer + +PgBouncer is a popular PostgreSQL connection pooler. PgDog implements the majority of its features, which makes the migration process relatively straightforward. + +## Configuration + +PgBouncer uses the `ini` format for its main config file and a custom key/value format for user/password list. The main config file is typically called `pgbouncer.ini` and the userlist is aptly called `userlist.txt`. + +Both files have an equivalent in PgDog, [`pgdog.toml`](../configuration/pgdog.toml/general.md) and [`users.toml`](../configuration/users.toml/users.md), respectively. + +### `pgbouncer.ini` + +`pgbouncer.ini` contains the list of databases, in the `[databases]` section, and general settings, in the `[pgbouncer]` section. The analogous for PgDog is [`[[databases]]`](../configuration/pgdog.toml/databases.md) and [`[general]`](../configuration/pgdog.toml/general.md) sections. + +### Databases + +Databases are a list of PostgreSQL databases proxied by the connection pooler, with database-specific configuration overrides. + +#### Example + +=== "PgBouncer" + ```ini + prod = host=10.0.0.1 port=5432 user=postgres + staging = host=10.0.0.2 port=5433 user=postgres + ``` + +=== "PgDog" + ```toml + [[databases]] + name = "prod" + host = "10.0.0.1" + port = 5432 + + [[databases]] + name = "staging" + host = "10.0.0.1" + port = 5432 + ``` + + !!! note "Configuring users" + Unlike PgBouncer, PgDog connection pool users are configured separately in [`users.toml`](../configuration/users.toml/users.md). + +#### Overrides + +Both PgBouncer and PgDog can override the user's password used to connect to PostgreSQL. + +=== "PgBouncer" + ```ini + prod = host=10.0.0.1 port=5432 user=postgres password=hunter2 pool_mode=transaction + ``` +=== "PgDog" + ```toml + [[databases]] + name = "prod" + host = "10.0.0.1" + port = 5432 + server_user = "postgres" + server_password = "hunter2" + pooler_mode = "transaction" + ``` + +#### Database-level settings + +PgBouncer allows configuring various per-database settings in the `[databases]` section. Below is a comparison of these settings with PgDog equivalents. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| `dbname` | [`name`](../configuration/pgdog.toml/databases.md#name) | The logical database name clients connect to. | +| `host` | [`host`](../configuration/pgdog.toml/databases.md#host) | - | +| `port` | [`port`](../configuration/pgdog.toml/databases.md#port) | - | +| `user` | [`user`](../configuration/pgdog.toml/databases.md#user) | Override user for server connections. | +| `password` | [`password`](../configuration/pgdog.toml/databases.md#password) | Override password for server connections. | +| `auth_user` | N/A | Query-based authentication is not currently supported. | +| `auth_query` | N/A | Same as above. | +| `auth_dbname` | N/A | Same as above. | +| `pool_size` | [`pool_size`](../configuration/pgdog.toml/databases.md#pool_size) | - | +| `min_pool_size` | [`min_pool_size`](../configuration/pgdog.toml/databases.md#min_pool_size) | - | +| `reserve_pool_size` | N/A | PgDog doesn't support reserve connection pools. | +| `connect_query` | N/A | Not supported. | +| `pool_mode` | [`pooler_mode`](../configuration/pgdog.toml/databases.md#pooler_mode) | - | +| `max_db_connections` | N/A | Not currently supported. | +| `client_encoding` | N/A | Same as above. | +| `datestyle` | N/A | Same as above. | +| `timezone` | N/A | Same as above. | +| `load_balance_hosts` | N/A | PgDog has its own [load balancing](../features/load-balancer/index.md) configuration. | + +### General settings + +The `[pgbouncer]` section is a catch-all for all other configuration options that tweak its internal operations. For example, it allows to configure connection pool sizes, timeouts and logging settings. + +PgDog follows the same principles and has a [`[general]`](../configuration/pgdog.toml/general.md) section for the same purpose. + +#### Example + +=== "PgBouncer" + ```ini + [pgbouncer] + listen_addr = 127.0.0.1 + listen_port = 6432 + default_pool_size = 100 + pool_mode = transaction + ``` + +=== "PgDog" + ```toml + [general] + host = "127.0.0.1" + port = 6432 + default_pool_size = 100 + pooler_mode = "transaction" + ``` + +#### Supported settings + +Below is a list of PgBouncer settings and features PgDog exposes via its own configuration. + +Only the most common settings are listed. The ones that are not are either not currently supported or don't apply to how PgDog operates. + +##### Generic settings + +Settings that control general connection pooler operations. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`listen_addr`](https://www.pgbouncer.org/config.html#listen_addr) | [`host`](../configuration/pgdog.toml/general.md#host) | PgDog doesn't support UNIX sockets. | +| [`listen_port`](https://www.pgbouncer.org/config.html#listen_port) | [`port`](../configuration/pgdog.toml/general.md#port) | - | +| [`default_pool_size`](https://www.pgbouncer.org/config.html#default_pool_size) | [`default_pool_size`](../configuration/pgdog.toml/general.md#default_pool_size) | - | +| [`min_pool_size`](https://www.pgbouncer.org/config.html#min_pool_size) | [`min_pool_size`](../configuration/pgdog.toml/general.md#min_pool_size) | - | +| [`reserve_pool_size`](https://www.pgbouncer.org/config.html#reserve_pool_size) | N/A | PgDog doesn't support reserve connection pools. | +| [`pool_mode`](https://www.pgbouncer.org/config.html#pool_mode) | [`pooler_mode`](../configuration/pgdog.toml/general.md#pooler_mode) | PgDog doesn't currently support statement mode. | +| [`max_client_conn`](https://www.pgbouncer.org/config.html#max_client_conn) | N/A | PgDog doesn't place an upper bound on the number of client connections. | +| [`max_db_connections`](https://www.pgbouncer.org/config.html#max_db_connections) | N/A | PgDog doesn't have a global database connection limit. Individual pools configure their own limits. | +| [`server_round_robin`](https://www.pgbouncer.org/config.html#server_round_robin) | N/A | PgDog has its own [load balancing](../features/load-balancer/index.md) algorithms that are configured separately. | +| [`track_extra_parameters`](https://www.pgbouncer.org/config.html#track_extra_parameters) | N/A | PgDog tracks [all parameters](../features/transaction-mode.md#session-state) by default, including those that PgBouncer doesn't. | +| [`stats_period`](https://www.pgbouncer.org/config.html#stats_period) | [`stats_period`](../configuration/pgdog.toml/general.md#stats_period) | - | +| [`max_prepared_statements`](https://www.pgbouncer.org/config.html#max_prepared_statements) | [`prepared_statements_limit`](../configuration/pgdog.toml/general.md#prepared_statements_limit) | PgDog's [prepared statements](../features/prepared-statements.md) limit is soft and is only enforced on server connections. | +| [`unix_socket_dir`](https://www.pgbouncer.org/config.html#unix_socket_dir) | N/A | PgDog doesn't support UNIX sockets. | +| [`unix_socket_mode`](https://www.pgbouncer.org/config.html#unix_socket_mode) | N/A | Same as above. | +| [`unix_socket_group`](https://www.pgbouncer.org/config.html#unix_socket_group) | N/A | Same as above. | +| [`user`](https://www.pgbouncer.org/config.html#user) | N/A | Not currently configurable. Run as appropriate user via systemd or docker. | +| [`reserve_pool_timeout`](https://www.pgbouncer.org/config.html#reserve_pool_timeout) | N/A | PgDog doesn't support reserve connection pools. | +| [`max_user_connections`](https://www.pgbouncer.org/config.html#max_user_connections) | N/A | Not currently supported. | +| [`max_db_client_connections`](https://www.pgbouncer.org/config.html#max_db_client_connections) | N/A | Same as above. | +| [`max_user_client_connections`](https://www.pgbouncer.org/config.html#max_user_client_connections) | N/A | Same as above. | +| [`ignore_startup_parameters`](https://www.pgbouncer.org/config.html#ignore_startup_parameters) | N/A | Not currently supported. | +| [`peer_id`](https://www.pgbouncer.org/config.html#peer_id) | N/A | PgDog doesn't support peering. | +| [`disable_pqexec`](https://www.pgbouncer.org/config.html#disable_pqexec) | N/A | Not currently supported. | +| [`application_name_add_host`](https://www.pgbouncer.org/config.html#application_name_add_host) | N/A | Same as above. | +| [`scram_iterations`](https://www.pgbouncer.org/config.html#scram_iterations) | N/A | Same as above. | +| [`logfile`](https://www.pgbouncer.org/config.html#logfile) | N/A | PgDog logs to stdout/stderr. Use systemd or docker for log management. | +| [`pidfile`](https://www.pgbouncer.org/config.html#pidfile) | N/A | Not currently configurable. | +| [`conffile`](https://www.pgbouncer.org/config.html#conffile) | N/A | The path to `pgdog.toml` is passed as a CLI argument: `--config `. | + +##### Authentication settings + +Settings that control how clients and server connections authenticate. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`auth_type`](https://www.pgbouncer.org/config.html#auth_type) | [`auth_type`](../configuration/pgdog.toml/general.md#auth_type) | PgDog supports only a subset of [authentication](../features/authentication.md) mechanisms. +| [`auth_file`](https://www.pgbouncer.org/config.html#auth_file) | N/A | The path to `users.toml` can be passed in as a CLI argument on startup: `--users `. | +| [`auth_hba_file`](https://www.pgbouncer.org/config.html#auth_hba_file) | N/A | HBA authentication is not currently supported. | +| [`auth_ident_file`](https://www.pgbouncer.org/config.html#auth_ident_file) | N/A | Same as above. | +| [`auth_user`](https://www.pgbouncer.org/config.html#auth_user) | N/A | Query-based authentication is not currently supported. | +| [`auth_query`](https://www.pgbouncer.org/config.html#auth_query) | N/A | Same as above. | +| [`auth_dbname`](https://www.pgbouncer.org/config.html#auth_dbname) | N/A | Same as above. | +| [`auth_ldap_options`](https://www.pgbouncer.org/config.html#auth_ldap_options) | N/A | LDAP authentication is not currently supported. | + +##### Log settings + +Settings that control logging behavior. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`syslog`](https://www.pgbouncer.org/config.html#syslog) | N/A | PgDog logs to stdout/stderr. Use systemd or docker for syslog integration. | +| [`syslog_ident`](https://www.pgbouncer.org/config.html#syslog_ident) | N/A | Same as above. | +| [`syslog_facility`](https://www.pgbouncer.org/config.html#syslog_facility) | N/A | Same as above. | +| [`log_connections`](https://www.pgbouncer.org/config.html#log_connections) | [`log_connections`](../configuration/pgdog.toml/general.md#log_connections) | - | +| [`log_disconnections`](https://www.pgbouncer.org/config.html#log_disconnections) | [`log_disconnections`](../configuration/pgdog.toml/general.md#log_disconnections) | - | +| [`log_pooler_errors`](https://www.pgbouncer.org/config.html#log_pooler_errors) | N/A | PgDog always logs errors. | +| [`log_stats`](https://www.pgbouncer.org/config.html#log_stats) | N/A | Not currently supported. Use [metrics](../features/metrics.md) instead. | +| [`verbose`](https://www.pgbouncer.org/config.html#verbose) | N/A | Not currently configurable. Set log level via environment variable or CLI. | + +##### Administration settings + +Settings that control admin database access. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`admin_users`](https://www.pgbouncer.org/config.html#admin_users) | N/A | Admin users are configured separately in the [`[admin]`](../configuration/pgdog.toml/admin.md) section. | +| [`stats_users`](https://www.pgbouncer.org/config.html#stats_users) | N/A | There is no distinction between admin users and stats users in PgDog. | + +##### Connection checks + +Various connection-related and DNS-related settings. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`server_reset_query`](https://www.pgbouncer.org/config.html#server_reset_query) | N/A | Server state is [managed](../features/transaction-mode.md#session-state) by PgDog and different reset queries are used, depending on circumstances. | +| [`server_reset_query_always`](https://www.pgbouncer.org/config.html#server_reset_query_always) | N/A | Same as above. | +| [`server_check_query`](https://www.pgbouncer.org/config.html#server_check_query) | N/A | Not currently configurable. PgDog runs an empty query (`;`) by default. | +| [`server_check_delay`](https://www.pgbouncer.org/config.html#server_check_delay) | N/A | Not currently supported. | +| [`server_fast_close`](https://www.pgbouncer.org/config.html#server_fast_close) | N/A | Same as above. | +| [`server_lifetime`](https://www.pgbouncer.org/config.html#server_lifetime) | [`server_lifetime`](../configuration/pgdog.toml/general.md#server_lifetime) | - | +| [`server_idle_timeout`](https://www.pgbouncer.org/config.html#server_idle_timeout) | [`idle_timeout`](../configuration/pgdog.toml/general.md#idle_timeout) | - | +| [`server_connect_timeout`](https://www.pgbouncer.org/config.html#server_connect_timeout) | [`connect_timeout`](../configuration/pgdog.toml/general.md#connect_timeout) | - | +| [`server_login_retry`](https://www.pgbouncer.org/config.html#server_login_retry) | [`connect_attempt_delay`](../configuration/pgdog.toml/general.md#connect_attempt_delay) | PgDog can retry server connections for any error, not just authentication. | +| [`client_login_timeout`](https://www.pgbouncer.org/config.html#client_login_timeout) | [`client_login_timeout`](../configuration/pgdog.toml/general.md#client_login_timeout) | - | +| [`autodb_idle_timeout`](https://www.pgbouncer.org/config.html#autodb_idle_timeout) | N/A | Not applicable. PgDog doesn't auto-create database pools. | +| [`dns_max_ttl`](https://www.pgbouncer.org/config.html#dns_max_ttl) | [`dns_ttl`](../configuration/pgdog.toml/general.md#dns_ttl) | - | +| [`dns_nxdomain_ttl`](https://www.pgbouncer.org/config.html#dns_nxdomain_ttl) | N/A | Not currently supported. | +| [`dns_zone_check_period`](https://www.pgbouncer.org/config.html#dns_zone_check_period) | N/A | Same as above. | +| [`resolv_conf`](https://www.pgbouncer.org/config.html#resolv_conf) | N/A | Same as above. | + +##### TLS + +Settings that control how client and server connections use TLS. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`client_tls_sslmode`](https://www.pgbouncer.org/config.html#client_tls_sslmode) | [`tls_client_required`](../configuration/pgdog.toml/general.md#tls_client_required) | Boolean setting in PgDog only. `true` forces clients to use TLS, `false` doesn't. | +| [`client_tls_key_file`](https://www.pgbouncer.org/config.html#client_tls_key_file) | [`tls_private_key`](../configuration/pgdog.toml/general.md#tls_private_key) | - | +| [`client_tls_cert_file`](https://www.pgbouncer.org/config.html#client_tls_cert_file) | [`tls_certificate`](../configuration/pgdog.toml/general.md#tls_certificate) | - | +| [`client_tls_ca_file`](https://www.pgbouncer.org/config.html#client_tls_ca_file) | N/A | mTLS is not currently supported in PgDog. | +| [`client_tls_protocols`](https://www.pgbouncer.org/config.html#client_tls_protocols) | N/A | Only modern and secure protocols are supported. | +| [`client_tls_ciphers`](https://www.pgbouncer.org/config.html#client_tls_ciphers) | N/A | Same as above. | +| [`client_tls13_ciphers`](https://www.pgbouncer.org/config.html#client_tls13_ciphers) | N/A | Same as above. | +| [`client_tls_ecdhcurve`](https://www.pgbouncer.org/config.html#client_tls_ecdhcurve) | N/A | Same as above. | +| [`client_tls_dheparams`](https://www.pgbouncer.org/config.html#client_tls_dheparams) | N/A | Same as above. | +| [`server_tls_sslmode`](https://www.pgbouncer.org/config.html#server_tls_sslmode) | [`tls_verify`](../configuration/pgdog.toml/general.md#tls_verify) | Read more in [TLS](../features/tls.md#server-connections). | +| [`server_tls_ca_file`](https://www.pgbouncer.org/config.html#server_tls_ca_file) | [`tls_server_ca_certificate`](../configuration/pgdog.toml/general.md#tls_server_ca_certificate) | Same as above. | +| [`server_tls_key_file`](https://www.pgbouncer.org/config.html#server_tls_key_file) | N/A | PgDog doesn't support mTLS for server connections. | +| [`server_tls_cert_file`](https://www.pgbouncer.org/config.html#server_tls_cert_file) | N/A | Same as above. | +| [`server_tls_protocols`](https://www.pgbouncer.org/config.html#server_tls_protocols) | N/A | Same as `client_tls_protocols`. Only secure protocols are supported. | +| [`server_tls_ciphers`](https://www.pgbouncer.org/config.html#server_tls_ciphers) | N/A | Same as above. | +| [`server_tls13_ciphers`](https://www.pgbouncer.org/config.html#server_tls13_ciphers) | N/A | Same as above. | + +##### Dangerous timeouts + +Settings that can abort queries mid-transaction or forcibly close client or server connections. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`query_timeout`](https://www.pgbouncer.org/config.html#query_timeout) | [`query_timeout`](../configuration/pgdog.toml/general.md#query_timeout) | - | +| [`query_wait_timeout`](https://www.pgbouncer.org/config.html#query_wait_timeout) | [`checkout_timeout`](../configuration/pgdog.toml/general.md#checkout_timeout) | - | +| [`query_wait_notify`](https://www.pgbouncer.org/config.html#query_wait_notify) | N/A | Not currently supported. | +| [`client_idle_timeout`](https://www.pgbouncer.org/config.html#client_idle_timeout) | [`client_idle_timeout`](../configuration/pgdog.toml/general.md#client_idle_timeout) | - | +| [`idle_transaction_timeout`](https://www.pgbouncer.org/config.html#idle_transaction_timeout) | N/A | Not currently supported in PgDog. | +| [`transaction_timeout`](https://www.pgbouncer.org/config.html#transaction_timeout) | N/A | Same as above. | +| [`cancel_wait_timeout`](https://www.pgbouncer.org/config.html#cancel_wait_timeout) | N/A | Same as above. | +| [`suspend_timeout`](https://www.pgbouncer.org/config.html#suspend_timeout) | N/A | Not applicable. PgDog doesn't have a suspend/resume mechanism. | + +##### TCP settings + +Low-level network settings controlling how TCP works. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`tcp_keepalive`](https://www.pgbouncer.org/config.html#tcp_keepalive) | [`keepalive`](../configuration/pgdog.toml/network.md#keepalive) | Read more in [Network](../configuration/pgdog.toml/network.md) settings. | +| [`tcp_keepcnt`](https://www.pgbouncer.org/config.html#tcp_keepcnt) | [`retries`](../configuration/pgdog.toml/network.md#retries) | Same as above. | +| [`tcp_keepidle`](https://www.pgbouncer.org/config.html#tcp_keepidle) | [`time`](../configuration/pgdog.toml/network.md#time) | Same as above. | +| [`tcp_keepintvl`](https://www.pgbouncer.org/config.html#tcp_keepintvl) | [`interval`](../configuration/pgdog.toml/network.md#interval) | Same as above. | +| [`tcp_user_timeout`](https://www.pgbouncer.org/config.html#tcp_user_timeout) | [`user_timeout`](../configuration/pgdog.toml/network.md#user_timeout) | Same as above. | + +##### Low-level network settings + +Advanced network settings for performance tuning. + +| PgBouncer | PgDog | Notes | +|-|-|-| +| [`pkt_buf`](https://www.pgbouncer.org/config.html#pkt_buf) | N/A | `memory.net_buffer` (not yet documented). | +| [`max_packet_size`](https://www.pgbouncer.org/config.html#max_packet_size) | N/A | Same as above. | +| [`listen_backlog`](https://www.pgbouncer.org/config.html#listen_backlog) | N/A | Same as above. | +| [`sbuf_loopcnt`](https://www.pgbouncer.org/config.html#sbuf_loopcnt) | N/A | Same as above. | +| [`so_reuseport`](https://www.pgbouncer.org/config.html#so_reuseport) | N/A | Same as above. | +| [`tcp_defer_accept`](https://www.pgbouncer.org/config.html#tcp_defer_accept) | N/A | Same as above. | +| [`tcp_socket_buffer`](https://www.pgbouncer.org/config.html#tcp_socket_buffer) | N/A | Same as above. | + +### `userlist.txt` + +The PgBouncer's user list is a list of username/password pairs. The users listed there are allowed to connect to the pooler. PgDog does the same thing, using TOML, in [`users.toml`](../configuration/users.toml/users.md). + +=== "PgBouncer" + ```txt + "postgres" "hunter2" + "apples" "oranges" + ``` +=== "PgDog" + ```toml + [[users]] + name = "postgres" + database = "prod" + password = "hunter2" + + [[users]] + name = "apples" + database = "staging" + password = "oranges" + ``` + +In addition to passwords, [`users.toml`](../configuration/users.toml/users.md) entries allow to configure user-specific overrides, for example: + +```toml +[[users]] +name = "postgres" +database = "postgres" +password = "hunter2" +pooler_mode = "session" +``` + +## Read more + +- [`pgdog.toml`](../configuration/pgdog.toml/general.md) +- [`users.toml`](../configuration/users.toml/users.md) diff --git a/docs/migrating-to-prod.md b/docs/migrating-to-pgdog/index.md similarity index 57% rename from docs/migrating-to-prod.md rename to docs/migrating-to-pgdog/index.md index 86c1aac..f19b258 100644 --- a/docs/migrating-to-prod.md +++ b/docs/migrating-to-pgdog/index.md @@ -1,26 +1,29 @@ --- icon: material/list-status --- -# Migrating to PgDog + +# Migration overview PgDog attempts to make the migration from other connection poolers as smooth as possible. That being said, some changes to your infrastructure may be required to benefit from all our features. ## Configuration -PgDog uses the **TOML** configuration language for its [configuration](configuration/index.md) files. If you're coming from PgBouncer, you'll need to rewrite your configs. We separate user [authentication](features/authentication.md) (usernames, passwords) from the main settings, so you'll still be able to encrypt passwords in production. +PgDog uses the **TOML** language for its [configuration](../configuration/index.md) files. If you're coming from PgBouncer, you'll need to rewrite your configs. We separate user [authentication](../features/authentication.md) (usernames, passwords) from the main settings, so you'll still be able to encrypt passwords in production. + +See [migrating from PgBouncer](from-pgbouncer.md) for more info. ## Monitoring PgDog has two ways to get real time statistics about its internal operations: -1. PgBouncer-style [admin database](administration/index.md) -2. Prometheus [metrics](features/metrics.md) +1. PgBouncer-style [admin database](../administration/index.md) +2. Prometheus [metrics](../features/metrics.md) The admin database isn't 100% compatible with PgBouncer. We have additional fields that reflect our added features. That being said, we try to keep naming conventions as similar as possible, so your existing monitoring tools have a high chance of working without modifications. ## Sharding -Sharding is a novel feature not available in other connection poolers. We've added a ["dry run" mode](features/sharding/dry-run.md) to allow you to experiment with it in production, without changing how your databases work. +Sharding is a novel feature not available in other connection poolers. We've added a ["dry run" mode](../features/sharding/dry-run.md) to allow you to experiment with it in production, without changing how your databases work. In dry run mode, PgDog will parse every single query and record the decision of its query router in an admin view. You can see, in real time, how many queries would go to a single shard (vs. cross-shard), by querying that view: