Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ajikamaludin/671a83c143ccd5ceeac4fdb5eab7657e to your computer and use it in GitHub Desktop.
Save ajikamaludin/671a83c143ccd5ceeac4fdb5eab7657e to your computer and use it in GitHub Desktop.
Install Postgresql-10 with bucardo sync on centos 7
#install util
yum install epel-release
yum update
yum install wget htop zip unzip
#install portgresq 10
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum update
yum install postgresql10 postgresql10-server postgresql10-contrib postgresql10-plperl
#start postgresql 10
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10
#install perl module
- check perl version is 5
- install :
yum install perl-DBIx-Safe perl-Test-Simple perl-boolean perl-ExtUtils-MakeMaker perl-CGI perl-DBD-Pg perl-Encode-Locale perl-Pod-Parser perl-Sys-Syslog
#download bucardo
wget https://bucardo.org/downloads/Bucardo-5.5.0.tar.gz
tar vxfz Bucardo-5.5.0.tar.gz
cd Bucardo-5.5.0
perl Makefile.PL
make
make test
make install
export PATH=$PATH:/usr/local/bin
#test it
bucardo
#setup
set pg_hba local to trust
systemctl restart postgresql-10
#make user and database named bucardo
su - postgres
createuser -P -s bucardo
createdb -O bucardo bucardo
#setup bucardo
mkdir -p /usr/local/bucardo
bucardo install
#example of .pgpass save to home dir of user
*:5432:*:bucardo:eta
[host]:[port]:[database]:[user]:[password]
### make sync bucardo database
#add db from all host
bucardo add db [dbsource name] dbname=[db name from postgres]
bucardo add db [dbtarget name] dbname=[db name from other host]
#make a relgroup
bucadro add all table db=[dbsource name] -T [execlude some table] relgroup=[make a relname]
#make a dbgroup - define source db and target db
bucardo add dbgroup [name of group] [dbsource name]:source [dbtarget name]:target
#add a sync
bucardo add sync [name of sync] relgroup=[rel of table] dbgroup=[group of db with source and target]
#start bucardo sync
bucardo start
#how to resolv error if any changes of table
bucardo stop
bucardo deactivate all
bucardo validate all
bucardo activate all
bucardo kick all
#then
bucardo list sync
bucardo start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment