Please note that TCapture is not ready for productive use.
Also note that all of the information provided here apply to the latest version published and are subject to change.
To simplify testing of TCapture it is highly recommended to test on two instances of Postgres running on separate machine, which is also the target scenario for most replications
At the moment, TCapture cannot initialize its nodes automatically, thus you need to manually ensure that all your nodes start with the very same set of data.
To do that need to setup a single node first, create a test database and load it with all the data required for your tests.
You can then simply copy all of the data directory to your other instances (assuming these are architecturally compatible machines, otherwise you need to dump and restore the data).
- Download zip from https://github.com/lab-sb/tcrepsrv-dev
git clone https://github.com/lab-sb/tcrepsrv-dev.git
- as root:
cd tcrepsrv-dev directory
execute install.sh under TCapture software folder
- #cover the following steps:
- set variable RDBBDR HOME in .rdbbdr_env.sh
- soruce environment file .rdbbdr_env.sh
- installing TCapture logical decoding library under /usr/pgsql-10/lib
In order for TCapture to run, the wal_level configuration parameter must be set in postgresql.conf, which can be found underneath your data directory. It’s also a good idea to set max_wal_senders and max_replication_slots to something reasonably high to give TCapture worker processes plenty of capacity:
# At the bottom of <data directory>/postgresql.conf
##### logical decoding wal_level = logical max_wal_senders = 10 # max number of walsender processes max_replication_slots = 18 track_commit_timestamp = on
You must create a postgreSQL user for TCapture Replication Server. TC uses this login to access the primary database’s transaction log(wal) and the Distribution Database. The TCapture system user must have superuser role.
create user rdbbdr_user superuser inherit login password 'rdbbdr_pwd';
The primary database must have a node name defined for itself
To complete the primary database configuration for TCapture you must create the Distribution Database. TC uses the Distribution Database to maintain its stable queue and metadata objects.
create database rdb_db__<node_name>;
If a database is to be used as a producer or consumer, it must be added to a replication server using the TCSrvCTL command. The database server running the database must have been configured to support its access by a replication server
Source the environment file on TC installation directory:
Move into the $RDBBDR directory:
Run TCSrvCTL –config as follow from the RDBBDR/bin directory:
TCSrvCTL --config --type producer --node --host --port --user --passwd --db --rhost --ruser --rport --rpasswd
example:define a primary node called swap on host edslab-qas01:5433 for primary db webqas having rdb (replication database) on same host :
$ sh TC_srvctl.sh --config --type producer --node swap --host edslab-qas01 --port 5433 --user rdbbdr_user --passwd rdbbdr_pwd --db webqas --rhost edslab-qas01 --ruser rdbbdr_user --rpasswd rdbbdr_pwd -rport 5433 Launching.. rdbbdrconf:/var/lib/pgsql/scripts/mycode/tcrepsrv-dev/conf/swap_rdb_bdr.conf
- node give a name to this primary node
- host host where primary database run
- port port where primary database is listening
- user tcapture user (superuser)
- db primary db name
- rhost host containing replication database ( defined as rdb_db__<node>)
- rport port where rdb is listening
- ruser rdb user (superuser)
Run TCSrvCTL –setup as follow from the RDBBDR/bin directory:
$ sh TC_srvctl.sh --setup --node swap --type producer
Run TCapture Replication Server on defined primary node :
sh runTCRepSrv.sh -n swap
Adding a Replicated node in TCapture
similar to onfiguring the TC primary database
Playing with the replicated database