1. 程式人生 > >greenplum4.3的安裝與配置

greenplum4.3的安裝與配置

目標架構如上圖
一、硬體評估
  1. cpu主頻,核數
    推薦CPU核數與磁碟數的比例在12:12以上
    Instance上執行時只能利用一個CPU核資源進行計算,推薦高主頻
  2. 記憶體容量
  3. 網路頻寬
    重分佈操作
  4. Raid效能
    條頻寬度設定
    回寫特性

二、作業系統
1、在SUSE或者RedHat上使用xfs(作業系統使用ext3)
   在Solaris上使用zfs(作業系統使用ufs)



2、系統包
出現如下介面,按照下面的說明進行勾選,之後一直【Next】到開始安裝。 --》【Desktop Environments】全置空 --》【Applications】中【Editors】和【Text-based Internet】保持不動,其他置空 --》【Development】中【Development Libraries】和【Development Tools】全選 其他置空 --》【Servers】全部置空 --》【Base System】置空【X Window System】
3、
注意:SELINUX & IPTABLES
對於RedHat6.x系統來說,沒有重啟後的配置畫面,預設狀態下SELINUX 和IPTABLES都是開啟狀態。在登入系統後還需要進行如下操作:
   關閉SELINUX – 使用getenforce命令檢查SELINUX狀態,若結果不
是”Disabled”,可使用setenforce 0命令臨時關閉SELINUX。要永久關閉
SELINUX,需修改/etc/selinux/config配置檔案,修改配置為
SELINUX=disabled。
   關閉IPTABLES – 使用service iptables status命令檢查IPTABLES狀態,若結
