vi /etc/hostslinux
172.17.13.160 v1 gpmaster 172.17.13.161 v2 gpsegment1 172.17.13.162 v3 gpsegment2
建立用戶組命令:groupadd -g 530 gpadmin 建立用戶命令:useradd -g 530 -u530 -m -d /home/gpadmin -s /bin/bash gpadmin 修改密碼命令:passwd gpadmin
vi /etc/sysctl.confgit
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
立馬生效sysctl -pgithub
vi /etc/security/limits.conf數據庫
* soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 13107
啓動: systemctl start firewalld 關閉: systemctl stop firewalld 查看狀態: systemctl status firewalld 開機禁用 : systemctl disable firewalld 開機啓用 : systemctl enable firewalld
vi /etc/selinux/configbash
SELINUX=disabled
timedatectl set-timezone Asia/Shanghai
mkdir /opt/greenplum chown -R gpadmin:gpadmin /opt/greenplum
賦權命令: chmod +x greenplum-db-5.11.3-rhel7-x86_64.bin 執行安裝命令: ./greenplum-db-5.11.3-rhel7-x86_64.bin 安裝過程當中修改安裝目錄:/opt/greenplum/greenplum-db 安裝成功後:安裝目錄的權限修改成gpadmin 命令以下: 命令: chown -R gpadmin:gpadmin /opt/greenplum
vi ./conf/hostlist(新增文件) (在這個目錄/opt/greenplum/conf,須要建立conf文件夾) gpmaster gpsegment1 gpsegment2 vi ./conf/seg_hosts(新增文件) gpsegment1 gpsegment2
source /opt/greenplum/greenplum-db/greenplum_path.sh gpssh-exkeys -f /opt/greenplum/conf/hostlist (注意當前路徑)
顯示 [INFO] completed successfully 即打通成功服務器
測試節點是否打通成功cookie
gpssh -f /opt/greenplum/conf/hostlist pwd
成功截圖以下:ssh
cd /opt/greenplum tar -cf gp.tar greenplum-db/ gpscp -f /opt/greenplum/conf/hostlist gp.tar =:/opt/greenplum/ (複製到每臺機器命令) 批量複製成功後去segment系統查看文件是否存在 ,若是存在執行如下命令解壓 gpssh -f /opt/greenplum/conf/hostlist => cd /opt/greenplum => tar -xf gp.tar => ll (能夠查看是否安裝成功) => exit 到此全部節點安裝完成
成功截圖以下tcp
批量建立greenplum數據存放目錄 如:/home/gpadmin/gpdata/gpmasteride
命令: gpssh -f /opt/greenplum/conf/hostlist => cd /home/gpadmin => mkdir gpdata => cd gpdata => mkdir gpmaster gpdatap1 gpdatap2 gpdatam1 gpdatam2 => ll => exit
成功截圖以下
vi /home/gpadmin/.bash_profile
新增如下內容: source /opt/greenplum/greenplum-db/greenplum_path.sh export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/gpmaster/gpseg-1 export PGPORT=5432
立馬生效
source /home/gpadmin/.bash_profile
vi /opt/greenplum/conf/gpinitsystem_config
ARRAY_NAME="Greenplum" SEG_PREFIX=gpseg PORT_BASE=33000 declare -a DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatap1 /home/gpadmin/gpdata/gpdatap2) MASTER_HOSTNAME=gpmaster MASTER_DIRECTORY=/home/gpadmin/gpdata/gpmaster MASTER_PORT=5432 TRUSTED_SHELL=/usr/bin/ssh MIRROR_PORT_BASE=43000 REPLICATION_PORT_BASE=34000 MIRROR_REPLICATION_PORT_BASE=44000 declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatam1 /home/gpadmin/gpdata/gpdatam2) MACHINE_LIST_FILE=/opt/greenplum/conf/seg_hosts
批量初始化命令
gpinitsystem -c /opt/greenplum/conf/gpinitsystem_config -h /opt/greenplum/conf/hostlist
單庫初始化命令
gpinitsystem -c /opt/greenplum/conf/gpinitsystem_config -s gpmaster
vi /home/gpadmin/gpdata/gpmaster/gpseg-1/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD host all all 10.10.56.17/24 trust
修改配置生效 (master上執行,用gpadmin用戶) gpstop -u
中止數據庫 gpstop -M fast -a 啓動數據庫 gpstart -m
備註
1. 須要安裝命令ifconfig、netstat
20200413:11:13:08:006443 gpstart:gpmaster:gpadmin-[INFO]:-Starting Master instance in admin mode
現象:gp某個segment啓動異常。 gpstate -mgpstate -m
緣由:服務器宕機重啓後,啓動異常,經查看,硬盤存儲不夠,segment恢復失敗
解決:增長一部份內存,而後手動恢復seg 產生一個恢復文件:gprecoverseg -o ./recov 查看須要恢復的seg: cat recov 進行恢復: gprecoverseg -i ./recov 查看恢復狀態: gpstate -m
使用 gprecoverseg -F
yum -y install perl perl-devel 安裝依賴便可 全部的服務器都要安裝