drwx------ 2 postgres postgres 4096 Oct 23 15:49 pg_subtrans/
drwx------ 2 postgres postgres 4096 Oct 23 15:49 pg_tblspc/
drwx------ 2 postgres postgres 4096 Oct 23 15:49 pg_twophase/
-rw------- 1 postgres postgres 4 Oct 23 15:49 PG_VERSION
drwx------ 3 postgres postgres 4096 Oct 23 15:49 pg_xlog/
-rw------- 1 postgres postgres 19129 Oct 23 15:49 postgresql.conf
4
搞个放日志的地方
root@pgproxy1:~# mkdir /opt/pg91/pgdata1/pg_log
root@pgproxy1:~# chown postgres:postgres /opt/pg91/pgdata1/pg_log/
root@pgproxy1:~# chmod 700 /opt/pg91/pgdata1/pg_log/
修改认证监听等相关参数,后跑一个
root@pgproxy1:~# sudo -u postgres /usr/lib/postgresql/9.1/bin/pg_ctl -D /opt/pg91/pgdata1 -l /opt/pg91/pgdata1/pg_log/pg.log start
重复以上跑起5个实例。
第三部分
安装pl/proxy
1
查一下能装啥
zxw@pgproxy1:~$ apt-cache search plproxy
postgresql-9.1-plproxy - database partitioning system for PostgreSQL 9.1
2
装
zxw@pgproxy1:~$ sudo apt-get install -y postgresql-9.1-plproxy
[sudo] password for zxw:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
postgresql-9.1-plproxy
0 upgraded, 1 newly installed, 0 to remove and 69 not upgraded.
Need to get 65.3 kB of archives.
After this operation, 268 kB of additional disk space will be used.
Get:1 http://hk.archive.ubuntu.com/ubuntu/ precise/universe postgresql-9.1-plproxy amd64 2.3-1 [65.3 kB]
Fetched 65.3 kB in 10s (6,138 B/s)
Selecting previously unselected package postgresql-9.1-plproxy.
(Reading database ... 58432 files and directories currently installed.)
Unpacking postgresql-9.1-plproxy (from .../postgresql-9.1-plproxy_2.3-1_amd64.deb) ...
Setting up postgresql-9.1-plproxy (2.3-1) ...
zxw@pgproxy1:~$
3
规划
proxy node:
ip
port portN
create user beiigang
create database proxy;
schema beiigang
data node:
ip
port portN
create user beiigang
create user devart
create database datadb
schema beiigang
4
跑规划
#
#proxy
#
create role beiigang superuser login encrypted password 'beiigang';
create role proxy nosuperuser nocreatedb nocreaterole noinherit login encrypted password 'proxy';
create database proxy with owner beiigang template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
grant all on database proxy to proxy;
create schema proxy authorization proxy;
#
#data node
#
create role beiigang superuser login encrypted password 'beiigang';
create role devart nosuperuser nocreatedb nocreaterole noinherit login encrypted password 'devart';
create database datadb with owner beiigang template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
grant all on database datadb to devart;
create schema devart authorization devart;
#
#proxy node
#
postgres=# create role beiigang superuser login encrypted password 'beiigang';
CREATE ROLE
postgres=# create role proxy nosuperuser nocreatedb nocreaterole noinherit login encrypted password 'proxy';
CREATE ROLE
postgres=# create database proxy with owner beiigang template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
CREATE DATABASE
postgres=# grant all on database proxy to proxy;
GRANT
proxy=# create schema proxy authorization proxy;
CREATE SCHEMA
#
#data node
#
postgres=# create role beiigang superuser login encrypted password 'beiigang';
CREATE ROLE
postgres=# create role datasch nosuperuser nocreatedb nocreaterole noinherit login encrypted password 'datas