一 环境
服务器
2 台centOS6.5
软件
Postgresql 9.35
postgresql93-9.3.5-1PGDG.rhel6.x86_64.rpm
postgresql93-contrib-9.3.5-1PGDG.rhel6.x86_64.rpm
postgresql93-libs-9.3.5-1PGDG.rhel6.x86_64.rpm
postgresql93-server-9.3.5-1PGDG.rhel6.x86_64.rpm
pgpool 3.3.3
installer-pg93-3.3.3.tar.gz
二 环境介绍
![](http://img.blog.itpub.net/blog/attachment/201409/24/29896444_14115208661y1p.jpg?x-oss-process=style/bb)
一安装pg
1创建数据库账户
Userdel postgres
Useradd postgres
2修改postgres 密码
echo 'GTdbs_postgres' |passwd postgres
3安装 数据库
postgresql93-9.3.5-1PGDG.rhel6.x86_64.rpm
postgresql93-contrib-9.3.5-1PGDG.rhel6.x86_64.rpm
postgresql93-libs-9.3.5-1PGDG.rhel6.x86_64.rpm
postgresql93-server-9.3.5-1PGDG.rhel6.x86_64.rpm
uuid-1.6.1-10.el6.x86_64
需要的安装包可以从这里下载
安装 postgresql93-contrib 必须要安装 uuid-1.6.1-10.el6.x86_64
Yum install http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/postgresql93-contrib-9.3.5-1PGDG.rhel6.x86_64.rpm
4 修改环境变量
Su – postgres
vim .bash_profile
PATH=$PATH:$HOME/bin:/usr/pgsql-9.3/bin/
PGDATA=/pgdb/data
5 创建 数据库 目录
mkdir -p /pgdb/data
授权
mkdir -p /pgdb/data
初始化 数据库
initdb /pgdb/data
二 安装pgpool
1 安装pgpool需要的软件
yum install -y php php-psql httpd php-mbstring
![](http://img.blog.itpub.net/blog/attachment/201409/24/29896444_1411520936Qewy.jpg?x-oss-process=style/bb)
2 下载 拷贝软件包
installer-pg93-3.3.3.tar.gz
3解压数据包
tar xvf installer-pg93-3.3.3.tar.gz
4 配置 ssh 对等协议
ssh-keygen
ssh-copy-id
5 安装pgpoo
./install.sh
[root@pgdb2 installer-pg93-3.3.3]# ./install.sh
check for installation ...OK.
=================================================================
Copyright (c) 2003-2014 PgPool Global Development Group
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that copyright notice and this permission
notice appear in supporting documentation, and that the name of the
author not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission. The author makes no representations about the
suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
=================================================================
[input] Do you accept the end user software license agreement? (yes/no):
yes
=================================================================
Configuration
=================================================================
----------------------------------------------------------------------
Configuring Host, User, SSH ...
----------------------------------------------------------------------
* Node information
Two-node cluster (node 0 and node 1) is assumed.
[input] Specify node 0's hostname or IP address : 192.168.1.223
[input] Specify node 1's hostname or IP address : 192.168.1.232
Which node is this?
If this is node 0, a database cluster is created by initdb after installation.
Otherwise if this is node 1, the configurations on node 0 is reused.
Completed!
* See pgpoolAdmin.
http://192.168.1.223/pgpoolAdmin/
* Start PostgreSQL by the user postgres
ex.) /usr/pgsql-9.3/bin/pg_ctl start -D /home/postgres/data
* Start pgppool from pgpoolAdmin
* Install pgpool-II to 192.168.1.232 using install.sh
6授权
Chown apache –R /var/www/html
7重启 服务
Service httpd restart
Service iptables stop
Su – postgres
Pg_ctl restart
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29896444/viewspace-1278938/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29896444/viewspace-1278938/