###WarehousePG 설치 가이드
https://warehouse-pg.io/docs/7x/install_guide/config_os.html
https://warehouse-pg.io/docs/7x/install_guide/install_whpg.html
지원 OS
Red Hat Enterprise Linux 64-bit 8.7 or later
Oracle Linux 64-bit 8.7 or later, using the Red Hat Compatible Kernel (RHCK)
Rocky Linux 8.7 or later
sudo dnf update -y
sudo dnf install apr apr-util bash bzip2 curl iproute krb5-devel \
libcurl libevent libuuid libuv libxml2 libyaml libzstd openldap openssh \
openssh-server openssl openssl-libs perl python3 python3-psycopg2 \
python3-psutil python3-pyyaml readline rsync \
sed tar which zip zlib
sudo dnf config-manager --set-enabled crb
sudo dnf install java-1.8.0-openjdk-devel
sudo yum install python3.11 python3.11-devel python3.11-psycopg2 python3.11-pyyaml python3.11-pip
sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
python --version
python3.11 -m pip --version
python3.11 -m pip install psutil
For all WarehousePG host systems running RHEL, CentOs or Rocky8, SELinux must either be Disabled or configured to allow unconfined access to WarehousePG processes, directories, and the gpadmin user.
sudo setenforce 0
sudo sed -i "s/^SELINUX=.*/SELINUX=disabled/" /etc/selinux/config
To prevent SELinux-related SSH authentication denials that could occur even with SELinux deactivated
sudo tee -a /etc/sssd/sssd.conf << EOF
selinux_provider=none
EOF
sudo systemctl stop firewalld.service
sudo tee -a /etc/sysctl.d/10-whpg.conf << EOF
sudo tee -a /etc/sysctl.conf << EOF
kernel.msgmax = 65536
kernel.msgmnb = 65536
kernel.msgmni = 2048
kernel.sem = 500 2048000 200 8192
kernel.shmmni = 1024
kernel.core_uses_pid = 1
kernel.core_pattern=/var/core/core.%h.%t
kernel.sysrq = 1
net.core.netdev_max_backlog = 2000
net.core.rmem_max = 4194304
net.core.wmem_max = 4194304
net.core.rmem_default = 4194304
net.core.wmem_default = 4194304
net.ipv4.tcp_rmem = 4096 4224000 16777216
net.ipv4.tcp_wmem = 4096 4224000 16777216
net.core.optmem_max = 4194304
net.core.somaxconn = 10000
net.ipv4.ip_forward = 0
net.ipv4.tcp_congestion_control = cubic
net.ipv4.tcp_tw_recycle = 0
net.core.default_qdisc = fq_codel
net.ipv4.tcp_mtu_probing = 0
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.ip_local_port_range = 10000 65535
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.ipfrag_high_thresh = 41943040
net.ipv4.ipfrag_low_thresh = 31457280
net.ipv4.ipfrag_time = 60
net.ipv4.ip_local_reserved_ports=65330
vm.overcommit_memory = 2
vm.overcommit_ratio = 95
vm.swappiness = 10
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
vm.zone_reclaim_mode = 0
EOF
RAM_IN_KB=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
RAM_IN_BYTES=$(($RAM_IN_KB*1024))
echo "vm.min_free_kbytes = $(($RAM_IN_BYTES*3/100/1024))" | sudo tee -a /etc/sysctl.conf > /dev/null
echo "kernel.shmall = $(($RAM_IN_BYTES/2/4096))" | sudo tee -a /etc/sysctl.conf > /dev/null
echo "kernel.shmmax = $(($RAM_IN_BYTES/2))" | sudo tee -a /etc/sysctl.conf > /dev/null
if [ $RAM_IN_BYTES -le $((64*1024*1024*1024)) ]; then
echo "vm.dirty_background_ratio = 3" | sudo tee -a /etc/sysctl.conf > /dev/null
echo "vm.dirty_ratio = 10" | sudo tee -a /etc/sysctl.conf > /dev/null
else
echo "vm.dirty_background_ratio = 0" | sudo tee -a /etc/sysctl.conf > /dev/null
echo "vm.dirty_ratio = 0" | sudo tee -a /etc/sysctl.conf > /dev/null
echo "vm.dirty_background_bytes = 1610612736 # 1.5GB" | sudo tee -a /etc/sysctl.conf > /dev/null
echo "vm.dirty_bytes = 4294967296 # 4GB" | sudo tee -a /etc/sysctl.conf > /dev/null
fi
sudo sysctl -p
sudo tee -a /etc/security/limits.d/10-nproc.conf << EOF
* soft nofile 524288
* hard nofile 524288
* soft nproc 131072
* hard nproc 131072
* soft core unlimited
EOF
ulimit -n 65536 65536
sudo groupadd gpadmin
sudo useradd gpadmin -g gpadmin -m
#sudo usermod -aG wheel gpadmin
echo "gpadmin" | sudo passwd --stdin "gpadmin"
sudo hostnamectl set-hostname whpg-m
sudo hostnamectl set-hostname whpg-sm
sudo hostnamectl set-hostname whpg-s1
sudo hostnamectl set-hostname whpg-s2
sudo tee -a /etc/hosts << EOF
10.0.3.8 whpg-m
10.0.3.228 whpg-sm
10.0.1.224 whpg-s1
10.0.14.16 whpg-s2
EOF
주의 : 모든 node의 hostname을 /etc/hosts의 이름과 동일하게 설정해야 함.
ssh-keygen as "gpadmin" user at Master node .ssh/id_rsa.pub 의 내용을 복사헤서 다른 모든 노드의 .ssh/authorized_keys 에 추가.
sudo -iu gpadmin
rm -f ~/.ssh/id_rsa ~/.ssh/id_rsa.pub
ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
sudo -iu gpadmin
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys <- 에 id_rsa.pub 내용 적용.
chmod 600 .ssh/authorized_keys
scp -r .ssh whpg-sm:/home/gpadmin
scp -r .ssh whpg-s1:/home/gpadmin
scp -r .ssh whpg-s2:/home/gpadmin
주의 : ssh 접속 문제가 있을 때.
sudo sed -i "s/^#PasswordAuthentication yes/PasswordAuthentication yes/" /etc/ssh/sshd_config
sudo sed -i "s/^#PubkeyAuthentication yes/PubkeyAuthentication yes/" /etc/ssh/sshd_config
sudo systemctl restart sshd
scp -r whpg7_redhat9 gpadmin@whpg-sm:/home/gpadmin
scp -r whpg7_redhat9 gpadmin@whpg-s1:/home/gpadmin
scp -r whpg7_redhat9 gpadmin@whpg-s2:/home/gpadmin
sudo dnf install whpg7_redhat9/*.rpm -y
warehouse-pg-clients-7.3.0_WHPG-1.el9.x86_64.rpm 만 설치해 됨.
ln -s /usr/local/edb-whpg7-pxf /usr/local/greenplum-db/pxf
export EDB_SUBSCRIPTION_TOKEN=<Your TOKET>
curl -1sSLf "https://downloads.enterprisedb.com/$EDB_SUBSCRIPTION_TOKEN/gpsupp/setup.rpm.sh" | sudo -E bash
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf install -y warehouse-pg-7 warehouse-pg-clients
sudo dnf install -y whpg-backup edb-whpg-copy edb-whpg7-pgaudit edb-whpg7-user_profile edb-whpg7-diskquota
sudo dnf install -y edb-whpg7-pgvector edb-whpg7-plr edb-whpg7-pljava edb-whpg7-madlib
sudo dnf install -y whpg7-flow-server edb-whpg7-pxf edb-whpg7-whpg_fdw
sudo dnf install -y edb-whpg7-hll edb-whpg7-q3c edb-whpg7-pgsphere edb-whpg7-postgis edb-whpg7-anonymizer
sudo dnf install -y edb-whpg-observability-collector whpg-enterprise-manager
sudo rpm -qa | egrep "whpg|warehouse"
sudo rpm -qa | egrep "whpg|warehouse" | wc -l
20
sudo chown -R gpadmin:gpadmin /usr/edb/whpg7
sudo chown -h gpadmin:gpadmin /usr/local/greenplum-db
sudo chown -h gpadmin:gpadmin /usr/local/greenplum-db-clients
sudo chown -R gpadmin:gpadmin /usr/local/edb-whpg7-pxf
sudo ln -s /usr/local/edb-whpg7-pxf /usr/local/greenplum-db/pxf
sudo chown -h gpadmin:gpadmin /usr/local/greenplum-db/pxf
sudo mkdir -p /data/coordinator
sudo chown -R gpadmin:gpadmin /data/coordinator
파일시스템이 2개이면 /data1, /data2 에 각각 primary, mirror 폴더 생성
sudo mkdir -p /data/primary
sudo mkdir -p /data/mirror
sudo chown -R gpadmin:gpadmin /data/primary
sudo chown -R gpadmin:gpadmin /data/mirror
sudo -iu gpadmin
tee -a /home/gpadmin/.bashrc << EOF
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.16.0.8-1.el9.x86_64
export PXF_HOME=/usr/local/greenplum-db/pxf
export PXF_BASE=/home/gpadmin/pxf-base
export PATH=$PATH:$PXF_HOME/bin
export COORDINATOR_DATA_DIRECTORY=/data/coordinator/gpseg-1
source /usr/local/greenplum-db/greenplum_path.sh
EOF
gpinitsystem_config 생성
sudo -iu gpadmin
mkdir -p gpconfigs
tee -a /home/gpadmin/gpconfigs/gpinitsystem_config << EOF
#FILE NAME: gpinitsystem_config
#Configuration file needed by the gpinitsystem
COORDINATOR_MAX_CONNECT=100
SEG_PREFIX=gpseg
PORT_BASE=6000
declare -a DATA_DIRECTORY=(/data/primary /data/primary )
#declare -a DATA_DIRECTORY=(/data1/primary /data1/primary /data2/primary /data2/primary)
COORDINATOR_HOSTNAME=whpg-m
COORDINATOR_DIRECTORY=/data/coordinator
COORDINATOR_PORT=5432
TRUSTED_SHELL=ssh
ENCODING=UNICODE
MIRROR_PORT_BASE=7000
declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror )
#declare -a MIRROR_DATA_DIRECTORY=(/data1/mirror /data1/mirror /data2/mirror /data2/mirror)
DATABASE_NAME=gpadmin
MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem
EOF
tee -a /home/gpadmin/gpconfigs/hostfile_gpinitsystem << EOF
whpg-s1
whpg-s2
EOF
source /usr/local/greenplum-db/greenplum_path.sh
gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/hostfile_gpinitsystem –n C
gpinitstandby -s whpg-sm
gpstate
gpstart -a
gpstop -af
psql or psql -d gpadmin
gpdeletesystem -d $COORDINATOR_DATA_DIRECTORY -f
SHOW gp_interconnect_type;
select * from pg_extension;
select content, role, port, hostname, address from gp_segment_configuration;