From 3a033feebc013d0188fac9ab90b3d9452d476973 Mon Sep 17 00:00:00 2001 From: Mehedi Hasan <39819064+heheh13@users.noreply.github.com> Date: Fri, 13 Oct 2023 17:35:32 +0600 Subject: [PATCH] Add docs for MySQL and PostgreSQL remote replica (#568) Signed-off-by: Mehedi Hasan --- docs/CHANGELOG-v2023.10.9.md | 282 ------------------ .../mysql/clustering/remote-replica/index.md | 12 +- docs/guides/postgres/remote-replica/_index.md | 7 +- .../postgres/remote-replica/remotereplica.md | 113 ++++++- 4 files changed, 107 insertions(+), 307 deletions(-) delete mode 100644 docs/CHANGELOG-v2023.10.9.md diff --git a/docs/CHANGELOG-v2023.10.9.md b/docs/CHANGELOG-v2023.10.9.md deleted file mode 100644 index 9eafefbf97..0000000000 --- a/docs/CHANGELOG-v2023.10.9.md +++ /dev/null @@ -1,282 +0,0 @@ ---- -title: Changelog | KubeDB -description: Changelog -menu: - docs_{{.version}}: - identifier: changelog-kubedb-v2023.10.9 - name: Changelog-v2023.10.9 - parent: welcome - weight: 20231009 -product_name: kubedb -menu_name: docs_{{.version}} -section_menu_id: welcome -url: /docs/{{.version}}/welcome/changelog-v2023.10.9/ -aliases: - - /docs/{{.version}}/CHANGELOG-v2023.10.9/ ---- - -# KubeDB v2023.10.9 (2023-10-10) - - -## [kubedb/apimachinery](https://github.com/kubedb/apimachinery) - -### [v0.36.0](https://github.com/kubedb/apimachinery/releases/tag/v0.36.0) - - - - -## [kubedb/autoscaler](https://github.com/kubedb/autoscaler) - -### [v0.21.0](https://github.com/kubedb/autoscaler/releases/tag/v0.21.0) - -- [2a8f602d](https://github.com/kubedb/autoscaler/commit/2a8f602d) Prepare for release v0.21.0 (#156) -- [e5d14b17](https://github.com/kubedb/autoscaler/commit/e5d14b17) Merge pull request #155 from kubedb/sc -- [170f72b4](https://github.com/kubedb/autoscaler/commit/170f72b4) Set seccompProfile to RuntimeDefault - - - -## [kubedb/cli](https://github.com/kubedb/cli) - -### [v0.36.0](https://github.com/kubedb/cli/releases/tag/v0.36.0) - -- [54f42c6a](https://github.com/kubedb/cli/commit/54f42c6a) Prepare for release v0.36.0 (#726) -- [73976008](https://github.com/kubedb/cli/commit/73976008) add support for remote-config (#723) -- [ceb2bda4](https://github.com/kubedb/cli/commit/ceb2bda4) Use apply: Always for restart command (#725) - - - -## [kubedb/dashboard](https://github.com/kubedb/dashboard) - -### [v0.12.0](https://github.com/kubedb/dashboard/releases/tag/v0.12.0) - -- [b1d6bf2e](https://github.com/kubedb/dashboard/commit/b1d6bf2e) Prepare for release v0.12.0 (#82) -- [57aa22a2](https://github.com/kubedb/dashboard/commit/57aa22a2) Add seccomp profile to installer securityContext - - - -## [kubedb/elasticsearch](https://github.com/kubedb/elasticsearch) - -### [v0.36.0](https://github.com/kubedb/elasticsearch/releases/tag/v0.36.0) - -- [3519e493](https://github.com/kubedb/elasticsearch/commit/3519e4933) Prepare for release v0.36.0 (#670) -- [9766b3cd](https://github.com/kubedb/elasticsearch/commit/9766b3cd5) Update daily-opensearch.yml -- [875eff12](https://github.com/kubedb/elasticsearch/commit/875eff129) Fix support for OS hot-warm-cold nodes (#669) -- [b51b628e](https://github.com/kubedb/elasticsearch/commit/b51b628ee) Install Kibana Dashboard controller before running opensearch e2e - - - -## [kubedb/installer](https://github.com/kubedb/installer) - -### [v2023.10.9](https://github.com/kubedb/installer/releases/tag/v2023.10.9) - - - - -## [kubedb/kafka](https://github.com/kubedb/kafka) - -### [v0.7.0](https://github.com/kubedb/kafka/releases/tag/v0.7.0) - -- [0119452](https://github.com/kubedb/kafka/commit/0119452) Prepare for release v0.7.0 (#40) -- [e26604d](https://github.com/kubedb/kafka/commit/e26604d) Add primary-service address to advertised.listeners (#39) -- [c3bcf55](https://github.com/kubedb/kafka/commit/c3bcf55) Patch service ports with spec.serviceTemplate (#38) -- [a11bfd6](https://github.com/kubedb/kafka/commit/a11bfd6) Add external advertised listener and Redesign reconcile (#37) -- [727f414](https://github.com/kubedb/kafka/commit/727f414) Add seccomp profile to makefile (#36) - - - -## [kubedb/mariadb](https://github.com/kubedb/mariadb) - -### [v0.20.0](https://github.com/kubedb/mariadb/releases/tag/v0.20.0) - -- [949c14e3](https://github.com/kubedb/mariadb/commit/949c14e3) Prepare for release v0.20.0 (#230) -- [24de9c01](https://github.com/kubedb/mariadb/commit/24de9c01) Set seccompProfile to RuntimeDefault (#229) - - - -## [kubedb/mariadb-coordinator](https://github.com/kubedb/mariadb-coordinator) - -### [v0.16.0](https://github.com/kubedb/mariadb-coordinator/releases/tag/v0.16.0) - -- [4ab95aeb](https://github.com/kubedb/mariadb-coordinator/commit/4ab95aeb) Prepare for release v0.16.0 (#90) - - - -## [kubedb/memcached](https://github.com/kubedb/memcached) - -### [v0.29.0](https://github.com/kubedb/memcached/releases/tag/v0.29.0) - -- [cd5ddf0c](https://github.com/kubedb/memcached/commit/cd5ddf0c) Prepare for release v0.29.0 (#403) - - - -## [kubedb/mongodb](https://github.com/kubedb/mongodb) - -### [v0.29.0](https://github.com/kubedb/mongodb/releases/tag/v0.29.0) - -- [56c9cecd](https://github.com/kubedb/mongodb/commit/56c9cecd) Prepare for release v0.29.0 (#570) -- [4ceb44cb](https://github.com/kubedb/mongodb/commit/4ceb44cb) Health check for unusual secondary lock (#569) -- [10a4fd76](https://github.com/kubedb/mongodb/commit/10a4fd76) Set seccompProfile to RuntimeDefault (#561) - - - -## [kubedb/mysql-coordinator](https://github.com/kubedb/mysql-coordinator) - -### [v0.14.0](https://github.com/kubedb/mysql-coordinator/releases/tag/v0.14.0) - -- [bc3b65c](https://github.com/kubedb/mysql-coordinator/commit/bc3b65c) Prepare for release v0.14.0 (#86) - - - -## [kubedb/mysql-router-init](https://github.com/kubedb/mysql-router-init) - -### [v0.14.0](https://github.com/kubedb/mysql-router-init/releases/tag/v0.14.0) - - - - -## [kubedb/ops-manager](https://github.com/kubedb/ops-manager) - -### [v0.23.0](https://github.com/kubedb/ops-manager/releases/tag/v0.23.0) - - - - -## [kubedb/percona-xtradb](https://github.com/kubedb/percona-xtradb) - -### [v0.23.0](https://github.com/kubedb/percona-xtradb/releases/tag/v0.23.0) - -- [21b46846](https://github.com/kubedb/percona-xtradb/commit/21b46846) Prepare for release v0.23.0 (#329) -- [f1c04f03](https://github.com/kubedb/percona-xtradb/commit/f1c04f03) Set seccompProfile to RuntimeDefault (#328) - - - -## [kubedb/percona-xtradb-coordinator](https://github.com/kubedb/percona-xtradb-coordinator) - -### [v0.9.0](https://github.com/kubedb/percona-xtradb-coordinator/releases/tag/v0.9.0) - -- [94433e4](https://github.com/kubedb/percona-xtradb-coordinator/commit/94433e4) Prepare for release v0.9.0 (#47) - - - -## [kubedb/pg-coordinator](https://github.com/kubedb/pg-coordinator) - -### [v0.20.0](https://github.com/kubedb/pg-coordinator/releases/tag/v0.20.0) - -- [e3aa0fe7](https://github.com/kubedb/pg-coordinator/commit/e3aa0fe7) Prepare for release v0.20.0 (#133) - - - -## [kubedb/pgbouncer](https://github.com/kubedb/pgbouncer) - -### [v0.23.0](https://github.com/kubedb/pgbouncer/releases/tag/v0.23.0) - -- [2b2636f5](https://github.com/kubedb/pgbouncer/commit/2b2636f5) Prepare for release v0.23.0 (#290) - - - -## [kubedb/postgres](https://github.com/kubedb/postgres) - -### [v0.36.0](https://github.com/kubedb/postgres/releases/tag/v0.36.0) - -- [3085d92c](https://github.com/kubedb/postgres/commit/3085d92c1) Prepare for release v0.36.0 (#671) -- [2c16dc52](https://github.com/kubedb/postgres/commit/2c16dc52a) Run release workflows on high priority workers (#670) -- [57309782](https://github.com/kubedb/postgres/commit/573097827) Set seccompProfile to RuntimeDefault (#667) -- [90fe6045](https://github.com/kubedb/postgres/commit/90fe60458) update apimacinery (#666) -- [c95eb6a7](https://github.com/kubedb/postgres/commit/c95eb6a70) add support for remote replica (#665) - - - -## [kubedb/provisioner](https://github.com/kubedb/provisioner) - -### [v0.36.0](https://github.com/kubedb/provisioner/releases/tag/v0.36.0) - -- [bcf6db2d](https://github.com/kubedb/provisioner/commit/bcf6db2d9) Prepare for release v0.36.0 (#56) - - - -## [kubedb/proxysql](https://github.com/kubedb/proxysql) - -### [v0.23.0](https://github.com/kubedb/proxysql/releases/tag/v0.23.0) - -- [7688d9df](https://github.com/kubedb/proxysql/commit/7688d9df) Prepare for release v0.23.0 (#311) - - - -## [kubedb/redis](https://github.com/kubedb/redis) - -### [v0.29.0](https://github.com/kubedb/redis/releases/tag/v0.29.0) - -- [2941778b](https://github.com/kubedb/redis/commit/2941778b) Prepare for release v0.29.0 (#486) -- [c0292f61](https://github.com/kubedb/redis/commit/c0292f61) Set seccompProfile to RuntimeDefault (#485) - - - -## [kubedb/redis-coordinator](https://github.com/kubedb/redis-coordinator) - -### [v0.15.0](https://github.com/kubedb/redis-coordinator/releases/tag/v0.15.0) - -- [2410719](https://github.com/kubedb/redis-coordinator/commit/2410719) Prepare for release v0.15.0 (#78) - - - -## [kubedb/replication-mode-detector](https://github.com/kubedb/replication-mode-detector) - -### [v0.23.0](https://github.com/kubedb/replication-mode-detector/releases/tag/v0.23.0) - -- [e1bcb02e](https://github.com/kubedb/replication-mode-detector/commit/e1bcb02e) Prepare for release v0.23.0 (#242) - - - -## [kubedb/schema-manager](https://github.com/kubedb/schema-manager) - -### [v0.12.0](https://github.com/kubedb/schema-manager/releases/tag/v0.12.0) - -- [c57b7709](https://github.com/kubedb/schema-manager/commit/c57b7709) Prepare for release v0.12.0 (#83) -- [5a624bde](https://github.com/kubedb/schema-manager/commit/5a624bde) Merge pull request #82 from kubedb/sc -- [26d04829](https://github.com/kubedb/schema-manager/commit/26d04829) Set seccompProfile to RuntimeDefault - - - -## [kubedb/tests](https://github.com/kubedb/tests) - -### [v0.21.0](https://github.com/kubedb/tests/releases/tag/v0.21.0) - -- [841fe9e9](https://github.com/kubedb/tests/commit/841fe9e9) Prepare for release v0.21.0 (#262) -- [eed6ebcb](https://github.com/kubedb/tests/commit/eed6ebcb) Fix autoscaler test profiles (#261) -- [a2df0e09](https://github.com/kubedb/tests/commit/a2df0e09) MySQL autoscale test fix (#260) -- [b7cc5aaf](https://github.com/kubedb/tests/commit/b7cc5aaf) Fix Mysql Test Issue for Elasticsearchversion. (#259) -- [b9da67f3](https://github.com/kubedb/tests/commit/b9da67f3) Use storageclass flag for autoscaling, if set (#258) -- [0cd78c0b](https://github.com/kubedb/tests/commit/0cd78c0b) Unfocus tests -- [30fd08c8](https://github.com/kubedb/tests/commit/30fd08c8) Fix hot-warm-cold clustering tests for OpenSearch (#257) -- [b43235f9](https://github.com/kubedb/tests/commit/b43235f9) Fix Test for Downscaling ES data nodes (#256) -- [8206ec72](https://github.com/kubedb/tests/commit/8206ec72) Add missing provisioner tests for Elasticsearch (#247) -- [6f289856](https://github.com/kubedb/tests/commit/6f289856) Add Stash Auto-backup tests for Redis (#252) -- [70db31e5](https://github.com/kubedb/tests/commit/70db31e5) Add AutoScaler for MySQL and Fixed in MariaDB (#246) -- [816804c6](https://github.com/kubedb/tests/commit/816804c6) Add redis restore tests (#249) -- [e73c3465](https://github.com/kubedb/tests/commit/e73c3465) Add missing provisioner e2e test - custom auth secret tests (#244) -- [5adcf205](https://github.com/kubedb/tests/commit/5adcf205) Add stash backup tests (#245) -- [bedb2081](https://github.com/kubedb/tests/commit/bedb2081) Exclude volume expansion test (#248) -- [fddc0a69](https://github.com/kubedb/tests/commit/fddc0a69) Fix existing tests for ES & OS (#236) -- [0089ac1d](https://github.com/kubedb/tests/commit/0089ac1d) Ensure minio-server for stash-related tests (#243) - - - -## [kubedb/ui-server](https://github.com/kubedb/ui-server) - -### [v0.12.0](https://github.com/kubedb/ui-server/releases/tag/v0.12.0) - -- [e1e491ca](https://github.com/kubedb/ui-server/commit/e1e491ca) Prepare for release v0.12.0 (#91) -- [119250af](https://github.com/kubedb/ui-server/commit/119250af) Set seccompProfile to RuntimeDefault (#90) - - - -## [kubedb/webhook-server](https://github.com/kubedb/webhook-server) - -### [v0.12.0](https://github.com/kubedb/webhook-server/releases/tag/v0.12.0) - -- [24369a19](https://github.com/kubedb/webhook-server/commit/24369a19) Prepare for release v0.12.0 (#68) -- [0e9ffedc](https://github.com/kubedb/webhook-server/commit/0e9ffedc) Set seccompProfile to RuntimeDefault (#67) - - - - diff --git a/docs/guides/mysql/clustering/remote-replica/index.md b/docs/guides/mysql/clustering/remote-replica/index.md index 3b65d78dea..e7505e250c 100644 --- a/docs/guides/mysql/clustering/remote-replica/index.md +++ b/docs/guides/mysql/clustering/remote-replica/index.md @@ -37,7 +37,7 @@ Before proceeding: > Note: The yaml files used in this tutorial are stored in [docs/guides/mysql/clustering/remote-replica/yamls](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/guides/mysql/clustering/group-replication/yamls) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). ## Remote Replica -The remote replica allows you to replicate data from an KubeDB managed MySQL server to a read-only mysql server.The whole process uses MySQL asynchronous replication to keep up-to-date the replica with source server. +The remote replica allows you to replicate data from an KubeDB managed MySQL server to a read-only mysql server. The whole process uses MySQL asynchronous replication to keep up-to-date the replica with source server. It's useful to use remote replica to scale of read-intensive workloads, can be a workaround for your BI and analytical workloads and can be geo-replicated. ## Deploy Mysql server @@ -241,7 +241,7 @@ mysql-singapore nginx mysql-singapore.something.org 172.104.37.147 80 ``` Now will be able to communicate from another cluster to our source database # Prepare for Remote Replica -We wil use the [kubedb_plugin](somelink) for generating configuration for remote replica. It will create the appbinding and and necessary secrets to connect with source server +We wil use the [kubedb_plugin](/docs/setup/README.md) for generating configuration for remote replica. It will create the appbinding and and necessary secrets to connect with source server ```bash $ kubectl dba remote-config mysql -n demo mysql-singapore -uremote -ppass -d 172.104.37.147 -y home/mehedi/go/src/kubedb.dev/yamls/mysql/mysql-singapore-remote-config.yaml @@ -249,7 +249,7 @@ home/mehedi/go/src/kubedb.dev/yamls/mysql/mysql-singapore-remote-config.yaml # Create Remote Replica We have prepared another cluster in london region for replicating across cluster. follow the installation instruction [above](/docs/README.md). -### create sourceRef +### Create sourceRef We will apply the generated config from kubeDB plugin to create the source refs and secrets for it @@ -265,8 +265,8 @@ NAME TYPE VERSION AGE mysql-singapore kubedb.com/mysql 8.0.31 4m17s ``` -### create remote replica auth -we will need to use the same auth secrets for remote replicas as well since operations like clone also replicated the auth-secrets from source server +### Create remote replica auth +We will need to use the same auth secrets for remote replicas as well since operations like clone also replicated the auth-secrets from source server ```yaml apiVersion: v1 data: @@ -322,7 +322,7 @@ Here, - `spec.topology.remoteReplica.sourceref` we are referring to source to read. The mysql instance we previously created. - `spec.terminationPolicy` specifies what KubeDB should do when a user try to delete the operation of MySQL CR. *Wipeout* means that the database will be deleted without restrictions. It can also be "Halt", "Delete" and "DoNotTerminate". Learn More about these [HERE](https://kubedb.com/docs/latest/guides/mysql/concepts/database/#specterminationpolicy). ```bash -$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/clustering/remote-replica/mysql-london.yaml +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/clustering/remote-replica/yamls/mysql-london.yaml mysql.kubedb.com/mysql-london created ``` diff --git a/docs/guides/postgres/remote-replica/_index.md b/docs/guides/postgres/remote-replica/_index.md index 354a87c470..7b34f80115 100644 --- a/docs/guides/postgres/remote-replica/_index.md +++ b/docs/guides/postgres/remote-replica/_index.md @@ -1,10 +1,11 @@ --- -title: PostgreSQL Quickstart +title: PostgreSQL Remote Replica menu: docs_{{ .version }}: identifier: pg-remote-replica - name: Quickstart + name: Remote Replica parent: pg-postgres-guides - weight: 16 + weight: 27 menu_name: docs_{{ .version }} --- + diff --git a/docs/guides/postgres/remote-replica/remotereplica.md b/docs/guides/postgres/remote-replica/remotereplica.md index 4b7a4901a3..d0d340b97a 100644 --- a/docs/guides/postgres/remote-replica/remotereplica.md +++ b/docs/guides/postgres/remote-replica/remotereplica.md @@ -12,13 +12,9 @@ section_menu_id: guides > New to KubeDB? Please start [here](/docs/README.md). -# Running PostgreSQL +# KubeDB - PostgreSQL Remote Replica -This tutorial will show you how to use KubeDB to run a PostgreSQL database. - -

-  lifecycle -

+This tutorial will show you how to use KubeDB to provision a PostgreSQL Remote Replica from a KubeDB managed PostgreSQL instance. Remote replica can used in in or across cluster ## Before You Begin @@ -33,6 +29,12 @@ $ kubectl create ns demo namespace/demo created ``` > Note: The yaml files used in this tutorial are stored in [docs/guides/postgres/remote-replica/yamls](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/guides/postgres/remote-replica/yamls) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Remote Replica + +The remote replica allows you to replicate data from an KubeDB managed PostgreSQL server to a read-only PostgreSQL server. The whole process uses PostgreSQL asynchronous replication to keep up-to-date the replica with source server. +It's useful to use remote replica to scale of read-intensive workloads, can be a workaround for your BI and analytical workloads and can be geo-replicated. + ## Deploy PostgreSQL server The following is an example `PostgreSQL` object which creates a PostgreSQL cluster instance.we will create a tls secure instance since were planing to replicated across cluster @@ -93,12 +95,12 @@ metadata: namespace: demo type: kubernetes.io/basic-auth ``` + ```bash $ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/remote-replica/yamls/pg-singapore-auth.yaml secret/pg-singapore-auth created ``` -## Deploy PostgreSQL server ## Deploy PostgreSQL with TLS/SSL configuration ```yaml apiVersion: kubedb.com/v1alpha2 @@ -196,16 +198,16 @@ pg-singapore nginx pg-singapore.something.org 172.104.37.147 80 ``` # Prepare for Remote Replica -We wil use the [kubedb_plugin](somelink) for generating configuration for remote replica. It will create the appbinding and and necessary secrets to connect with source server +We wil use the [kubedb_plugin](/docs/setup/README.md) for generating configuration for remote replica. It will create the appbinding and and necessary secrets to connect with source server ```bash $ kubectl dba remote-config postgres -n demo pg-singapore -uremote -ppass -d 172.104.37.147 -y -home/mehedi/go/src/kubedb.dev/yamls/mysql/pg-singapore-remote-config.yaml +home/mehedi/go/src/kubedb.dev/yamls/postgres/pg-singapore-remote-config.yaml ``` # Create Remote Replica We have prepared another cluster in london region for replicating across cluster. follow the installation instruction [above](/docs/README.md). -### create sourceRef +### Create sourceRef We will apply the generated config from kubeDB plugin to create the source refs and secrets for it ```bash @@ -215,8 +217,8 @@ secret/pg-singapore-client-cert-remote created appbinding.appcatalog.appscode.com/pg-singapore created ``` -### create remote replica auth -we will need to use the same auth secrets for remote replicas as well since operations like clone also replicated the auth-secrets from source server +### Create remote replica auth +We will need to use the same auth secrets for remote replicas as well since operations like clone also replicated the auth-secrets from source server ```yaml apiVersion: v1 @@ -268,13 +270,13 @@ spec: ``` ```bash -$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/remote-replica/pg-london.yaml -mysql.kubedb.com/pg-london created +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/remote-replica/yamls/pg-london.yaml +postgres.kubedb.com/pg-london created ``` -Now we will be able to see kubedb will provision a Remote Replica from the source mysql instance. Lets checkout out the statefulSet , pvc , pv and services associated with it +Now we will be able to see kubedb will provision a Remote Replica from the source postgres instance. Lets checkout out the statefulSet , pvc , pv and services associated with it . -KubeDB operator sets the `status.phase` to `Ready` once the database is successfully created. Run the following command to see the modified `MySQL` object: +KubeDB operator sets the `status.phase` to `Ready` once the database is successfully created. Run the following command to see the modified `PostgreSQL` object: ```bash $ kubectl get pg -n demo NAME VERSION STATUS AGE @@ -283,3 +285,82 @@ pg-london 15.3 Ready 7m17s ## Validate Remote Replica +At this point we want to validate the replication, we can see `pg-london-0` is connected as asynchronous replica + +### Validate from source + +```bash +$ kubectl exec -it -n demo pg-singapore-0 -c postgres -- psql -c "select * from pg_stat_replication"; + pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | backend_xmin | state | sent_lsn | write_lsn | flush_lsn | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_state | reply_time +--------+----------+----------+------------------+-------------+-----------------+-------------+-------------------------------+--------------+-----------+-----------+-----------+-----------+------------+-----------------+-----------------+-----------------+---------------+------------+------------------------------- + 121 | 10 | postgres | pg-singapore-1 | 10.2.1.13 | | 37990 | 2023-10-12 06:53:50.402925+00 | | streaming | 0/89758A8 | 0/89758A8 | 0/89758A8 | 0/89758A8 | 00:00:00.000745 | 00:00:00.00484 | 00:00:00.004848 | 1 | quorum | 2023-10-13 05:43:53.817575+00 + 209 | 10 | postgres | pg-singapore-2 | 10.2.0.11 | | 51270 | 2023-10-12 06:54:15.759067+00 | | streaming | 0/89758A8 | 0/89758A8 | 0/89758A8 | 0/89758A8 | 00:00:00.000581 | 00:00:00.009797 | 00:00:00.009955 | 1 | quorum | 2023-10-13 05:43:53.823562+00 + 205338 | 16394 | remote | pg-london-0 | 10.2.1.10 | | 34850 | 2023-10-12 20:15:07.751715+00 | | streaming | 0/89758A8 | 0/89758A8 | 0/89758A8 | 0/89758A8 | 00:00:00.158877 | 00:00:00.163418 | 00:00:00.163425 | 0 | async | 2023-10-13 05:43:53.900061+00 +(3 rows) + +### Validate from remote replica + +$ kubectl exec -it -n demo pg-london-0 -c postgres -- psql -c "select * from pg_stat_wal_receiver"; + pid | status | receive_start_lsn | receive_start_tli | written_lsn | flushed_lsn | received_tli | last_msg_send_time | last_msg_receipt_time | latest_end_lsn | latest_end_time | slot_name | sender_host | sender_port | conninfo +------+-----------+-------------------+-------------------+-------------+-------------+--------------+-------------------------------+-------------------------------+----------------+-------------------------------+-----------+----------------+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4813 | streaming | 0/8000000 | 1 | 0/8DC01E0 | 0/8DC01E0 | 1 | 2023-10-13 05:54:33.812544+00 | 2023-10-13 05:54:33.893159+00 | 0/8DC01E0 | 2023-10-13 05:54:33.812544+pplication_name=walreceiver sslmode=verify-full sslcompression=0 sslcert=/tls/certs/remote/client.crt sslkey=/tls/certs/remote/client.key sslrootcert=/tls/certs/remote/ca.crt sslsni=1 ssl_min_protocol_version=TLSv1.2 gssencmode=prefer krbsrvname=postgres target_session_attrs=any +(1 row) +## Validation data replication +lets create a a database and insert some data + +$ kubectl exec -it -n demo pg-singapore-0 -c postgres -- psql -c "create database hi"; +CREATE DATABASE + +$ kubectl exec -it -n demo pg-singapore-0 -c postgres -- psql -c "create table tab_1 ( a int); insert into tab_1 values(generate_series(1,5))"; +CREATE TABLE +INSERT 0 5 + +### Validate data on primary +kubectl exec -it -n demo pg-singapore-0 -c postgres -- psql -c "select * from tab_1"; + a +--- + 1 + 2 + 3 + 4 + 5 +(5 rows) + +### Validate data on remote replica + +$ kubectl exec -it -n demo pg-london-0 -c postgres -- psql -c "select * from tab_1"; + a +--- + 1 + 2 + 3 + 4 + 5 +(5 rows) + +``` + +## Cleaning up + +To cleanup the Kubernetes resources created by this tutorial, run: + +```bash +kubectl delete -n demo pg/pg-singapore +kubectl delete -n demo pg/pg-london +kubectl delete secret -n demo pg-singapore-auth +kubectl delete secret -n demo pg-london-auth +kubectl delete ingres -n demo pg-singapore +kubectl delete ns demo +``` + +## Next Steps + +- Learn about [backup and restore](/docs/guides/postgres/backup/overview/index.md) PostgreSQL database using Stash. +- Learn about initializing [PostgreSQL with Script](/docs/guides/postgres/initialization/script_source.md). +- Learn about [custom PostgresVersions](/docs/guides/postgres/custom-versions/setup.md). +- Want to setup PostgreSQL cluster? Check how to [configure Highly Available PostgreSQL Cluster](/docs/guides/postgres/clustering/ha_cluster.md) +- Monitor your PostgreSQL database with KubeDB using [built-in Prometheus](/docs/guides/postgres/monitoring/using-builtin-prometheus.md). +- Monitor your PostgreSQL database with KubeDB using [Prometheus operator](/docs/guides/postgres/monitoring/using-prometheus-operator.md). +- Detail concepts of [Postgres object](/docs/guides/postgres/concepts/postgres.md). +- Use [private Docker registry](/docs/guides/postgres/private-registry/using-private-registry.md) to deploy PostgreSQL with KubeDB. +- Want to hack on KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md). \ No newline at end of file