ERROR: replication slots can only be used if max_replication_slots > 0

Viewed 338

Here they got this error when try to alter

I am trying to setup PostgreSQL replication using docker as described here.

My docker-compose.yaml

version: '3'
services:
  database:
    image: 'postgres:9.6'
    container_name: my_postgres_database
    restart: always
    volumes:
        - ./data:/var/lib/postgresql/data
        - ./my-postgres.conf:/etc/postgresql/postgresql.conf
        - ./my-pg_hba.conf:/etc/postgresql/pg_hba.conf    
    ports:
      - "127.0.0.1:5432:5432"
    environment:
      - 'POSTGRES_PASSWORD=kong'
      - 'POSTGRES_DB=kong'
      - 'POSTGRES_USER=kong'

my-pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust
host    replication     replicator      0.0.0.0/0               trusthost all all all md5

my-postgres.conf

listen_addresses = '*'
# DB Version: 13
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 62 GB
# CPUs num: 12
# Connections num: 1000
# Data Storage: ssd# Performance tweaksmax_connections = 1000
shared_buffers = 158MB
effective_cache_size = 476MB
maintenance_work_mem = 1GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 2063kB
min_wal_size = 1GB
max_wal_size = 1GB
max_worker_processes = 12
max_parallel_workers_per_gather = 4
# Replication
wal_level = replica
hot_standby = on
max_wal_senders = 10
max_replication_slots = 10
hot_standby_feedback = on

After sudo docker-compose up -d, I connect to running postgresql container sudo docker exec -it <container-id> bash

Connect to postgresql shell using psql -h localhost -p 5432 -U kong -W and then run

SELECT * FROM pg_create_physical_replication_slot('replication_slot_slave1');

ERROR: replication slots can only be used if max_replication_slots > 0

What did I miss here? My primary goal is to replicate kong docker based gateway.

0 Answers
Related