果不是”Firewall is stopped”,可使用service iptables stop命令關閉IPTABLES。
要永久關閉IPTABLES,使用chkconfig iptables off命令。
4、禁用OOM限制器(redhat5沒有這個問題)
5、將/etc/sysctl.conf檔案的內容修改為如下內容,重啟生效(或執行sysctl -p生效)
複製程式碼
kernel.shmmax = 5000000000
kernel.shmmni = 4096
kernel.shmall = 40000000000
kernel.sem = 250 5120000 100 20480
#SEMMSL SEMMNS SEMOPM SEMMNI
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.default.rp_filter = 1 net.ipv4.conf.default.arp_filter = 1 net.ipv4.conf.all.arp_filter = 1 net.ipv4.ip_local_port_range = 1025 65535 net.core.netdev_max_backlog = 10000 vm.overcommit_memory = 2
複製程式碼 6、在/etc/security/limits.conf配置檔案末尾處增加如下內容: * soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072 * soft core unlimited 注意:對於RedHat6.x系統,還需要將/etc/security/limits.d/90-nproc.conf檔案中 的1024修改為131072。
7、在Linux平臺,推薦使用XFS檔案系統
GP建議使用下面的掛載引數: rw,noatime,inode64,allocsize=16m 比如,掛載XFS格式的裝置/dev/sdb到目錄/data1,/etc/fstab中的配置如下: /dev/sdb /data1 xfs rw,noatime,inode64,allocsize=16m 1 1 使用XFS檔案系統,需安裝相應的rpm軟體包,並對磁碟裝置進行格式化: # rpm -ivh xfsprogs-2.9.4-4.el5.x86_64.rpm # mkfs.xfs -f /dev/sdb
8、Linux磁碟I/O排程器對磁碟的訪問支援不同的策略,預設的為CFQ,GP建議設定為deadline
要檢視某驅動器的I/O排程策略,可通過如下命令檢視,下面示例的為正確 的配置: # cat /sys/block/{devname}/queue/scheduler noop anticipatory [deadline] cfq 修改磁碟I/O排程策略的方法為,修改/boot/grub/menu.lst檔案的啟動引數, 在kernel一行的最後追加”elevator=deadline”,如下為正確配置的示例: [[email protected]_test1 ~]# vi /boot/grub/menu.lst  # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE:  You have a /boot partition.  This means that #          all kernel and initrd paths are relative to /boot/, eg. #          root (hd0,0) #          kernel /vmlinuz-version ro root=/dev/vg00/LV_01 #          initrd /initrd-version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux Server (2.6.18-308.el5)         root (hd0,0)         kernel /vmlinuz-2.6.18-308.el5 ro root=/dev/vg00/LV_01 rhgb quiet elevator=deadline         initrd /initrd-2.6.18-308.el5.img 注意:修改該配置檔案需謹慎,錯誤的修改會導致重啟作業系統失敗。
9、每個磁碟裝置檔案需要配置read-ahead(blockdev)值為65536
官方文件的推薦值為16384,但譯者認為應該為65536更合理,該值設定的是預讀扇區數, 實際上預讀的位元組數是blockdev設定除以2,而GP預設的blocksize為32KB, 剛好與65536(32768B/32KB)對應。 檢查某塊磁碟的read-ahead設定: # blockdev --getra devname 例如: # blockdev --getra /dev/sda 65536 修改系統的read-ahead設定,可通過/etc/rc.d/rc.local來修改,在檔案尾部追加如下程式碼: # blockdev --setra 65536 /dev/mapper/vg00-LV_01 如需臨時修改read-ahead設定,可通過執行下面的命令來實現: # blockdev --setra bytes devname  例如: # blockdev --setra 65536 /dev/sda
三、執行GP安裝程式
1、安裝
hosts配置正確很重要。 #hostname gp_test1 #vi /etc/sysconfig/network #vi /etc/hosts reboot一下 建立一個host_file,包含了Greenplum部署的所有主機名,內容如下: mdw1 smdw1 sdw1 sdw2 建立一個hostfile_segonly,包含了所有的Segment Host的主機名,內容如下: sdw1 sdw2 建立一個hostfile_exkeys,包含了所有的Greenplum主機的網口對應的主機名(因為有可能是雙網絡卡的伺服器),內如如下: mdw1 smdw1 sdw1 sdw2 [[email protected]_test1 gp_files]# gpseginstall -f host_file -u gpadmin -p gpadmin 複製程式碼
20150312:00:06:39:003425 gpseginstall:gp_test1:root-[INFO]:-Installation Info:
link_name None
binary_path /opt/greenplum
binary_dir_location /opt
binary_dir_name greenplum
20150312:00:06:40:003425 gpseginstall:gp_test1:root-[INFO]:-check cluster password access
20150312:00:06:41:003425 gpseginstall:gp_test1:root-[INFO]:-de-duplicate hostnames
20150312:00:06:41:003425 gpseginstall:gp_test1:root-[INFO]:-master hostname: gp_test1
20150312:00:06:41:003425 gpseginstall:gp_test1:root-[INFO]:-check for user gpadmin on cluster
20150312:00:06:42:003425 gpseginstall:gp_test1:root-[INFO]:-add user gpadmin on master
20150312:00:06:42:003425 gpseginstall:gp_test1:root-[INFO]:-add user gpadmin on cluster
20150312:00:06:43:003425 gpseginstall:gp_test1:root-[INFO]:-chown -R gpadmin:gpadmin /opt/greenplum
20150312:00:06:44:003425 gpseginstall:gp_test1:root-[INFO]:-rm -f /opt/greenplum.tar; rm -f /opt/greenplum.tar.gz
20150312:00:06:44:003425 gpseginstall:gp_test1:root-[INFO]:-cd /opt; tar cf greenplum.tar greenplum
20150312:00:07:03:003425 gpseginstall:gp_test1:root-[INFO]:-gzip /opt/greenplum.tar
20150312:00:07:34:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: mkdir -p /opt
20150312:00:07:34:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: rm -rf /opt/greenplum
20150312:00:07:35:003425 gpseginstall:gp_test1:root-[INFO]:-scp software to remote location
20150312:00:07:52:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: gzip -f -d /opt/greenplum.tar.gz
20150312:00:11:09:003425 gpseginstall:gp_test1:root-[INFO]:-md5 check on remote location
20150312:00:11:15:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: cd /opt; tar xf greenplum.tar
x`xxxxxxx20150312:00:14:40:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: rm -f /opt/greenplum.tar
20150312:00:14:41:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: chown -R gpadmin:gpadmin /opt/greenplum
20150312:00:14:42:003425 gpseginstall:gp_test1:root-[INFO]:-rm -f /opt/greenplum.tar.gz
20150312:00:14:42:003425 gpseginstall:gp_test1:root-[INFO]:-Changing system passwords ...
20150312:00:14:44:003425 gpseginstall:gp_test1:root-[INFO]:-exchange ssh keys for user root
20150312:00:14:51:003425 gpseginstall:gp_test1:root-[INFO]:-exchange ssh keys for user gpadmin
20150312:00:14:58:003425 gpseginstall:gp_test1:root-[INFO]:-/opt/greenplum//sbin/gpfixuserlimts -f /etc/security/limits.conf -u gpadmin
20150312:00:14:58:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: . /opt/greenplum//greenplum_path.sh; /opt/greenplum//sbin/gpfixuserlimts -f /etc/security/limits.conf -u gpadmin
20150312:00:14:59:003425 gpseginstall:gp_test1:root-[INFO]:-version string on master: gpssh version 4.3.4.1 build 2
20150312:00:14:59:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: . /opt/greenplum//greenplum_path.sh; /opt/greenplum//bin/gpssh --version
20150312:00:14:59:003425 gpseginstall:gp_test1:root-[INFO]:-remote command: . /opt/greenplum/greenplum_path.sh; /opt/greenplum/bin/gpssh --version
20150312:00:15:05:003425 gpseginstall:gp_test1:root-[INFO]:-SUCCESS -- Requested commands completed
複製程式碼 [[email protected]_test1 gp_files]# 
2、確認安裝
1).  在Master主機以gpadmin使用者登入: $ su - gpadmin 2).  載入GPDB安裝目錄下的路徑檔案: # source /usr/local/greenplum-db/greenplum_path.sh 3).  使用gpssh命令確認是否可以在不提示輸入密碼的情況下登入到所有安裝 了GP軟體的主機。使用hostfile_exkeys檔案。該檔案需包含所有主機的所 有網口對應的主機名。例如: $ gpssh -f host_file -e ls -l $GPHOME 如果成功登入到所有主機並且未提示輸入密碼,安裝沒有問題。所有主機在安 裝路徑顯示相同的內容,且目錄的所有權為gpadmin使用者。 如果提示輸入密碼,執行下面的命令重新交換SSH金鑰: $ gpssh-exkeys -f host_file
3、安裝 Oracle  相容函式
作為可選項,許多的Oracle相容函式在GPDb中是可用的。 在使用Oracle相容函式之前,需要為沒有資料庫執行一次安裝指令碼: $GPHOME/share/postgresql/contrib/orafunc.sql 例如,在testdb資料庫中安裝這些函式,使用命令: $ psql –d testdb –f /opt/greenplum/share/postgresql/contrib/orafunc.sql 要解除安裝Oracle相容函式,視角如下指令碼: $GPHOME/share/postgresql/contrib/uninstall_orafunc.sql
4、建立資料儲存區域
1)在Master 主機 上建立資料目錄位置 [[email protected]_test1 Server]# mkdir /data/ [[email protected]_test1 Server]# mkdir /data/master [[email protected]_test1 Server]# chown -R gpadmin:gpadmin /data/ 2)使用gpssh命令在Standby Master上建立與和Master相同的資料儲存位置 [[email protected]_test1 data]# source /opt/greenplum/greenplum_path.sh 
[[email protected]_test1 data]# gpssh -h smdw1 -e 'mkdir /data/' [smdw1] mkdir /data/ [[email protected]_test1 data]# gpssh -h smdw1 -e 'mkdir /data/master' [smdw1] mkdir /data/master [[email protected]p_test1 data]#  [[email protected]_test1 data]# gpssh -h smdw1 -e 'chown -R gpadmin:gpadmin /data/' [smdw1] chown -R gpadmin:gpadmin /data/ 3)在所有Segment主機上建立資料目錄位置
Tips:gpssh -h 針對給出的主機名hostname      gpssh -f 針對files檔案裡的清單 使用剛剛建立的hostfile_segonly檔案指定Segment主機列表。例如: [[email protected]_test1 data]# gpssh -f /dba_files/gp_files/hostfile_segonly -e 'mkdir /data' [sdw2] mkdir /data [sdw1] mkdir /data [[email protected]_test1 data]# gpssh -f /dba_files/gp_files/hostfile_segonly -e 'mkdir /data/primary' [sdw2] mkdir /data/primary [sdw1] mkdir /data/primary [[email protected]_test1 data]# gpssh -f /dba_files/gp_files/hostfile_segonly -e 'mkdir /data/mirror' [sdw2] mkdir /data/mirror [sdw1] mkdir /data/mirror [[email protected]_test1 data]# gpssh -f /dba_files/gp_files/hostfile_segonly -e 'chown -R gpadmin:gpadmin /data/' [sdw2] chown -R gpadmin:gpadmin /data/ [sdw1] chown -R gpadmin:gpadmin /data/ 4)NTP配置同步系統時鐘 GP建議使用NTP(網路時間協議)來同步GPDB系統中所有主機的系統時鐘。 在Segment 主機上,NTP應該配置Master 主機作為主時間源,而Standby作為備選時間源。在Master和Standby上配置NTP到首選的時間源(如果沒有更好的選擇可以選擇Master自身作為最上端的事件源)。 配置NTP 1.  在Master主機,以root登入編輯/etc/ntp.conf檔案。設定server引數指向資料中心 的NTP時間伺服器。例如(假如10.6.220.20是資料中心NTP伺服器的IP地址): server 10.6.220.20 2.  在每個Segment主機,以root登入編輯/etc/ntp.conf檔案。設定第一個server引數 指向Master主機,第二個server引數指向Standby主機。例如: server mdw1 prefer server smdw1 3.  在Standby主機,以root登入編輯/etc/ntp.conf檔案。設定第一個server引數指向 Master主機,第二個引數指向資料中心的時間伺服器。例如: server mdw1 prefer server 10.6.220.20 4.  在Master主機,使用NTP守護程序同步所有Segment主機的系統時鐘。例如,使 用gpssh來完成: # gpssh -f hostfile_ allhosts -v -e 'ntpd' 5.  要配置叢集自動同步系統時鐘,應開啟各個NTP客戶機的ntpd服務,並設定為開機時自動執行: # /etc/init.d/ntpd start # chkconfig --level 35 ntpd on 或是service ntpd start ,再設定 ntsysv  ,選擇ntpd服務 傳上NTP主機的/etc/ntp.conf 配置,也就是MASTER,修改部分見下劃線
  1. # Permit time synchronization with our time source, but do not
  2. # permit the source to query or modify the service on this system.
  3. restrict default kod nomodify notrap nopeer noquery
  4. restrict -6 default kod nomodify notrap nopeer noquery
  5. # Permit all access over the loopback interface. This could
  6. # be tightened as well, but to do so would effect some of
  7. # the administrative functions.
  8. restrict 127.0.0.1
  9. restrict -6::1
  10. restrict 10.27.1.0 mask 255.255.255.0 nomodify
  11. # Hosts on local network are less restricted.
  12. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
  13. # Use public servers from the pool.ntp.org project.
  14. # Please consider joining the pool (htt