PGClusterの実験と話題
Modified: 26 November 2005
以下を参考にしました。
「PostgreSQL必須テクニック」技術評論社
PGClusterのインストール - クラスターサーバー (26 November 2005)
PGClusterのインストール - レプリケーションサーバー&ロードバランサー (26 November 2005)
レプリケーターの設定と起動 (26 November 2005)
クラスターサーバーの設定と起動 (26 November 2005)
ロードバランサーの設定と起動 (26 November 2005)
PGClusterのインストール
- クラスターサーバー ![]()
ダウンロード
http://pgcluster.projects.postgresql.org/jp/
上記の公式サイトの以下のページからダウンロードできます。
http://pgcluster.projects.postgresql.org/jp/download.html
2005年11月26日時点で、"pgcluster-1.0.9a.tar.gz"がダウンロードできました。
ユーザの作成
インストールの前に、専用のユーザ("postgres")を作成します。
# useradd postgres #
プロファイル(".bash_profile")を設定します。
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH unset USERNAME PGDATA=/usr/local/pgsql/data export PGDATA LD_LIBRARY_PATH=/usr/local/pgsql/lib export LD_LIBRARY_PATH
インストールする
"postgres"ユーザになって、以下の手順でインストールします。
# su - postgres $ tar zxvf pgcluster-1.0.9a.tar.gz $ cd pgcluster-1.0.9a $ ./configure $ make $ su Password: ******* # make install
初期化する
初期化の前にDB用のディレクトリを作成します。
# cd /usr/local/pgsql # mkdir data # chown postgres.postgres data # exit $初期化コマンドを実行します。
$ ./bin/initdb -D /usr/local/pgsql/data -E EUC_JP --no-locale 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. Fixing permissions on existing directory /usr/local/pgsql/data... ok creating directory /usr/local/pgsql/data/base... ok creating directory /usr/local/pgsql/data/global... ok creating directory /usr/local/pgsql/data/pg_xlog... ok creating directory /usr/local/pgsql/data/pg_clog... ok creating template1 database in /usr/local/pgsql/data/base/1... ok creating configuration files... ok initializing pg_shadow... ok enabling unlimited row size for system tables... ok initializing pg_depend... ok creating system views... ok loading pg_description... ok creating conversions... ok setting privileges on built-in objects... ok vacuuming database template1... ok copying template1 to template0... ok Success. You can now start the database server using: ./bin/postmaster -D /usr/local/pgsql/data or ./bin/pg_ctl -D /usr/local/pgsql/data -l logfile start #
PGClusterのインストール
- レプリケーションサーバー&ロードバランサー ![]()
ダウンロード
レプリケーションサーバーやロードバランサーは、クラスターサーバーのソースの含まれていますので、同じものを使います。
ユーザの作成
インストールの前に、専用のユーザ("postgres")を作成します。
# useradd postgres #
インストールする
"postgres"ユーザになって、以下の手順でインストールします。
# su - postgres $ tar zxvf pgcluster-1.0.9a.tar.gz $ cd pgcluster-1.0.9a $ ./configure $ make $ su Password: ******* # make install