原 GreenPlum 7 单机安装
安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | docker rm -f testgp7 docker run -itd --name testgp7 -h gpdb7 \ -p 5437:5432 -p 28087:28080 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrcentos76:9.2 \ /usr/sbin/init docker rm -f gpdb7 docker run -itd --name gpdb7 -h gpdb7 \ -p 5437:5432 -p 28087:28080 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/centosstream8:4.0 \ /usr/sbin/init docker cp -q greenplum-db-7.3.0-el8-x86_64.rpm gpdb7:/soft/ docker cp -q greenplum-cc-web-7.3.0-gp6-rhel8-x86_64.zip gpdb7:/soft/ docker exec -it gpdb7 bash sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config setenforce 0 systemctl status firewalld.service systemctl disable firewalld.service systemctl start firewalld firewall-cmd --add-port=0-65535/tcp --permanent firewall-cmd --add-port=0-65535/udp --permanent firewall-cmd --reload firewall-cmd --list-ports systemctl stop firewalld.service cat >> /etc/security/limits.conf <<"EOF" * soft nofile 655350 * hard nofile 655350 * soft nproc 655350 * hard nproc 655350 EOF cat >> /etc/sysctl.conf <<"EOF" kernel.shmmax = 4398046511104 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 32000 1024000000 500 32000 vm.overcommit_memory=1 vm.overcommit_ratio=95 EOF sysctl -p groupadd -g 530 gpadmin useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin chown -R gpadmin:gpadmin /home/gpadmin echo "gpadmin:lhr" | chpasswd su - gpadmin mkdir -p /home/gpadmin/conf/ cat > /home/gpadmin/conf/all_hosts <<"EOF" gpdb7 EOF cat > /home/gpadmin/conf/seg_hosts <<"EOF" gpdb7 EOF dnf install -y python39 python3-pyyaml python3-psycopg2 dnf install -y python3.11 python3.11-libs python3.11-pip-wheel \ python3.11-setuptools python3.11-setuptools-wheel python3.11-tkinter \ mpdecimal python3.11-psycopg2 python3.11-devel rpm -ivh python3.11-*.rpm --nodeps rpm -ivh python3-pyyaml-3.12-12.el8.x86_64.rpm rpm -ivh /soft/greenplum-db-7.3.0-el8-x86_64.rpm chown -R gpadmin:gpadmin /usr/local/greenplum-db chown -R gpadmin:gpadmin /usr/local/greenplum-db-7.3.0 echo ". /usr/local/greenplum-db/greenplum_path.sh" >> /home/gpadmin/.bashrc echo "export MASTER_DATA_DIRECTORY=/opt/greenplum/data/master/gpseg-1" >> /home/gpadmin/.bashrc echo "export PGDATABASE=postgres" >> /home/gpadmin/.bashrc echo "export PGPORT=5432" >> /home/gpadmin/.bashrc ./sshUserSetup.sh -user root -hosts "gpdb7 gpdb7" -advanced -noPromptPassphrase ./sshUserSetup.sh -user gpadmin -hosts "gpdb7 gpdb7" -advanced -noPromptPassphrase chmod 600 /home/gpadmin/.ssh/config -- 或 ssh-keygen -t rsa ssh-keygen -t dsa cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys -- 或 ssh-keygen -t rsa cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys /* -- 若是RHEL7的话,需要解决:libstdc版本问题和glibc升级问题,至少需要GLIBC_2.27 cp /soft/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6.0.25 ln -sf /usr/lib64/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6 */ mkdir -p /opt/greenplum/data/master mkdir -p /opt/greenplum/data/master_standby mkdir -p /opt/greenplum/data/primary mkdir -p /opt/greenplum/data/mirror mkdir -p /opt/greenplum/data/ chown -R gpadmin:gpadmin /opt/greenplum su - gpadmin cat > /home/gpadmin/conf/initgp_config <<"EOF" declare -a DATA_DIRECTORY=(/opt/greenplum/data/primary /opt/greenplum/data/primary) declare -a MIRROR_DATA_DIRECTORY=(/opt/greenplum/data/mirror /opt/greenplum/data/mirror) ARRAY_NAME="lhrgp" SEG_PREFIX=gpseg PORT_BASE=6000 MIRROR_PORT_BASE=7000 MASTER_PORT=5432 MASTER_HOSTNAME=gpdb7 MASTER_DIRECTORY=/opt/greenplum/data/master DATABASE_NAME=lhrgpdb MACHINE_LIST_FILE=/home/gpadmin/conf/seg_hosts EOF gpinitsystem -c /home/gpadmin/conf/initgp_config -e=lhr -s gpdb7 -P 5433 -S /opt/greenplum/data/master_standby/gpseg-1 echo "host all all all md5" >> /opt/greenplum/data/master/gpseg-1/pg_hba.conf gpstop -u psql \password gpadmin postgres=# select version(); version ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PostgreSQL 12.12 (Greenplum Database 7.3.0 build commit:0a7a3566873325aca1789ae6f818c80f17a9402d Open Source) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18), 64-bit compiled on Sep 20 2023 23:29:19 Bhuvnesh C. (1 row) postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+---------+----------+-------------+-------------+--------------------- lhrgpdb | gpadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | gpadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | gpadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/gpadmin + | | | | | gpadmin=CTc/gpadmin template1 | gpadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/gpadmin + | | | | | gpadmin=CTc/gpadmin (4 rows) postgres=# select * from gp_segment_configuration order by 1,3 ; dbid | content | role | preferred_role | mode | status | port | hostname | address | datadir ------+---------+------+----------------+------+--------+------+----------+---------+-------------------------------------------- 1 | -1 | p | p | n | u | 5432 | gpdb7 | gpdb7 | /opt/greenplum/data/master/gpseg-1 2 | 0 | p | p | s | u | 6000 | gpdb7 | gpdb7 | /opt/greenplum/data/primary/gpseg0 3 | 1 | p | p | s | u | 6001 | gpdb7 | gpdb7 | /opt/greenplum/data/primary/gpseg1 4 | 0 | m | m | s | u | 7000 | gpdb7 | gpdb7 | /opt/greenplum/data/mirror/gpseg0 5 | 1 | m | m | s | u | 7001 | gpdb7 | gpdb7 | /opt/greenplum/data/mirror/gpseg1 6 | -1 | m | m | s | u | 5433 | gpdb7 | gpdb7 | /opt/greenplum/data/master_standby/gpseg-1 (6 rows) postgres=# psql -U gpadmin -h172.18.0.14 -p 5431 -d lhrgpdb |
gpcc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | mkdir -p /usr/local/greenplum-cc-7.1.1; chown -R gpadmin:gpadmin /usr/local/greenplum-cc-7.1.1 ln -s /usr/local/greenplum-cc-7.1.1 /usr/local/greenplum-cc chown -R gpadmin:gpadmin /usr/local/greenplum-db* su - gpadmin source /usr/local/greenplum-db/greenplum_path.sh unzip /soft/greenplum-cc-web-7.1.1-gp7-el8-x86_64.zip cd greenplum-cc-web-7.1.1-gp7-el8-x86_64/ cat > /tmp/gpcc_install.conf <<"EOF" path = /usr/local master_port = 5432 web_port = 28080 rpc_port = 8899 enable_ssl = false enable_kerberos = false language = 2 EOF ./gpccinstall-7.1.1 -c /tmp/gpcc_install.conf echo 'source /usr/local/greenplum-cc/gpcc_path.sh' >> ~/.bashrc source /usr/local/greenplum-cc/gpcc_path.sh cd $GPCC_HOME cat update-extension.txt cd /usr/local/greenplum-cc-7.3.0/gppkg gppkg install MetricsCollector-7.1.1_gp_7.1.0-rocky8-x86_64.gppkg gpstop -M fast -ra gpcc start ; gpcc status psql -d gpperfmon alter user gpmon with password 'lhr'; echo '*:5432:gpperfmon:gpmon:lhr' > ~/.pgpass chmod 600 /home/gpadmin/.pgpass gpconfig -c shared_preload_libraries -v metrics_collector gpconfig -c gp_enable_query_metrics -v on gpconfig -c track_activities -v on gpconfig -c track_activity_query_size -v 102400 -m 102400 gpconfig -s shared_preload_libraries gpconfig -s gp_enable_query_metrics gpconfig -s track_activities gpstop -M fast -ra gpcc stop ; gpcc start ; gpcc status |
镜像
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | docker commit gpdb7 lhrbest/greenplum:7.3.0_v2 docker tag lhrbest/greenplum:7.3.0_v2 registry.cn-hangzhou.aliyuncs.com/lhrbest/greenplum:7.3.0_v2 docker tag lhrbest/greenplum:7.3.0_v2 ccr.ccs.tencentyun.com/lhrxxt/greenplum:7.3.0_v2 docker rm -f gpdb7 docker run -itd --name gpdb7 -h gpdb7 \ -p 5437:5432 -p 28087:28080 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/greenplum:7.3.0_v2 \ /usr/sbin/init docker exec -it gpdb7 bash -- docker pull lhrbest/greenplum:7.1.0 docker rm -f gpdb71 docker run -itd --name gpdb71 -h gpdb7 \ -p 5437:5432 -p 28087:28080 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/greenplum:7.1.0 \ /usr/sbin/init docker exec -it gpdb71 bash su - gpadmin gpstart -a gpcc start gpcc status gpstate -- docker pull lhrbest/greenplum:7.3.0 docker rm -f gpdb72 docker run -itd --name gpdb72 -h gpdb7 \ -p 5438:5432 -p 28287:28080 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/greenplum:7.3.0 \ /usr/sbin/init docker exec -it gpdb7 bash su - gpadmin gpstart -a gpcc start gpcc status gpstate |
报错
/lib64/libstdc++.so.6的问题
1 2 3 4 5 6 7 8 | /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/greenplum-db-7.3.0/lib/libxerces-c-3.1.so) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/greenplum-db-7.3.0/lib/libxerces-c-3.1.so) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/greenplum-db-7.3.0/lib/libxerces-c-3.1.so) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/greenplum-db-7.3.0/lib/libxerces-c-3.1.so) |
解决:
1 2 3 4 5 6 | strings /usr/lib64/libstdc++.so.6 | grep 'CXXABI' -- 从centos8中拷贝文件/usr/lib64/libstdc++.so.6.0.25,然后做快捷方式 -- 直接下载: wget https://cdn.frostbelt.cn/software/libstdc%2B%2B.so.6.0.26 ln -sf /usr/lib64/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6 |
/lib64/libc.so.6
1 2 3 4 5 6 7 8 | /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libc.so.6: version `GLIBC_2.22' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/greenplum-db-7.3.0/lib/libxerces-c-3.1.so) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /lib64/libstdc++.so.6) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libc.so.6: version `GLIBC_2.22' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /usr/local/greenplum-db-7.3.0/bin/postgres) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/greenplum-db-7.3.0/lib/libxerces-c-3.1.so) /usr/local/greenplum-db-7.3.0/bin/postgres: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /lib64/libstdc++.so.6) |
需要升级glibc,比较危险,不建议安装,升级可以参考:https://dbaup.com/centosshengjiglibcjiejueversion-glibc_2-25-not-foundwenti.html
总结
1、最好是rhel8或RHEL9,在欧拉 openEuler 22.03上也可以安装GPDB 7。在CentOS 7或RHEL7上安装GPDB7需要升级glibc,比较危险,不建议安装,升级可以参考:https://dbaup.com/centosshengjiglibcjiejueversion-glibc_2-25-not-foundwenti.html
2、GreenPlum 7.0和7.1需要python 3.9,需要安装python3-psutil
3、gpcc 6.9版本不支持GP7,需要使用gpcc 7的版本才能监控gpdb 7