【GP6安装配置】 Greenplum6.2.1 安装手记(下)
作者:lianghc
本文分為兩部分
參數(shù)配置:【GP6安裝配置】 Greenplum6.2.1 安裝手記(上)?
執(zhí)行安裝:【GP6安裝配置】 Greenplum6.2.1 安裝手記(下)
目錄
3. 集群軟件安裝
3.1 執(zhí)行安裝程序
3.2 創(chuàng)建hostfile_exkeys
3.3 集群互信,免密登陸
3.3.1 ?生成密鑰
3.3.3 使用gpssh-exkeys 工具,打通n-n的免密登陸
3.3.4 驗(yàn)證gpssh
3.4 同步master 配置到各個(gè)主機(jī)(非官方教程步驟)
3.4.1 批量添加gpadmin用戶
3.4.2 打通gpadmin 用戶免密登錄
3.4.3 批量設(shè)置greenplum在gpadmin用戶的環(huán)境變量
3.4.4 ?批量復(fù)制系統(tǒng)參數(shù)到其他節(jié)點(diǎn)
3.5 集群節(jié)點(diǎn)安裝
3.5.1 模擬gpseginstall 腳本
3.5.2 創(chuàng)建集群數(shù)據(jù)目錄
3.6 集群性能測試
3.6.1 網(wǎng)絡(luò)性能測試
3.6.2 磁盤I/O 性能測試
3.6.3 集群時(shí)鐘校驗(yàn)(非官方步驟)
4. ?集群初始化
4.1 ?編寫初始化配置文件
4.1.1 拷貝配置文件模板
4.1.2 根據(jù)需要修改參數(shù)
4.2 集群初始化
4.2.1 集群初始化命令參數(shù)
4.2.2 執(zhí)行報(bào)錯(cuò)處理
4.3 初始化完成后續(xù)操作
4.3.2 設(shè)置環(huán)境變量
4.3.3 若刪除重裝,使用gpdeletesystem
4.3.4 配置pg_hba.conf
5 安裝成功后配置
5.1 psql 登陸gp 并設(shè)置密碼
5.1.1 登陸到不同節(jié)點(diǎn)
5.2 客戶端登陸gp
5.2.1. 配置 pg_hba.conf
5.2.2. 修改postgresql.conf?
5.2.3. 加載修改的文件
3. 集群軟件安裝
參考:https://gpdb.docs.pivotal.io/6-2/install_guide/install_gpdb.html
# 與舊版本差異點(diǎn)
3.1 執(zhí)行安裝程序
? ? ? ?執(zhí)行安裝腳本,默認(rèn)安裝到/usr/local/ 目錄下。
?yum install -y ./greenplum-db-6.2.1-rhel6-x86_64.rpm或者使用rpm 安裝
rpm -ivh greenplum-db-6.2.1-rhel6-x86_64.rpm? ? ? ?本次測試是內(nèi)網(wǎng)機(jī),無法聯(lián)網(wǎng)下載所有的依賴包,也沒有提前外網(wǎng)下載好依賴包。而是等安裝時(shí)缺什么,再下載什么。現(xiàn)在缺少 libyaml,下載并上傳至服務(wù)器,安裝后再試運(yùn)行g(shù)p安裝程序。libyaml下載地址 http://rpmfind.net/linux/rpm2html/search.php?query=libyaml(x86-64)
[root@mdw gp_install_package]# ?yum install -y ./greenplum-db-6.2.1-rhel6-x86_64.rpm Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Setting up Install Process Examining ./greenplum-db-6.2.1-rhel6-x86_64.rpm: greenplum-db-6.2.1-1.el6.x86_64 Marking ./greenplum-db-6.2.1-rhel6-x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package greenplum-db.x86_64 0:6.2.1-1.el6 will be installed --> Finished Dependency ResolutionDependencies Resolved=======================================================================================================================================================Package ????????????????????????Arch ?????????????????????Version ??????????????????????????Repository ??????????????????????????????????????????Size ======================================================================================================================================================= Installing:greenplum-db ???????????????????x86_64 ???????????????????6.2.1-1.el6 ??????????????????????/greenplum-db-6.2.1-rhel6-x86_64 ???????????????????493 MTransaction Summary ======================================================================================================================================================= Install ??????1 Package(s)Total size: 493 M Installed size: 493 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum.Installing : greenplum-db-6.2.1-1.el6.x86_64 ????????????????????????????????????????????????????????????????????????????????????????????????????1/1Verifying ?: greenplum-db-6.2.1-1.el6.x86_64 ????????????????????????????????????????????????????????????????????????????????????????????????????1/1Installed:greenplum-db.x86_64 0:6.2.1-1.el6Complete!
3.2 創(chuàng)建hostfile_exkeys
在$GPHOME目錄創(chuàng)建兩個(gè)host文件(all_host,seg_host),用于后續(xù)使用gpssh,gpscp 等腳本host參數(shù)文件
all_host : 內(nèi)容是集群所有主機(jī)名或ip,包含master,segment,standby等。
seg_host: 內(nèi)容是所有 segment主機(jī)名或ip
若一臺(tái)機(jī)器有多網(wǎng)卡,且網(wǎng)卡沒有綁定成bond0模式時(shí),需要將多網(wǎng)卡的ip 或者h(yuǎn)ost都列出來。
修改文件夾權(quán)限
[root@mdw greenplum-db]# chown -R gpadmin:gpadmin /usr/local/greenplum*3.3 集群互信,免密登陸
## 與舊版本差異點(diǎn)gp6.x 以前無需3.3.1 ssh-keygen生成密鑰,3.3.2 的ssh-copy-id 步驟,直接gpssh-exkeys -f all_host。
3.3.1 ?生成密鑰
我的Linux還沒有公私鑰對,所以,要先生成一個(gè)
[root@mdw greenplum-db]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 88:c0:be:87:6a:c2:40:ed:fd:ab:34:f0:35:60:47:0f root@mdw The key's randomart image is: +--[ RSA 2048]----+ | ??????E ????????| | . ???. o ???????| | ?+ ?o . . ??????| | o o..o. ????????| |. o.o .oS ???????| |. ?+o.. . ???????| |o o .+. ?????????| |.+ .. .. ????????| |+ ???.... ???????| +-----------------+3.3.2 將本機(jī)的公鑰復(fù)制到各個(gè)節(jié)點(diǎn)機(jī)器的authorized_keys文件中
[root@mdw greenplum-db]# ssh-copy-id sdw1[root@mdw greenplum-db]# ssh-copy-id sdw2
3.3.3 使用gpssh-exkeys 工具,打通n-n的免密登陸
[root@mdw?greenplum-db]# gpssh-exkeys -f all_host
Problem getting hostname for gpzq-sh-mb: [Errno -3] Temporary failure in name resolution
Traceback (most recent call last):File "/usr/local/greenplum-db/./bin/gpssh-exkeys", line 409, in <module>(primary, aliases, ipaddrs) = socket.gethostbyaddr(hostname)
socket.gaierror: [Errno -3] Temporary failure in name resolution
# 沒有做章節(jié)( 2.2.1 配置每臺(tái)機(jī)器host )的內(nèi)容,導(dǎo)致上述錯(cuò)誤
[root@gjzq-sh-mb greenplum-db]# hostname mdw
[root@gjzq-sh-mb greenplum-db]# gpssh-exkeys -f all_host
[STEP 1 of 5] create local ID and authorize on local host... /root/.ssh/id_rsa file exists ... key generation skipped[STEP 2 of 5] keyscan all hosts and update known_hosts file[STEP 3 of 5] retrieving credentials from remote hosts... send to sdw1... send to sdw2[STEP 4 of 5] determine common authentication file content[STEP 5 of 5] copy authentication files to all remote hosts... finished key exchange with sdw1... finished key exchange with sdw2[INFO] completed successfully
3.3.4 驗(yàn)證gpssh
[root@mdw ~]# source /usr/local/greenplum-db/greenplum_path.sh [root@mdw ~]# gpssh -f /usr/local/greenplum-db/all_host -e 'ls /usr/local/' [ mdw] ls /usr/local/ [ mdw] bin ?games ?????????greenplum-db-6.2.1 ?lib ???libexec ???????sbin ??src [ mdw] etc ?greenplum-db ?include ?????????????lib64 ?openssh-6.5p1 ?share ?ssl [sdw1] ls /usr/local/ [sdw1] bin ?games ???lib ???libexec ????????sbin ??src [sdw1] etc ?include ?lib64 ?openssh-6.5p1 ?share ?ssl [sdw2] ls /usr/local/ [sdw2] bin ?games ???lib ???libexec ????????sbin ??src [sdw2] etc ?include ?lib64 ?openssh-6.5p1 ?share ?ssl3.4 同步master 配置到各個(gè)主機(jī)(非官方教程步驟)
本步驟非官方教程內(nèi)容,官方教程在修改系統(tǒng)參數(shù)步驟中 就已經(jīng)把集群所有主機(jī)的配置都改成一致的。本文檔中前面修改參數(shù)部分,只修改master主機(jī)的參數(shù),在本步驟中做集群統(tǒng)一配置。
3.4.1 批量添加gpadmin用戶
[root@mdw greenplum-db]# source greenplum_path.sh [root@mdw greenplum-db]# gpssh -f seg_host -e 'groupadd gpadmin;useradd gpadmin -r -m -g gpadmin;echo "gpadmin" | passwd --stdin gpadmin;' [root@mdw greenplum-db]# gpssh -f seg_host -e 'ls /home/'3.4.2 打通gpadmin 用戶免密登錄
?## 與舊版本差異點(diǎn) gp6 之前,gpadmin 用戶的 免密登錄步驟由gpseginstall 工具自動(dòng)處理,gp6 需要人工處理。 [root@mdw greenplum-db-6.2.1]# su - gpadmin [gpadmin@mdw ~]$ source /usr/local/greenplum-db/greenplum_path.sh [gpadmin@mdw ~]$ ssh-keygen [gpadmin@mdw ~]$ ssh-copy-id sdw1 [gpadmin@mdw ~]$ ssh-copy-id sdw2 [gpadmin@mdw ~]$ gpssh-exkeys -f /usr/local/greenplum-db/all_host3.4.3 批量設(shè)置greenplum在gpadmin用戶的環(huán)境變量
添加gp的安裝目錄,和話環(huán)境信息到 用戶的環(huán)境變量中。
編輯 .bash_profile
編輯 .bashrc
cat >> /home/gpadmin/.bashrc << EOF source /usr/local/greenplum-db/greenplum_path.sh EOF環(huán)境變量文件分發(fā)到其他節(jié)點(diǎn)
su - gpadmin source /usr/local/greenplum-db/greenplum_path.sh gpscp -f /usr/local/greenplum-db/seg_host /home/gpadmin/.bash_profile ?gpadmin@=:/home/gpadmin/.bash_profile gpscp -f /usr/local/greenplum-db/seg_host /home/gpadmin/.bashrc gpadmin@=:/home/gpadmin/.bashrc?
3.4.4 ?批量復(fù)制系統(tǒng)參數(shù)到其他節(jié)點(diǎn)
# 示例:
su root
gpscp -f seg_host /etc/hosts ??root@=:/etc/hosts
gpscp -f seg_host /etc/security/limits.conf ??root@=:/etc/security/limits.conf?
gpscp -f seg_host /etc/sysctl.conf ?root@=:/etc/sysctl.conf?
gpscp -f seg_host /etc/security/limits.d/90-nproc.conf ??root@=:/etc/security/limits.d/90-nproc.conf
gpssh -f seg_host -e '/sbin/blockdev --setra 16384 /dev/sda'
gpssh -f seg_host -e 'echo deadline > /sys/block/sda/queue/scheduler'
gpssh -f seg_host -e 'sysctl -p'
gpssh -f seg_host -e 'reboot'
3.5 集群節(jié)點(diǎn)安裝
## 與舊版本差異點(diǎn)目前官網(wǎng)缺少這部分說明。 在gp6 之前,有一個(gè)工具gpseginstall ,可以安裝各個(gè)節(jié)點(diǎn)的gp軟件。根據(jù)gpseginstall的日志可以分析出,gpseginstall的主要步驟是: 1. 節(jié)點(diǎn)上創(chuàng)建gp用戶 (此步驟可略過) 2. 打包主節(jié)點(diǎn)安裝目錄 3. scp到各個(gè)seg 服務(wù)器 4. 解壓,創(chuàng)建軟連接 5. 授權(quán)給gpamdin gpseginstall 安裝日志,參考gp5 安裝筆記
3.5.1 模擬gpseginstall 腳本
以下腳本模擬gpseginstall 的主要過程,完成gpsegment的部署
# root 用戶下執(zhí)行 # 變量設(shè)置 link_name='greenplum-db' ???????????????????#軟連接名 binary_dir_location='/usr/local' ???????????#安裝路徑 binary_dir_name='greenplum-db-6.2.1' ???????#安裝目錄 binary_path='/usr/local/greenplum-db-6.2.1' #全目錄# master節(jié)點(diǎn)上打包
chown -R gpadmin:gpadmin $binary_path rm -f ${binary_path}.tar; rm -f ${binary_path}.tar.gz cd $binary_dir_location; tar cf ${binary_dir_name}.tar ${binary_dir_name} gzip ${binary_path}.tar# 分發(fā)到segment
gpssh -f ${binary_path}/seg_host -e "mkdir -p ${binary_dir_location};rm -rf ${binary_path};rm -rf ${binary_path}.tar;rm -rf ${binary_path}.tar.gz" gpscp -f ${binary_path}/seg_host ${binary_path}.tar.gz root@=:${binary_path}.tar.gz gpssh -f ${binary_path}/seg_host -e "cd ${binary_dir_location};gzip -f -d ${binary_path}.tar.gz;tar xf ${binary_path}.tar" gpssh -f ${binary_path}/seg_host -e "rm -rf ${binary_path}.tar;rm -rf ${binary_path}.tar.gz;rm -f ${binary_dir_location}/${link_name}" gpssh -f ${binary_path}/seg_host -e ln -fs ${binary_dir_location}/${binary_dir_name} ${binary_dir_location}/${link_name} gpssh -f ${binary_path}/seg_host -e "chown -R gpadmin:gpadmin ${binary_dir_location}/${link_name};chown -R gpadmin:gpadmin ${binary_dir_location}/${binary_dir_name}" gpssh -f ${binary_path}/seg_host -e "source ${binary_path}/greenplum_path" gpssh -f ${binary_path}/seg_host -e "cd ${binary_dir_location};ll"3.5.2 創(chuàng)建集群數(shù)據(jù)目錄
3.5.2.1 創(chuàng)建master 數(shù)據(jù)目錄
?mkdir -p /opt/greenplum/data/masterchown gpadmin:gpadmin /opt/greenplum/data/masterstandby 數(shù)據(jù)目錄(本次實(shí)驗(yàn)沒有standby )
使用gpssh 遠(yuǎn)程給standby 創(chuàng)建數(shù)據(jù)目錄
3.5.2.2 創(chuàng)建segment 數(shù)據(jù)目錄
本次計(jì)劃每個(gè)主機(jī)安裝兩個(gè) segment,兩個(gè)mirror.
3.6 集群性能測試
## 與舊版本差異點(diǎn)gp6 取消了gpcheck 工具。目前可校驗(yàn)的部分是網(wǎng)絡(luò)和磁盤IO性能。gpcheck工具可以對gp需要的系統(tǒng)參數(shù),硬件配置進(jìn)行校驗(yàn)
詳情參考官網(wǎng):
https://gpdb.docs.pivotal.io/6-2/install_guide/validate.html#topic1
擴(kuò)展閱讀:
https://yq.aliyun.com/articles/230896?spm=a2c4e.11155435.0.0.a9756e1eIiHSoH
個(gè)人經(jīng)驗(yàn)(僅供才考,具體標(biāo)準(zhǔn) 要再找資料):
一般來說磁盤要達(dá)到2000M/s
網(wǎng)絡(luò)至少1000M/s
3.6.1 網(wǎng)絡(luò)性能測試
實(shí)驗(yàn)示例:
[root@mdw local]# ?gpcheckperf -f /usr/local/greenplum-db/seg_host -r N -d /tmp /usr/local/greenplum-db/./bin/gpcheckperf -f /usr/local/greenplum-db/seg_host -r N -d /tmp------------------- -- ?NETPERF TEST -------------------Authorized only. All activity will be monitored and reported NOTICE: -t is deprecated, and has no effect NOTICE: -f is deprecated, and has no effectAuthorized only. All activity will be monitored and reported NOTICE: -t is deprecated, and has no effect NOTICE: -f is deprecated, and has no effect [Warning] netperf failed on sdw2 -> sdw1==================== == ?RESULT 2019-12-18T19:40:30.264321 ==================== Netperf bisection bandwidth test sdw1 -> sdw2 = 2273.930000Summary: sum = 2273.93 MB/sec min = 2273.93 MB/sec max = 2273.93 MB/sec avg = 2273.93 MB/sec median = 2273.93 MB/sec?測試發(fā)現(xiàn) netperf failed on sdw2 -> sdw1。檢查發(fā)現(xiàn)是sdw2的hosts沒有配置。
3.6.2 磁盤I/O 性能測試
實(shí)驗(yàn)單機(jī)裝兩個(gè)seg,但是只有一塊盤,所以測試一個(gè)目錄即可,測試月產(chǎn)生32G的數(shù)據(jù),需要留有足夠的磁盤空間。
?gpcheckperf -f /usr/local/greenplum-db/seg_host -r ds -D ??-d /opt/greenplum/data1/primary [root@mdw greenplum-db]# ?gpcheckperf -f /usr/local/greenplum-db/seg_host -r ds -D ??-d /opt/greenplum/data1/primary /usr/local/greenplum-db/./bin/gpcheckperf -f /usr/local/greenplum-db/seg_host -r ds -D -d /opt/greenplum/data1/primary -------------------- -- ?DISK WRITE TEST -------------------- -------------------- -- ?DISK READ TEST -------------------- -------------------- -- ?STREAM TEST -------------------- ==================== == ?RESULT 2019-12-18T19:59:06.969229 ====================disk write avg time (sec): 47.34disk write tot bytes: 66904850432disk write tot bandwidth (MB/s): 1411.59disk write min bandwidth (MB/s): 555.60 [sdw2]disk write max bandwidth (MB/s): 855.99 [sdw1]-- per host bandwidth --disk write bandwidth (MB/s): 855.99 [sdw1]disk write bandwidth (MB/s): 555.60 [sdw2]disk read avg time (sec): 87.33disk read tot bytes: 66904850432disk read tot bandwidth (MB/s): 738.54disk read min bandwidth (MB/s): 331.15 [sdw2]disk read max bandwidth (MB/s): 407.39 [sdw1]-- per host bandwidth --disk read bandwidth (MB/s): 407.39 [sdw1]disk read bandwidth (MB/s): 331.15 [sdw2]stream tot bandwidth (MB/s): 12924.30stream min bandwidth (MB/s): 6451.80 [sdw1]stream max bandwidth (MB/s): 6472.50 [sdw2]-- per host bandwidth --stream bandwidth (MB/s): 6451.80 [sdw1]stream bandwidth (MB/s): 6472.50 [sdw2]3.6.3 集群時(shí)鐘校驗(yàn)(非官方步驟)
驗(yàn)證集群時(shí)間,若不一致,需要修改ntp
gpssh -f /usr/local/greenplum-db/all_host -e 'date'
4. ?集群初始化
官方文檔:https://gpdb.docs.pivotal.io/6-2/install_guide/init_gpdb.html
4.1 ?編寫初始化配置文件
4.1.1 拷貝配置文件模板
su - gpadmin mkdir -p /home/gpadmin/gpconfigs cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config
4.1.2 根據(jù)需要修改參數(shù)
注意:To specify PORT_BASE, review the port range specified in the net.ipv4.ip_local_port_range parameter in the /etc/sysctl.conf file.
主要修改的參數(shù):
4.2 集群初始化
4.2.1 集群初始化命令參數(shù)
執(zhí)行腳本:
gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config -h /usr/local/greenplum-db/seg_host -D
4.2.2 執(zhí)行報(bào)錯(cuò)處理
[gpadmin@mdw gpconfigs]$ gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config -h /usr/local/greenplum-db/seg_host -D
...
/usr/local/greenplum-db/./bin/gpinitsystem: line 244: /tmp/cluster_tmp_file.8070: Permission denied
/bin/mv: cannot stat `/tmp/cluster_tmp_file.8070': Permission denied
...
20191218:20:22:57:008070 gpinitsystem:mdw:gpadmin-[FATAL]:-Unknown host sdw1: ping: icmp open socket: Operation not permitted
unknown host Script Exiting!
4.2.2.1 Permission denied 錯(cuò)誤 處理
gpssh -f /usr/local/greenplum-db/all_host -e 'chmod 777 /tmp'4.2.2.2 icmp open socket: Operation not permitted 錯(cuò)誤處理
gpssh -f /usr/local/greenplum-db/all_host -e 'chmod u+s /bin/ping'4.2.2.3 失敗回退
安裝中途失敗,提示使用 ?bash /home/gpadmin/gpAdminLogs/backout_gpinitsystem_gpadmin_* 回退,執(zhí)行該腳本即可,例如:
若執(zhí)行后仍然未清理干凈,可執(zhí)行一下語句后,再重新安裝:
pg_ctl -D /opt/greenplum/data/master/gpseg-1 stop rm -f /tmp/.s.PGSQL.5432 /tmp/.s.PGSQL.5432.lock rm -Rf /opt/greenplum/data/master/gpseg-1
?4.2.2.4 ping: unknown host gpzq-sh-mb unknown host Script Exiting! 錯(cuò)誤
請參考:
http://note.youdao.com/noteshare?id=8a72fdf1ec13a1c79b2d795e406b3dd2&sub=313FE99D57C84F2EA498DB6D7B79C7D3
編輯 /home/gpadmin/.gphostcache 文件,為一下內(nèi)容:
[gpadmin@mdw ~]$ cat .gphostcache
mdw:mdw
sdw1:sdw1
sdw2:sdw2
4.3 初始化完成后續(xù)操作
順利初始化完成,會(huì) 打印出 Greenplum Database instance successfully created。
日志生成到/home/gpadmin/gpAdminLogs/ 目錄下,命名規(guī)則: gpinitsystem_${安裝日期}.log
日志最后部分如下:
仔細(xì)閱讀日志最后面的內(nèi)容,還有幾個(gè)步驟需要操作。4.3.1 檢查日志內(nèi)容
日志中有如下提示:
Scan ?warnings or errors:
?cat /home/gpadmin/gpAdminLogs/gpinitsystem_20191218.log|grep -E -i 'WARN|ERROR]'根據(jù)日志內(nèi)容做相應(yīng)的調(diào)整,使集群性能達(dá)到最優(yōu)。
4.3.2 設(shè)置環(huán)境變量
編輯gpadmin 用戶的環(huán)境變量,增加
source /usr/local/greenplum-db/greenplum_path.sh export MASTER_DATA_DIRECTORY=/opt/greenplum/data/master/gpseg-1除此之外,通常還增加:
export PGPORT=5432 ??????# 根據(jù)實(shí)際情況填寫 export PGUSER=gpadmin ???# 根據(jù)實(shí)際情況填寫 export PGDATABASE=gpdw ?# 根據(jù)實(shí)際情況填寫環(huán)境變量詳情參考:https://gpdb.docs.pivotal.io/510/install_guide/env_var_ref.html
前面已經(jīng)添加過 source /usr/local/greenplum-db/greenplum_path.sh,此處操作如下:
編輯 .bash_profile
su - gpadmin cat >> /home/gpadmin/.bash_profile << EOF export MASTER_DATA_DIRECTORY=/opt/greenplum/data/master/gpseg-1 export PGPORT=5432 export PGUSER=gpadmin export PGDATABASE=gpdw EOF編輯 .bashrc
cat >> /home/gpadmin/.bashrc << EOF export MASTER_DATA_DIRECTORY=/opt/greenplum/data/master/gpseg-1 export PGPORT=5432 export PGUSER=gpadmin export PGDATABASE=gpdw EOF環(huán)境變量文件分發(fā)到其他節(jié)點(diǎn)
gpscp -f /usr/local/greenplum-db/seg_host /home/gpadmin/.bash_profile ?gpadmin@=:/home/gpadmin/.bash_profile gpscp -f /usr/local/greenplum-db/seg_host /home/gpadmin/.bashrc gpadmin@=:/home/gpadmin/.bashrc gpssh -f /usr/local/greenplum-db/all_host -e 'source /home/gpadmin/.bash_profile;source /home/gpadmin/.bashrc;'4.3.3 若刪除重裝,使用gpdeletesystem
安裝完成,出于種種原因,若需要集群刪除重裝,使用 gpdeletesystem ?工具
詳情參考官方文檔:
https://gpdb.docs.pivotal.io/6-2/utility_guide/ref/gpdeletesystem.html#topic1
使用命令:
-d 后面跟 MASTER_DATA_DIRECTORY(master 的數(shù)據(jù)目錄),會(huì)清除master,segment所有的數(shù)據(jù)目錄。
-f force, 終止所有進(jìn)程,強(qiáng)制刪除。示例:
刪除完成后再根據(jù)自己需要,調(diào)整集群初始化配置文件,并重新初始化。
vi /home/gpadmin/gpconfigs/gpinitsystem_config
gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config -h /usr/local/greenplum-db/seg_host -D
4.3.4 配置pg_hba.conf
根據(jù)訪問需要 ,配置pg_hba.conf。
/opt/greenplum/data/master/gpseg-1/pg_hba.conf
詳情參考后文:5.2.1. 配置 pg_hba.conf
5 安裝成功后配置
5.1 psql 登陸gp 并設(shè)置密碼
是用psql 登錄gp, 一般命令格式為:
psql -h hostname -p port -d database -U user -W password-h后面接對應(yīng)的master或者segment主機(jī)名
-p后面接master或者segment的端口號
-d后面接數(shù)據(jù)庫名可將上述參數(shù)配置到用戶環(huán)境變量中,linux 中使用gpadmin用戶不需要密碼。
psql 登錄,并設(shè)置gpadmin用戶密碼示例:
5.1.1 登陸到不同節(jié)點(diǎn)
參數(shù)示意:
#登陸主節(jié)點(diǎn) [gpadmin@mdw gpconfigs]$ PGOPTIONS='-c gp_session_role=utility' psql -h mdw -p5432 -d postgres#登陸到segment,需要指定segment 端口。 [gpadmin@mdw gpconfigs]$ PGOPTIONS='-c gp_session_role=utility' psql -h sdw1 -p6000 -d postgres5.2 客戶端登陸gp
配置 pg_hba.conf
配置 postgresql.conf
5.2.1. 配置 pg_hba.conf
?參考配置說明:https://blog.csdn.net/yaoqiancuo3276/article/details/80404883
vi /opt/greenplum523/data/master/gpseg-1/pg_hba.conf# TYPE ?DATABASE ???????USER ???????????ADDRESS ????????????????METHOD # "local" is for Unix domain socket connections only # IPv4 local connections: # IPv6 local connections: local ???all ????????gpadmin ????????ident host ????all ????????gpadmin ????????127.0.0.1/28 ???trust host ????all ????????gpadmin ????????172.28.25.204/32 ??????trust host ????all ????????gpadmin ????????0.0.0.0/0 ??md5 ?# 新增規(guī)則允許任意ip 密碼登陸 host ????all ????????gpadmin ????????::1/128 ??????trust host ????all ????????gpadmin ????????fe80::250:56ff:fe91:63fc/128 ??????trust local ???replication gpadmin ????????ident host ????replication gpadmin ????????samenet ??????trust5.2.2. 修改postgresql.conf?
postgresql.conf里的監(jiān)聽地址設(shè)置為:
listen_addresses = '*' ??# 允許監(jiān)聽任意ip gp6.0 默認(rèn)會(huì)設(shè)置這個(gè)參數(shù)為 listen_addresses = '*' ?
5.2.3. 加載修改的文件
gpstop -u?至此,安裝完成。是用客戶端軟件登錄驗(yàn)證即可。
后續(xù)再安裝擴(kuò)展插件,如gpcc, dblink,madlib 等
總結(jié)
以上是生活随笔為你收集整理的【GP6安装配置】 Greenplum6.2.1 安装手记(下)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: indexedDB基本使用(内含案例)
- 下一篇: c语言表示注释,c语言中注释的位置