搭pl/proxy集群(二)

2015-01-27 22:41:00 · 作者: · 浏览: 89
n ok:
zxw@pgproxy1:~$ psql -h 127.0.0.1 -U postgres postgres
Password for user postgres:
psql (9.1.14)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

postgres=#

8
修改监听地址等,加载配置参数
zxw@pgproxy1:~$ sudo -u postgres /etc/init.d/postgresql reload
* Reloading PostgreSQL 9.1 database server
...done.
zxw@pgproxy1:~$

9
验证ok
zxw@pgproxy1:~$ psql -h127.0.0.1 -Upostgres postgres
Password for user postgres:
psql (9.1.14)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

postgres=# show all ;
name | setting | description
---------------------------------+------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------
allow_system_table_mods | off | Allows modifications of the structure of system tables.
。。。。。。
listen_addresses | * | Sets the host name or IP address(es) to listen to.
lo_compat_privileges | off | Enables backward compatibility mode for privilege checks on large objects.
local_preload_libraries | | Lists shared libraries to preload into each backend.

10
验证ok
zxw@pgproxy1:~$ psql -h192.168.11.131 -Upostgres postgres
Password for user postgres:
psql (9.1.14)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

postgres=#

11
ubuntu12上官方pg包安装完后的目录基本如下:
istall directory
/usr/lib/postgresql/9.1/bin/postgres proc
/var/lib/postgresql/9.1/main data
/etc/postgresql/9.1/main/postgresql.conf option file
/usr/share/postgresql/9.1/contrib/
/usr/share/postgresql/9.1/extension/
/usr/share/postgresql-common/

第二部分
初始化n个实例

1
准备目录
root@pgproxy1:~# mkdir /opt/pg91
root@pgproxy1:~# chown postgres:postgres /opt/pg91/

2
初始化一个实例
root@pgproxy1:~# sudo -u postgres /usr/lib/postgresql/9.1/bin/initdb -E utf8 -Upostgres --locale=C -W -D /opt/pg91/pgdata1
could not change directory to "/root"
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".

creating directory /opt/pg91/pgdata1 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
。。。
Enter new superuser password:
。。。
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

/usr/lib/postgresql/9.1/bin/postgres -D /opt/pg91/pgdata1
or
/usr/lib/postgresql/9.1/bin/pg_ctl -D /opt/pg91/pgdata1 -l logfile start

root@pgproxy1:~#

3
查看数据集目录
root@pgproxy1:~# ll /opt/pg91/pgdata1/
total 88
drwx------ 13 postgres postgres 4096 Oct 23 15:49 ./
drwxr-xr-x 3 postgres postgres 4096 Oct 23 15:49 ../
drwx------ 5 postgres postgres 4096 Oct 23 15:49 base/
drwx------ 2 postgres postgres 4096 Oct 23 15:49 global/
drwx------ 2 postgres postgres 4096 Oct 23 15:49 pg_clog/
-rw------- 1 postgres postgres 4476 Oct 23 15:49 pg_hba.conf
-rw------- 1 postgres postgres 1636 Oct 23 15:49 pg_ident.conf
drwx------ 4 postgres postgres 4096 Oct 23 15:49 pg_multixact/
drwx------ 2 postgres postgres 4096 Oct 23 15:49 pg_notify/
drwx------ 2 postgres postgres 4096 Oct 23 15:49 pg_serial/
drwx------ 2 postgres postg