Skip to content

Commit

Permalink
readme tweaks (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
annadowling authored Jun 4, 2024
1 parent 4a73b31 commit 4f2ee2c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ All [Logical Replication Restrictions](https://www.postgresql.org/docs/current/l

## Usage

Ensure `SOURCE_DB_URL` and `TARGET_DB_URL` are present as environment variables in the runtime environment. The URL are of the postgres connection string format. Example:
Ensure `SOURCE_DB_URL` and `TARGET_DB_URL` are present as environment variables in the runtime environment.
- `SOURCE_DB_URL` = The database that you want to replicate FROM.
- `TARGET_DB_URL` = The database that you want to replicate TO.

The URL should be in postgres connection string format. Example:
```bash
$ export SOURCE_DB_URL="postgres://USERNAME:PASSWORD@localhost:5432/DATABASE_NAME"
$ export TARGET_DB_URL="postgres://USERNAME:PASSWORD@localhost:5433/DATABASE_NAME"
Expand All @@ -84,6 +87,12 @@ You can extend the default timeout by setting the following environment variable
$ export PG_EASY_REPLICATE_STATEMENT_TIMEOUT="10s" # default 5s
```

You can get additional debug logging by adding the following environment variable

```bash
$ export DEBUG="true"
```

Any `pg_easy_replicate` command can be run the same way with the docker image as well. As long the container is running in an environment where it has access to both the databases. Example

```bash
Expand Down Expand Up @@ -247,6 +256,19 @@ $ pg_easy_replicate switchover --group-name database-cluster-2
...
```
### Cleanup
Use `cleanup` if you want to remove all bootstrapped data for the specified group. Additionally you can pass `-e` or `--everything` in order to clean up all schema changes for bootstrapped tables, users and any publication/subscription data.
```bash
$ pg_easy_replicate cleanup --group-name database-cluster-1 --everything
{"name":"pg_easy_replicate","hostname":"PKHXQVK6DW","pid":24192,"level":30,"time":"2023-06-19T16:05:23.033-04:00","v":0,"msg":"Dropping groups table","version":"0.1.0"}
{"name":"pg_easy_replicate","hostname":"PKHXQVK6DW","pid":24192,"level":30,"time":"2023-06-19T16:05:23.033-04:00","v":0,"msg":"Dropping schema","version":"0.1.0"}
...
```
## Switchover strategies with minimal downtime
For minimal downtime, it'd be best to watch/tail the stats and wait until `switchover_completed_at` is updated with a timestamp. Once that happens you can perform any of the following strategies. Note: These are just suggestions and `pg_easy_replicate` doesn't provide any functionalities for this.
Expand Down

0 comments on commit 4f2ee2c

Please sign in to comment.