What's BDR?
http://2ndquadrant.com/en-us/resources/bdr/
Yum Install
- yum install http://packages.2ndquadrant.com/postgresql-bdr94-2ndquadrant/yum-repo-rpms/postgresql-bdr94-2ndquadrant-redhat-1.0-2.noarch.rpm
- yum install postgresql-bdr94-bdr
設定PostgreSQL lib
vi /etc/profile 增加下方資訊
export PATH=/usr/pgsql-9.4/bin:$PATH
Init DB
- service postgresql-9.4 initdb -E UTF8 --no-locale --locale=C LC_COLLATE='C' LC_CTYPE='C' -A trust -U postgres
- cd /var/lib/pgsql/9.4-bdr/
- vi data/pg_hba.conf
- vi data/postgresql.conf
- service postgresql-9.4 start
- chkconfig postgresql-9.4 on
Create DB
- CREATE ROLE message LOGIN ENCRYPTED PASSWORD 'yourpassword md5' VALID UNTIL 'infinity';
- CREATE DATABASE message WITH ENCODING='UTF8' OWNER=message TEMPLATE=template0 LC_COLLATE='C' LC_CTYPE='C' CONNECTION LIMIT=-1;
message DB, BDR Setting
##first node
CREATE EXTENSION btree_gist;
CREATE EXTENSION bdr;
SELECT bdr.bdr_group_create(
local_node_name := 'centos1',
node_external_dsn := 'host=centos1 dbname=message'
);
##second node
CREATE EXTENSION btree_gist;
CREATE EXTENSION bdr;
SELECT bdr.bdr_group_join(
local_node_name := 'centos2',
node_external_dsn := 'host=centos2 dbname=message',
join_using_dsn := 'host=centos1 dbname=message'
);
更多設定可參考quictstart
沒有留言:
張貼留言