天天看點

【大資料之資料倉庫】安裝部署GreenPlum叢集

本篇将向大家介紹如何快捷的安裝部署GreenPlum測試叢集,大家可以跟着我一塊兒實踐一把^_^

1.主機資源

申請2台網易雲主機,作業系統必須是RedHat或者CentOS,配置盡量高一點。如果是sa統一初始化的實體機,這裡不再描述,因為中間有很多操作(比如關閉puppet服務等等)

2.下載下傳安裝包

下載下傳連結: https://network.pivotal.io/products/pivotal-gpdb,需要先注冊才能下載下傳,建議用非163郵箱注冊;(下載下傳困難可以泡泡找我)

3.開始安裝

以下操作如果沒有特殊說明,則需要在2台主機上同時操作!

3.1修改系統參數:

為簡化操作,部分參數不再這裡描述。

[root@hzayq-helf-xxx ~]# chkconfig iptables off             關閉防火牆
[root@hzayq-helf-xxx ~]# chkconfig --list iptables          檢視防火牆

[root@hzayq-helf-xxx ~]# echo "MaxStartups 300:30:1000" >> /etc/ssh/sshd_config  提高ssh并發
[root@hzayq-helf-xxx ~]# service sshd restart

[root@hzayq-helf-xxx ~]# vi /etc/sysctl.conf                 增加(不是覆寫)以下參數
kernel.sysrq = 1
xfs_mount_options = rw,noatime,inode64,allocsize=16m
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 512000 100 2048
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.overcommit_memory = 2
[root@hzayq-helf-xxx ~]# sysctl -p                           生效

[root@hzayq-helf-xxx ~]# vi /etc/security/limits.conf        增加以下參數
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072           

3.2安裝unzip:

[root@hzayq-helf-xxx ~]# yum install unzip           

3.3安裝GreenPlum:

[root@hzayq-helf-xxx ~]# ./greenplum-db-4.3.11.1-build-1-rhel5-x86_64.bin           

3.4建立普通使用者:

[root@hzayq-helf-xxx ~]# useradd -d /home/gpadmin gpadmin           

3.5生成普通使用者的公私鑰:

[root@hzayq-helf-xxx ~]# su - gpadmin
[gpadmin@hzayq-helf-xxx ~]# ssh-keygen -t rsa -P ''           

3.6配置/etc/hosts:

[gpadmin@hzayq-helf-xxx ~]# hostname                        擷取主機名
[gpadmin@hzayq-helf-xxx ~]# exit                            切換回root
[root@hzayq-helf-xxx ~]# vi /etc/hosts                      添加ip和主機名的映射
比如:
10.171.160.142  hzayq-helf-xxx
10.171.160.143  hzayq-helf-yyy           

3.7設定免密登陸:

[gpadmin@hzayq-helf-xxx ~]# cat .ssh/id_rsa.pub             檢視公鑰
... ...                                                     切換到其他的主機
[gpadmin@hzayq-helf-yyy ~]# vi .ssh/authorized_keys         建立認證檔案,并把所有主機的公鑰粘貼進去,記住把自己的公鑰也貼進去哦
[gpadmin@hzayq-helf-yyy ~]# chmod 600 .ssh/authorized_keys  修改認證檔案權限屬性
... ...                                                     切換回原來的機器
[gpadmin@hzayq-helf-xxx ~]# ssh hzayq-helf-yyy              驗證免密登陸是否OK           

3.8建立資料目錄:

[gpadmin@hzayq-helf-xxx ~]# mkdir -p gp/data/master          建立master目錄
[gpadmin@hzayq-helf-xxx ~]# mkdir -p gp/data/primary1        建立第1個primary目錄
[gpadmin@hzayq-helf-xxx ~]# mkdir -p gp/data/primary2        建立第2個primary目錄
[gpadmin@hzayq-helf-xxx ~]# mkdir -p gp/data/mirror1         建立第1個mirror目錄
[gpadmin@hzayq-helf-xxx ~]# mkdir -p gp/data/mirror2         建立第2個mirror目錄           

3.9編輯環境變量:

[gpadmin@hzayq-helf-xxx ~]# echo "source /usr/local/greenplum-db/greenplum_path.sh" >> .bashrc
[gpadmin@hzayq-helf-xxx ~]# source .bashrc           

3.10初始化GreenPlum系統:

任選1台主機做master,1台做standby master,使用 附件中的2個配置檔案, 需要修改下gpinitsystem_config中MASTER_HOSTNAME字段為master節點

[gpadmin@hzayq-helf-xxx ~]# gpinitsystem -c gpinitsystem_config -h hostfile_gpinitsystem -s hzayq-helf-yyy           

一路Y即可安裝成功!

3.11最後,再編輯下環境變量:

[gpadmin@hzayq-helf-xxx ~]# vi ~/.bashrc    增加以下兩個環境變量
export MASTER_DATA_DIRECTORY=/home/gpadmin/gp/data/master/gpseg-1
export PGPORT=5432
[gpadmin@hzayq-helf-xxx ~]# source ~/.bashrc           

3.12使用psql接入:

[gpadmin@hzayq-helf-xxx ~]# psql -d template1
           

附件

test.zip

歡迎來到GreenPlum的世界!^_^

看這裡:

【大資料之資料倉庫】選型流水記》

本文來自網易雲社群,經作者何李夫授權釋出。

原文位址:【大資料之資料倉庫】安裝部署GreenPlum叢集

更多網易研發、産品、營運經驗分享請通路網易雲社群。 

繼續閱讀