xa-rdmp-file 文件数据库安装
初始化数据库
mkdir -p /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data
mkdir -p /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/log
chown -R postgres.postgres /xa-rdmp/user/data/pgsql
chmod -R 0700 /xa-rdmp/user/data/pgsql
su postgres
cd /xa-rdmp/user/data/pgsql
/xa-rdmp/program/pgsql/bin/initdb -E utf8 -D /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data
vi /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data/postgresql.conf
修改以下几项,并把配置项前面的 # 号去掉
listen_addresses = '*'
port = 5442
wal_level = hot_standby
max_wal_senders = 4
wal_keep_segments = 64
hot_standby = on
constraint_exclusion = partition
启动数据库
/xa-rdmp/program/pgsql/bin/pg_ctl -D /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data -l /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/log/postgres.log start
停止数据库
/xa-rdmp/program/pgsql/bin/pg_ctl -D /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data -l /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/log/postgres.log stop
重启数据库
/xa-rdmp/program/pgsql/bin/pg_ctl -D /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data -l /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/log/postgres.log restart
创建库及用户
su postgres
/xa-rdmp/program/pgsql/bin/psql -h 127.0.0.1 -p 5442 --dbname=postgres
create user pgsql superuser password 'ssrdmp88';
create database "xa-rdmp-file" with encoding='utf8' owner=pgsql;
create database "fs-1.0" with encoding='utf8' owner=pgsql;
create user repl superuser password 'ssrdmp88_repl';
\q
配置修改为支持流复制(主从)
vi /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data/pg_hba.conf
修改内容为
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 md5
host replication repl 127.0.0.1/32 md5
host replication all ::1/128 md5
host replication repl ::1/128 md5
添加为自启动
vi /etc/rc.local
增加一行
su - postgres -c '/xa-rdmp/program/pgsql/bin/pg_ctl -D /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/data -l /xa-rdmp/user/data/pgsql/xa-rdmp-file-master-1/log/postgres.log start'
设置执行权限
chmod 755 /etc/rc.local