GreenPlumをインストールする
GreenPlumがオープンソース化されるという事で早速インストールしてみました。
GreenPlumはMaster-Slaveのアーキテクチャです。
SlaveノードはSegmentノードといい、データを保持します。
構成
gpmがMasterノードです。2台でredundant構成をとります。
gpsがSegmentノードです。
インストール
基本的にはドキュメントに書いてある通りです。
ドキュメントは下記にあります。
Pivotal Greenplum Database 4.3.4 Documentation
まずSystem RequirementsとOSパラメーターを設定します。
次にインストーラーを下記からダウロードします。
Pivotal Network
gpm001にインストーラーを配置しUnzipしてインストーラーを実行します。
ここまではすんなり進むと思います。
次から少しややこしくなるのでメモを残しておきます。
全ホストにインストールと設定をしていきます。
下記手順はすべてgpm001で実施します。
1.rootでssh 鍵認証パスワードなしで全ホストにログイン出来るようにする。
2.hostfile_exkeysを作成する。
ファイルには全ホストを記述します。
gpm001 gpm002 gps001 gps002
3.gpseginstallを実行。
# source /usr/local/greenplum-db/greenplum_path.sh # gpseginstall -f hostfile_exkeys -u gpadmin -p changeme
私の環境ではsshのパスワード認証を有効にしてないのでエラーになりました。
この時点でgpadminユーザーが作成されているのでgpm001からgpadminユーザーで全ホストにssh 鍵認証パスワードなしログインが出来るようにします。
再度gpseginstallを実行します。
下記が出力されれば完了です。
gpseginstall:gpm001:root-[INFO]:-SUCCESS -- Requested commands completed
下記手順は不要かもしれませんが、一応実施。
# su - gpadmin $ source /usr/local/greenplum-db/greenplum_path.sh $ gpssh-exkeys -f hostfile_exkeys [STEP 1 of 5] create local ID and authorize on local host ... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped [STEP 2 of 5] keyscan all hosts and update known_hosts file [STEP 3 of 5] authorize current user on remote hosts ... send to gpm002 ... send to gps001 ... send to gps002 [STEP 4 of 5] determine common authentication file content [STEP 5 of 5] copy authentication files to all remote hosts ... finished key exchange with gpm002 ... finished key exchange with gps001 ... finished key exchange with gps002 [INFO] completed successfully
確認
$ gpssh -f hostfile_exkeys -e ls -l /home/gpadmin/ [gpm002] ls -l /home/gpadmin/ [gpm002] total 0 [gps002] ls -l /home/gpadmin/ [gps002] total 0 [gps001] ls -l /home/gpadmin/ [gps001] total 0 [gpm001] ls -l /home/gpadmin/ [gpm001] total 4
4.Dataディレクトリを作成。
# mkdir -p /data/master # chown gpadmin:gpadmin /data/master
gpm001からgpm002のディレクトリを作成。
# source /usr/local/greenplum-db/greenplum_path.sh # gpssh -h gpm002 -e 'mkdir -p /data/master' # gpssh -h gpm002 -e 'chown gpadmin:gpadmin /data/master'
gpm001からgps001,002のディレクトリを作成。
まずhostfile_gpssh_segonlyファイルを作成します。
Segmentノードのみ記載します。
gps001 gps002
下記を実行しディレクトリを作成します。
# gpssh -f hostfile_gpssh_segonly -e 'mkdir -p /data/primary' # gpssh -f hostfile_gpssh_segonly -e 'mkdir /data/mirror' # gpssh -f hostfile_gpssh_segonly -e 'chown -R gpadmin:gpadmin /data/primary' # gpssh -f hostfile_gpssh_segonly -e 'chown gpadmin:gpadmin /data/mirror'
5.Validating Systems
この手順は実行してもしなくてもいいです。
私は実行しましたがカーネルパラメーターを変更してない箇所もありERRORになりました。
検証環境であれば飛ばして問題ないかと思います。
6.InitDBを実施。
# su - gpadmin $
hostfile_gpinitsystemファイルを作成します。
Segmentノードのみ記載します。
gps001 gps002
gpinitsystem_configを作成します。
まずgpconfigsディレクトリを作成しサンプルコンフィグをコピーします。
$ mkdir gpconfigs $ cp /usr/local/greenplum-db-4.3.4.1/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config
gpinitsystem_configを編集します。
DataディレクトリとMasterのホスト名を変更します。
################################################ #### REQUIRED PARAMETERS ################################################ ARRAY_NAME="EMC Greenplum DW" SEG_PREFIX=gpseg PORT_BASE=40000 declare -a DATA_DIRECTORY=(/data/primary /data/primary) MASTER_HOSTNAME=gpm001 MASTER_DIRECTORY=/data/master MASTER_PORT=5432 TRUSTED_SHELL=ssh CHECK_POINT_SEGMENTS=8 ENCODING=UNICODE ################################################ #### OPTIONAL MIRROR PARAMETERS ################################################ MIRROR_PORT_BASE=50000 REPLICATION_PORT_BASE=41000 MIRROR_REPLICATION_PORT_BASE=51000 declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror)
initdbを実行します。
$ gpinitsystem -c gpinitsystem_config -h hostfile_gpinitsystem
エラーが出なければ完了です。
下記エラーが出たら'ed'パッケージを全ホストにインストールしてみて下さい。
gpadmin-[WARN]:-Failed to insert port=40000 in /data/primary/gpseg0/postgresql.conf gpadmin-[FATAL][0]:-Failed Update port number to 40000
あとはDatabaseを作成して接続すればOKです。
$ createdb test $ psql psql: FATAL: database "gpadmin" does not exist $ export PGDATABASE=test $ psql psql (8.2.15) Type "help" for help. test=# \l List of databases Name | Owner | Encoding | Access privileges -----------+---------+----------+--------------------- postgres | gpadmin | UTF8 | template0 | gpadmin | UTF8 | =c/gpadmin : gpadmin=CTc/gpadmin template1 | gpadmin | UTF8 | =c/gpadmin : gpadmin=CTc/gpadmin test | gpadmin | UTF8 | (4 rows) export MASTER_DATA_DIRECTORY=/data/master/gpse
以上、インストールでした。
(ノ´▽`)ノ{+++THANK YOU+++}ヽ(´▽`ヽ)