host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
host tes inixindo 192.168.4.145/24 md5
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
- Restart Master Server (MS) (bisa dari service windows, Postgres stop kemudian start kembali).
- Tes koneksi untuk memastikan bisa terhubung dengan MS. (SS):
C:\Program Files\PostgreSQL\11\bin> psql -U inixindo -h 192.168.4.145 -d tes
- Buat Publication yang berfungsi untuk menyediakan replikasi terhadap suatu tabel (MS) :
CREATE PUBLICATION publication_coba;
ALTER PUBLICATION publication_coba ADD TABLE coba;
- Membuat Subscription yang berfungsi untuk terkoneksi pada Publication (SS) :
CREATE SUBSCRIPTION subscription_coba CONNECTION 'host=192.168.4.145 port=5432 password=’123’ user=inixindo dbname=tes' PUBLICATION publication_coba;
- Silakan coba menambahkan data pada Master Server (MS):
insert into coba values(1,’faizal’);
- Cek record pada Master Server (MS) dan Slave Server (SS):
select * from coba;
select * from pg_publication;
Semoga artikel ini membantu anda lebih memahami banyak permasalahan dalam replikasi database. Jangan sungkan tinggalkan komentar di bawah jika anda memiliki pertanyaan. Sampai jumpa diartikel selanjutnya.