(一)方案
尽管做数据库 postgresql 集群的方式有很多种,数据库9.0以上原生的 standby,呼声很高的 guzz,老牌的 Slony-I,但看过了小日本仔的一篇 pdf 后,觉得用 Streaming replication + Hot Standby + pgpool-II 似乎比较适合我的口味。
(1)我一向赞成数据库集群应该由数据库厂商提供
(2)数据库集群对应用是透明的,可以视作一个数据库
(3)这个方案是有优点的:
优势:
Write performance is good (10-20% overhead)
Automatic failover of slaves
Connection pooling and load balancing: boost performance
DDL replication
Large object replication
劣势:
Asynchronous replication
However replication delay is relatively low
(4)截个图片
(5)深入了解 pgpool2
. 用户手册 http://pgpool.projects.postgresql.org/pgpool-II/doc/pgpool-zh_cn.html
. 入门教程 http://pgpool.projects.postgresql.org/pgpool-II/doc/tutorial-zh_cn.html
. 中文试用 http://blog.csdn.net/xtlog/article/details/4219353
. Parallel_Mode 并发模式,传说中的 scale out 分表
=====================================================================
(二)从零开始安装
(1)虚拟机安装 CentOS5.6,下载 http://www.thoughtpolice.co.uk/vmware/#centos 注意不要下 mini 版,mini 版几乎不能用。
(2)创建目录:
。/opt/postgres/data/5432/data - 主库
。/opt/postgres/data/5434/data - 从库
(3)下载 postgresql 9.1
#wget http://oscg-downloads.s3.amazonaws.com/packages/postgres-9.1.0-1.i386.openscg.rpm
#rpm -ivh postgres-9.1.0-1.i386.openscg.rpm
#/etc/init.d/postgres-9.1-openscg start
删除自动安装的文件
#rm /etc/init.d/postgres-9.1-openscg
(4)重新初始化数据库安装
(4)修改防火墙
#iptables -I INPUT -p tcp --dport 5432 -j ACCEPT
#iptables -I INPUT -p tcp --dport 5434 -j ACCEPT
#iptables -I INPUT -p tcp --dport 5436 -j ACCEPT
#/etc/rc.d/init.d/iptables save
#/etc/init.d/iptables restart
(5)修改配置文件,支持远程访问
#vim /opt/postgres/9.1/data/pg_hba.conf
修改成 host all all 0.0.0.0/0 md5
(6)修改配置文件成主服务器
修改 postgresql.conf:
###
listen_addresses = '*'
port = 5432
wal_level = hot_standby
max_wal_senders = 1
wal_keep_segments = 32
log_destination = 'stderr'
logging_collector = on
log_min_error_statement = error
(7)重启主服务
#/opt/postgres/9.1/bin/postgres -D /opt/postgres/data/5432/data
(8)通过 DBeaver 类型的客户端工具连接数据库,测试连接成功。
(9)安装从数据库
su postgres
/opt/postgres/9.1/bin/initdb -D /opt/postgres/data/5434/data
cd /opt/postgres/data/5434/data
vi postgres.conf
listen_addresses = '*'
port = 54321
hot_standby = on
vi recovery.conf
standby_mode = 'on'
primary_conninfo = 'host=127.0.0.1 port=5432 user=repl password=123456'
- 大小: 134 KB
- 大小: 17.1 KB
- 大小: 8 KB
分享到:
相关推荐
or1200 openrisc-arch-1.0-rev0.pdf
cacti-plugin-arch-2.0.tar.gz
Processor Arch-Sequential
Next Generation On Demand (NGOD) Asset Architecture Comcast-SP-NGOD-ASSET-ARCH-I03-100731 Issued July 31, 2010
UPnP arch Device architecture v1.1.pdf 2008年的1.1版本。
基于android8.1源码平台中生成的jar,亲测可用!!!!
藏经阁-Distributed-Frontend-Arch--Ahmad Amireh.pdf
Next Generation On Demand (NGOD) Overall Architecture Comcast-SP-NGOD-GEN-ARCH-I03-100731 Issued July 31, 2010
Arch-JL-10-4in1.pdf
NULL 博文链接:https://cnmqw.iteye.com/blog/1243596
arch-for-sync-groupware-tr1999-425
变系数ARCH-M模型的ARCH效应检验,熊强, 李元,本文考虑变系数ARCH-M模型, 构造了非参数部分和参数部分的截面似然估计. 基于估计的渐近性质, 构造了Wald检验统计量来检验模型是否具�
python库。 资源全名:arch-4.8.0-cp27-cp27m-win32.whl
NULL 博文链接:https://cnmqw.iteye.com/blog/1056307
NULL 博文链接:https://cnmqw.iteye.com/blog/1115403
下午1_Intel_Yang, Elton_MeeGo-Arch-Update-Final.pdf
UPnP-arch-DeviceArchitecture-v2.0 最新的UPNP协议规范
资源来自pypi官网。 资源全名:arch-4.17-cp39-cp39-manylinux1_x86_64.whl
python库,解压后可用。 资源全名:arch-4.11-cp35-cp35m-win32.whl
arch-model-estimation_solution.ipynb