Dockerized SymmetricDS active-active PostgreSQL not replicating data across nodes

104 Views Asked by At

Firs of all, I'm new to symmetricds.

My goal is to set up an active/active postgres environment, so for this, I've set up 2 Postgres and 2 SymmetricDS containers, each set on a separate VM

VM1: 192.168.1.199

VM2: 192.168.1.84

Docker compose yaml content, on each node:

---
version: '3.8'

services:
  mw-db:
    image: 192.168.1.95:81/kdb:latest
    deploy:
      resources:
        limits:
          cpus: 1
          memory: 4G
    environment:
      - POSTGRES_DB=mw
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASS}
    networks:
      mw-network:
        aliases:
          - mw-db
      default: {}
    ports:
      - "5432:5432"
    restart: always
    volumes:
      - /datassd/db:/var/lib/postgresql/data:rw
    healthcheck:
      test: "exit 0"

  symmetricds:
    image: 192.168.1.95:81/ksymmetricds:latest
    depends_on:
      mw-db:
        condition: service_healthy
    networks:
      mw-network:
        aliases:
          - symmetricds
    restart: always
    expose:
      - "31415"
    volumes:
      - /datassd/symmetricds/engines:/opt/symmetric-ds/engines:ro

networks:
  mw-network:
    external:
      name: mw-network

SymmetricDS container is built from jumpmind/symmetricds:3.14.7

POstgres container is built from groonga/pgroonga:2.4.7-debian-15

The symmetricDS engines properties are:

master:

sync.url=http\://192.168.1.199\:31415/sync/symmetricdsmwdb0
group.id=primary
db.init.sql=
registration.url=
db.driver=org.postgresql.Driver
db.user=user
db.password=password
db.url=jdbc\:postgresql\://mw-db\:5432/mw?protocolVersion\=3&stringtype\=unspecified&socketTimeout\=300&tcpKeepAlive\=true
engine.name=symmetricdsmwdb0
external.id=symmetricdsmwdb0
db.validation.query=select 1
cluster.lock.enabled=false
auto.registration=true
auto.reload=true

slave:

sync.url=http\://192.168.1.84\:31415/sync/symmetricdsmwdb1
group.id=primary
db.init.sql=
registration.url=http\://192.168.1.199\:31415/sync/symmetricdsmwdb0
db.driver=org.postgresql.Driver
db.user=user
db.password=password
db.url=jdbc\:postgresql\://mw-db\:5432/mw?protocolVersion\=3&stringtype\=unspecified&socketTimeout\=300&tcpKeepAlive\=true
engine.name=symmetricdsmwdb1
external.id=symmetricdsmwdb1
db.validation.query=select 1
cluster.lock.enabled=false

After starting up my containers I can see that the sym_* tables were created on the 2 DBs also I can see the symmetricDS got registered:

sym_nodes content:

 symmetricdsmwdb0   primary symmetricdsmwdb0    1   http://192.168.1.199:31415/sync/symmetricdsmwdb0    ?   3.14.7  3.14.7  PostgreSQL  15.2    postgres95  -1  -1      server  
symmetricdsmwdb1    primary symmetricdsmwdb1    1   http://192.168.1.84:31415/sync/symmetricdsmwdb1 ?   3.14.7  3.14.7  PostgreSQL  15.2    postgres95  -1  -1  symmetricdsmwdb0    server  

Still when I add something in one of the mw DB tables, the new data does not get replicated into the identical table in the seconds mw DB instance.

Any idea what am I missing here?

Thanks

1

There are 1 best solutions below

0
Yonoss On

Found my problem: I was missing the entries in sym_trigger... tables. After adding the missing entries, the triggers related entries, the synchronization started to work