Greenplum6.0安裝

環(huán)境

名稱 說明
操作系統(tǒng) CentOS7 x86_64
greenplum greenplum-db-6.0.0-rhel7-x86_64.rpm

下載地址

集群

Host IP 功能
test1 172.20.0.23 master
test2 172.20.0.26 segment
test3 172.20.0.27 segment

修改/etc/hosts

每個節(jié)點都修改

vim /etc/hosts

172.20.0.23 test1 test1
172.20.0.26 test2 test2
172.20.0.27 test3 test3

修改/etc/sysconfig/network

每個節(jié)點都修改

vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME= host名字

修改/etc/security/limits.conf

vim /etc/security/limits.conf 
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

修改/etc/sysctl.conf

vim /etc/sysctl.conf

kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 500 1024000 200 4096
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
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 = 10000 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.swappiness = 10
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
vm.dirty_background_ratio = 0
vm.dirty_ratio=0
vm.dirty_background_bytes = 1610612736
vm.dirty_bytes = 4294967296
vm.overcommit_memory = 2     ### 測試環(huán)境要取消這個,否則oracle啟不來 ### 值為1

讓配置生效

sysctl -p

修改/etc/security/limits.d/90-nproc.conf

vim /etc/security/limits.d/90-nproc.conf

*          soft    nproc     131072
root       soft    nproc     unlimited

關閉防火墻

啟動: systemctl start firewalld

關閉: systemctl stop firewalld

查看狀態(tài): systemctl status firewalld 

開機禁用  : systemctl disable firewalld

開機啟用  : systemctl enable firewalld

修改/etc/selinux/config

vim  /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

拷貝文件到其他節(jié)點

scp /etc/sysctl.conf test2:/etc
scp /etc/security/limits.d/90-nproc.conf test2:/etc/security/limits.d
scp /etc/selinux/config test2:/etc/selinux

創(chuàng)建gpadmin用戶

groupadd -g 530 gpadmin
useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin
chown -R gpadmin:gpadmin /home/gpadmin
passwd gpadmin 密碼
echo "gpadmin" | passwd --stdin gpadmin

master安裝greenplum

rpm -ivh greenplum-db-6.0.0-rhel7-x86_64.rpm
# 默認的安裝路徑是/usr/local,然后需要修改該路徑gpadmin操作權限:
chown -R gpadmin:gpadmin /usr/local

創(chuàng)建hostlist

su - gpadmin
mkdir -p /home/gpadmin/conf
vim /home/gpadmin/conf/hostlist

test1
test2
test3

創(chuàng)建seg_hosts

vim /home/gpadmin/conf/seg_hosts
 
test2
test3

配置免密(每個節(jié)點)

ssh-keygen -t rsa

cat ~/.ssh/id_rsa.pub | ssh -o stricthostkeychecking=no gpadmin@test1 "cat - >> ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh -o stricthostkeychecking=no gpadmin@test2 "cat - >> ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh -o stricthostkeychecking=no gpadmin@test3 "cat - >> ~/.ssh/authorized_keys"
# 配置ssh權限
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys

greenplum配置ssh免密連接

su root
source /usr/local/greenplum-db/greenplum_path.sh 
gpssh-exkeys -f /home/gpadmin/conf/hostlist

segment安裝greenplum

權限

chown -R gpadmin:gpadmin /usr/local
chown -R gpadmin:gpadmin /opt

壓縮、傳到各節(jié)點

tar -cf gp.tar greenplum-db-5.0.0/

scp gp.tar test2:/usr/local
scp gp.tar test3:/usr/local

批量解壓

source /usr/local/greenplum-db/greenplum_path.sh

gpssh -f /home/gpadmin/conf/seg_hosts

cd /usr/local

tar -xf gp.tar
# 因為greenplum默認的路徑為greenplum-db需要映射過去
ln -s /urs/local/greenplum-db-6.0.0 greenplum-db

ll

exit

初始化數(shù)據(jù)庫

source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f /home/gpadmin/conf/hostlist #統(tǒng)一處理所有節(jié)點
 
# 創(chuàng)建資源目錄 /opt/greenplum/data下一系列目錄(生產目錄個數(shù)可根據(jù)需求生成)
 mkdir -p /opt/greenplum/data/master
 mkdir -p /opt/greenplum/data/primary
 mkdir -p /opt/greenplum/data/mirror
 mkdir -p /opt/greenplum/data2/primary
 mkdir -p /opt/greenplum/data2/mirror

環(huán)境變量配置

vim /home/gpadmin/.bash_profile

# 添加文本
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/opt/greenplum/data/master/gpseg-1
export GPPORT=5432
export PGDATABASE=gp_sydb

# 復制到各節(jié)點
scp /home/gpadmin/.bash_profile test2:/home/gpadmin/


source .bash_profile

NTP配置

gpssh -f /home/gpadmin/conf/hostlist -v -e 'sudo ntpd'
gpssh -f /home/gpadmin/conf/hostlist -v -e 'sudo /etc/init.d/ntpd start && sudo chkconfig --level 35 ntpd on'

檢查個各節(jié)點的連通性

cd /usr/local/greenplum-db/bin
gpcheckperf -f /home/gpadmin/conf/hostlist -r N -d /tmp

修改/usr/local/greenplum-db/greenplum_path.sh

vim /usr/local/greenplum-db/greenplum_path.sh
# libgpopt.so.3所在的路徑/usr/local/greenplum-db-6.0.0/lib
LD_LIBRARY_PATH=$GPHOME/lib:libgpopt.so.3所在的路徑:${LD_LIBRARY_PATH-}
export LD_LIBRARY_PATH

初始化

cd /usr/local/greenplum-db/docs/cli_help/gpconfigs
cp gpinitsystem_config initgp_config
vim initgp_config  
 
#以下為文本要修改的屬性字段配置      
#配置幾次資源目錄就是每個子節(jié)點有幾個實例(推薦4-8個,這里配置了4個,primary與mirror文件夾個數(shù)對應)
declare -a DATA_DIRECTORY=(/opt/greenplum/data/primary /opt/greenplum/data/primary  /opt/greenplum/data2/primary /opt/greenplum/data2/primary)
declare -a MIRROR_DATA_DIRECTORY=(/opt/greenplum/data/mirror /opt/greenplum/data/mirror  /opt/greenplum/data2/mirror /opt/greenplum/data2/mirror)
 
ARRAY_NAME=”gp_sydb”                                        #4.2.1章節(jié)配置的初始化數(shù)據(jù)庫名稱
MASTER_HOSTNAME=test1                                   #主節(jié)點名稱
MASTER_DIRECTORY=/opt/greenplum/data/master                 #資源目錄為在4.1章節(jié)創(chuàng)建的資源目錄
MASTER_DATA_DIRECTORY=/opt/greenplum/data/master/gpseg-1    #與4.1章節(jié)配置一樣
DATABASE_NAME=gp_sydb                                       #4.2.1章節(jié)配置的初始化數(shù)據(jù)庫名稱
MACHINE_LIST_FILE=/home/gpadmin/conf/seg_hosts              #就是3.2.2章節(jié)創(chuàng)建的文件

gpinitsystem -c initgp_config

數(shù)據(jù)庫操作

gpstop -M fast
gpstart -a
psql -d postgres



\l # 查看數(shù)據(jù)庫

\c # 進入數(shù)據(jù)庫

\d # 查看表

\d tablename # 查看表結構


?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容