Introduction
Replication Server is an asynchronous replication system available for PostgreSQL and for EDB Postgres Advanced Server.
You can use Replication Server to implement replication systems based on either of two different replication models: single-master (primary-to-secondary) replication or multi-master replication. Regardless of the replication model, Replication Server is flexible and easy to use.
For single-master replication, PostgreSQL, EDB Postgres Advanced Server, Oracle, and Microsoft SQL Server are supported in an assortment of configurations (including cascading replication), allowing organizations to use it in multiple use cases with a variety of benefits. The following are some combinations of cross database replications that Replication Server supports for single-master replication:
- From Oracle to PostgreSQL
- From Oracle to EDB Postgres Advanced Server
- From SQL Server to PostgreSQL
- From SQL Server to EDB Postgres Advanced Server
- From EDB Postgres Advanced Server to Oracle
- From PostgreSQL to SQL Server
- From EDB Postgres Advanced Server to SQL Server
- Between PostgreSQL and EDB Postgres Advanced Server
- From PostgreSQL to Oracle (WAL mode)
- From PostgreSQL to Oracle (trigger mode)
For multi-master replication, Replication Server supports the following configurations:
- Between PostgreSQL database servers
- Between PostgreSQL database servers and EDB Postgres Advanced Servers in PostgreSQL-compatible mode
- Between EDB Postgres Advanced Servers in PostgreSQL compatible mode
- Between EDB Postgres Advanced Servers in Oracle compatible mode
Installation
- Install the package (edb-xdb)
- Installing a JDBC driver (edb-jdbc)
After setup EDB repositories, we install edb-xdb & edb-jdbc packages on both Publication server and Subscription server
[root@edb-saigon ~]# dnf install edb-xdb edb-jdbc
Verify information
[root@edb-saigon ~]# java -version
openjdk version "11.0.23" 2024-04-16 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.23.0.9-3.0.1) (build 11.0.23+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.23.0.9-3.0.1) (build 11.0.23+9-LTS, mixed mode, sharing)
[root@edb-saigon ~]# ls -l /usr/edb/xdb/ //this is XDB_HOME
total 88
drwxr-xr-x. 2 root root 4096 Jun 7 11:24 bin
-r--r--r--. 1 root root 15272 May 17 11:31 edb-xdb_license.txt
drwxr-xr-x. 3 root root 151 Jun 7 11:24 etc
drwxr-xr-x. 4 root root 4096 Jun 7 11:24 lib
drwx------. 2 enterprisedb enterprisedb 6 May 17 11:34 xdata
-r--r--r--. 1 enterprisedb enterprisedb 61497 May 17 11:31 xdb_3rd_party_licenses.txt
[root@edb-saigon ~]# ls -l /usr/edb/xdb/lib/jdbc/
total 0
lrwxrwxrwx. 1 root root 28 Jun 7 11:24 edb-jdbc18.jar -> /usr/edb/jdbc/edb-jdbc18.jar
[root@edb-saigon ~]# ls -l /usr/edb/xdb/etc/
total 40
-rwx------. 1 enterprisedb enterprisedb 1098 May 17 11:34 datavalidator.properties
-rw-r--r--. 1 root root 447 May 17 11:34 encoding_map.conf
-rw-r--r--. 1 root root 1253 May 17 11:34 euc_jp.conf
drwxr-xr-x. 2 root root 72 Jun 7 11:24 sysconfig
-rw-r--r--. 1 root root 17925 May 17 11:34 xdb_pubserver.conf
-rw-r--r--. 1 root root 4209 May 17 11:34 xdb_subserver.conf
[root@edb-saigon ~]# ls -l /usr/edb/xdb/etc/sysconfig/
total 8
-rwxr-xr-x. 1 enterprisedb enterprisedb 2443 May 17 11:31 runJavaApplication.sh
-rwxr-xr-x. 1 enterprisedb enterprisedb 207 May 17 11:26 xdbReplicationServer-7.config
[root@edb-saigon ~]# cat /etc/edb-repl.conf
admin_user=admin
admin_password=SJ70z8Gk0zY\=
Start Pub/Sub service
[root@edb-saigon ~]# systemctl start edb-xdbpubserver.service
[root@edb-saigon ~]# systemctl start edb-xdbsubserver.service
[root@edb-saigon ~]# systemctl enable edb-xdbpubserver.service
[root@edb-saigon ~]# systemctl enable edb-xdbsubserver.service
[root@edb-saigon ~]# systemctl status edb-xdbpubserver.service
[root@edb-saigon ~]# systemctl status edb-xdbsubserver.service
[enterprisedb@edb-saigon ~]$ ls -l /var/log/edb/xdb/
total 16
-rw-r--r--. 1 enterprisedb enterprisedb 482 Jul 9 11:05 edb-xdbpubserver.log
-rw-r--r--. 1 enterprisedb enterprisedb 484 Jul 9 11:05 edb-xdbsubserver.log
-rw-r--r--. 1 enterprisedb enterprisedb 877 Jul 9 11:05 pubserver.log.0
-rw-r--r--. 1 enterprisedb enterprisedb 0 Jul 9 11:05 pubserver.log.0.lck
-rw-r--r--. 1 enterprisedb enterprisedb 1020 Jul 9 11:05 subserver.log.0
-rw-r--r--. 1 enterprisedb enterprisedb 0 Jul 9 11:05 subserver.log.0.lck
Ref:
- EDB Docs - Replication Server v7 (enterprisedb.com)
- Replication Server 7 vs Postgres Distributed 5.0: Which Offers Better Performance and Scalability? | EDB (enterprisedb.com)
- Multi-Master Replication Solutions for PostgreSQL (percona.com)
- Multi Master Replication using xDB – Database Solutions for the Beginners (wordpress.com)
- How to replicate tables in postgres using EDB replication server - DBACLASS DBACLASS