Replikasi Database Postgresql10 Master to Master Menggunakan Bucardo

Saya menggunakan Postgresql Versi 10.18 dan menggunakan 2 server Ubuntu 18.04 dengan IP: 192.168.0.70 sebagai Master1 dan IP: 192.168.0.71 sebagai Master2.

Silahkan jalankan perintah berikut, tinggal copas aja hahahaha….

apt-get install make libdbi1 libdbi-perl libdbix-safe-perl libdbix-simple-perl libdbd-pg-perl libboolean-perl postgresql-contrib postgresql-plperl
wget https://bucardo.org/downloads/Bucardo-5.6.0.tar.gz
ulimit -s
nano /etc/postgresql/10/main/postgresql.conf

max_stack_depth = 4M

service postgresql restart
tar xzf Bucardo-5.6.0.tar.gz
cd Bucardo-5.6.0
perl Makefile.PL
make
sudo make install
mkdir /var/run/bucardo
mkdir /var/log/bucardo/
touch /var/log/bucardo/log.bucardo (jika error)
bucardo install
==> jika oke, jangan lupa kasih password di user bucardo
==> di server MASTER2 jangan lupa buat: CREATE USER bucardo SUPERUSER;
==> jangan lupa di MASTER2 rubah setingan :
nano /etc/postgresql/10/main/pg_hba.conf
# Database administrative login by Unix domain socket
local all postgres trust
local all bucardo trust
# TYPE DATABASE USER ADDRESS METHOD

# “local” is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 0.0.0.0/0 md5
host all all 192.168.0.40/32 trust
service postgresql restart
==> jangan lupa di MASTER1 rubah setingan :
nano /etc/postgresql/10/main/pg_hba.conf
# Database administrative login by Unix domain socket
local all postgres trust
local all bucardo trust
# TYPE DATABASE USER ADDRESS METHOD

# “local” is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 0.0.0.0/0 md5
host all all 192.168.0.41/32 trust
service postgresql restart
bucardo add db db1 dbname=siji dbhost=192.168.0.70 dbuser=postgres dbpass=passwordmu
Note: bucardo add db source_db dbhost=<–Source-DB–> dbport=5432 dbname=<–your-db-name–> dbuser=<–your-db-name–> dbpass=<–db-pass–>
bucardo add db db2 dbname=siji dbhost=192.168.0.71 dbuser=postgres dbpass=passwordmu
bucardo add table all tables herd=db_herd
bucardo add sequence all sequences herd=db_herd
bucardo add dbgroup db_group db1:source db2:source
bucardo add sync db_sync herd=db_herd dbs=db_group
bucardo start

Untuk video hasil replikasi dapat dilihat :

Source:

https://bucardo.org/

http://nareswara.com/

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

25 − = 22