Linux安装mpp数据库(Greenplum 集群部署)
作者:互联网
下载greenplum-db-5.23.0-rhel7-x86_64.bin安装包
个人百度网盘地址:链接:https://pan.baidu.com/s/1YCIo9vS0fSfi6pHwDLL5KQ 提取码:jmr6
简单记录一下安装mpp(greenplum)的过程,以及遇到的问题。不喜勿喷
简单来说GPDB是一个分布式数据库软件,其可以管理和处理分布在多个不同主机上的海量数据。对于GPDB来说,一个DB实例实际上是由多个独立的PostgreSQL实例组成的,它们分布在不同的物理主机上,协同工作,呈现给用户的是一个DB的效果。Master是GPDB系统的访问入口,其负责处理客户端的连接及SQL 命令、协调系统中的其他Instance(Segment)工作,Segment负责管理和处理用户数据。
环境准备:
CentOS Linux release 7.6.1810 (Core)
master 1台(架构图中的主节点),Standby 1台(架构图中的从节点),Segment 2台。共4台服务器
ip 主机名
192.168.73.128 mdw
192.168.73.129 smdw
192.168.73.131 sdw1
192.168.73.135 sdw2
- 修改/etc/hosts文件,添加下面内容(4台服务器相同的配置)cat /etc/hosts
[root@mdw master]# cat /etc/hosts
192.168.73.128 mdw
192.168.73.129 smdw
192.168.73.131 sdw1
192.168.73.135 sdw2
- 服务器关闭selinux,防火墙4台服务器相互开放,测试环境可以直接先关闭防火墙。(4台服务器)
- 操作系统参数设置(4台服务器)
vi /etc/sysctl.conf (4台服务器)
添加或修改:
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 500000000
kernel.shmall = 4000000000
kernel.shmmni = 4096
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.conf.default.arp_filter = 1
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog = 10000
vm.overcommit_memory = 2
vi /etc/security/limits.conf (注:4台服务器)
添加或修改:
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
磁盘预读参数及 deadline算法修改 (注:4台服务器)
blockdev --setra /dev/sda
echo deadline > /sys/block/sda/queue/scheduler
- 初始化安装gp数据库
greenplum-db-5.23.0-rhel7-x86_64.bin
[root@mdw software]# ./greenplum-db-5.23.0-rhel7-x86_64.bin
注意:不要一直输入y,中间有一步骤需要 enter!
- 在master上添加用户
useradd gpadmin
- 确保所有的服务器安装了ed软件,否则后面初始化集群就会报错(四台服务器)
yum install ed -y
- master节点上 准备文件,all_hosts ,seg_hosts放到/home/gpadmin。(用于批量安装软件以及后续集群的初始化)
[gpadmin@mdw ~]$ cat seg_hosts
sdw1
sdw2
[gpadmin@mdw ~]$ cat all_hosts
mdw
smdw
sdw1
sdw2
- 建立节点服务器间的信任(没有打通的会要求输入密码)
[root@mdw gpadmin]# gpssh-exkeys -f all_hosts
[STEP of ] create local ID and authorize on local host
... /root/.ssh/id_rsa file exists ... key generation skipped
[STEP of ] keyscan all hosts and update known_hosts file
[STEP of ] authorize current user on remote hosts
... send to smdw
... send to sdw1
... send to sdw2
[STEP of ] determine common authentication file content
[STEP of ] copy authentication files to all remote hosts
... finished key exchange with smdw
... finished key exchange with sdw1
... finished key exchange with sdw2
[INFO] completed successfully
- 批量安装软件(GP)
cd /home/gpadmin/
source /usr/local/greenplum-db/greenplum_path.sh
gpseginstall -f all_hosts -u gpadmin -p gpadmin
最后出现如下提示代表批量安装成功。
:::: gpseginstall:greenplum_master:root-[INFO]:-SUCCESS -- Requested commands completed
- 检查是否安装完成
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f all_hosts -e ls -l $GPHOME
输出如下代表成功:
[ mdw] ls -l /usr/local/greenplum-db/.
[ mdw] total
[ mdw] drwxr-xr-x gpadmin gpadmin Feb bin
[ mdw] drwxr-xr-x gpadmin gpadmin Feb demo
[ mdw] drwxr-xr-x gpadmin gpadmin Feb docs
[ mdw] drwxr-xr-x gpadmin gpadmin Feb etc
[ mdw] drwxr-xr-x gpadmin gpadmin Feb ext
[ mdw] -rw-r--r-- gpadmin gpadmin Feb GPDB-LICENSE.txt
[ mdw] -rw-rw-r-- gpadmin gpadmin Aug : greenplum_path.sh
[ mdw] drwxr-xr-x gpadmin gpadmin Feb include
[ mdw] drwxr-xr-x gpadmin gpadmin Feb lib
[ mdw] -rw-r--r-- gpadmin gpadmin Feb LICENSE.thirdparty
[ mdw] drwxr-xr-x gpadmin gpadmin Aug : sbin
[ mdw] drwxr-xr-x gpadmin gpadmin Feb share
[sdw1] ls -l /usr/local/greenplum-db/.
[sdw1] total
[sdw1] drwxr-xr-x gpadmin gpadmin Feb bin
[sdw1] drwxr-xr-x gpadmin gpadmin Feb demo
[sdw1] drwxr-xr-x gpadmin gpadmin Feb docs
[sdw1] drwxr-xr-x gpadmin gpadmin Feb etc
[sdw1] drwxr-xr-x gpadmin gpadmin Feb ext
[sdw1] -rw-r--r-- gpadmin gpadmin Feb GPDB-LICENSE.txt
[sdw1] -rw-rw-r-- gpadmin gpadmin Aug : greenplum_path.sh
[sdw1] drwxr-xr-x gpadmin gpadmin Feb include
[sdw1] drwxr-xr-x gpadmin gpadmin Feb lib
[sdw1] -rw-r--r-- gpadmin gpadmin Feb LICENSE.thirdparty
[sdw1] drwxr-xr-x gpadmin gpadmin Aug : sbin
[sdw1] drwxr-xr-x gpadmin gpadmin Feb share
[smdw] ls -l /usr/local/greenplum-db/.
[smdw] total
[smdw] drwxr-xr-x gpadmin gpadmin Feb bin
[smdw] drwxr-xr-x gpadmin gpadmin Feb demo
[smdw] drwxr-xr-x gpadmin gpadmin Feb docs
[smdw] drwxr-xr-x gpadmin gpadmin Feb etc
[smdw] drwxr-xr-x gpadmin gpadmin Feb ext
[smdw] -rw-r--r-- gpadmin gpadmin Feb GPDB-LICENSE.txt
[smdw] -rw-rw-r-- gpadmin gpadmin Aug : greenplum_path.sh
[smdw] drwxr-xr-x gpadmin gpadmin Feb include
[smdw] drwxr-xr-x gpadmin gpadmin Feb lib
[smdw] -rw-r--r-- gpadmin gpadmin Feb LICENSE.thirdparty
[smdw] drwxr-xr-x gpadmin gpadmin Aug : sbin
[smdw] drwxr-xr-x gpadmin gpadmin Feb share
[sdw2] ls -l /usr/local/greenplum-db/.
[sdw2] total
[sdw2] drwxr-xr-x gpadmin gpadmin Feb bin
[sdw2] drwxr-xr-x gpadmin gpadmin Feb demo
[sdw2] drwxr-xr-x gpadmin gpadmin Feb docs
[sdw2] drwxr-xr-x gpadmin gpadmin Feb etc
[sdw2] drwxr-xr-x gpadmin gpadmin Feb ext
[sdw2] -rw-r--r-- gpadmin gpadmin Feb GPDB-LICENSE.txt
[sdw2] -rw-rw-r-- gpadmin gpadmin Aug : greenplum_path.sh
[sdw2] drwxr-xr-x gpadmin gpadmin Feb include
[sdw2] drwxr-xr-x gpadmin gpadmin Feb lib
[sdw2] -rw-r--r-- gpadmin gpadmin Feb LICENSE.thirdparty
[sdw2] drwxr-xr-x gpadmin gpadmin Aug : sbin
[sdw2] drwxr-xr-x gpadmin gpadmin Feb share
- 创建存储目录
在master,standby 节点操作命令:
mkdir -p /data/master
chown -R gpadmin.gpadmin /data/master/
在master上用下面命令批量操作segment,建立目录,改权限
gpssh -f seg_hosts -e 'mkdir -p /data/primary'
gpssh -f seg_hosts -e 'mkdir -p /data/mirror'
gpssh -f seg_hosts -e 'chown -R gpadmin.gpadmin /data/primary'
gpssh -f seg_hosts -e 'chown -R gpadmin.gpadmin /data/mirror'
- 保持所有主机的时间同步,如果不同步,请按照ntp时间服务器搭建保持同步。
- 检查环境(这里检查一下操作系统参数设置是否ok,网络,io,都可以检查的)
20210308:11:53:00:017364 gpcheck:mdw:root-[INFO]:-dedupe hostnames
20210308:11:53:00:017364 gpcheck:mdw:root-[INFO]:-Detected platform: Generic Linux Cluster
20210308:11:53:00:017364 gpcheck:mdw:root-[INFO]:-generate data on servers
20210308:11:53:01:017364 gpcheck:mdw:root-[INFO]:-copy data files from servers
20210308:11:53:02:017364 gpcheck:mdw:root-[INFO]:-delete remote tmp files
20210308:11:53:02:017364 gpcheck:mdw:root-[INFO]:-Using gpcheck config file: /usr/local/greenplum-db/./etc/gpcheck.cnf
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): on device (/dev/sda1) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): on device (/dev/sda2) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): on device (/dev/sda) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): /etc/sysctl.conf value for key 'net.ipv4.ip_local_port_range' has value '1025 65535' and expects '10000 65535'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): /etc/sysctl.conf value for key 'kernel.sem' has value '250 512000 100 2048' and expects '500 1024000 200 4096'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): XFS filesystem on device /dev/sda1 has 6 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): XFS filesystem on device /dev/mapper/centos-root has 6 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(smdw): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): on device (/dev/sda1) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): on device (/dev/sda2) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): on device (/dev/sda) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): /etc/sysctl.conf value for key 'net.ipv4.ip_local_port_range' has value '1025 65535' and expects '10000 65535'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): /etc/sysctl.conf value for key 'kernel.sem' has value '250 512000 100 2048' and expects '500 1024000 200 4096'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): XFS filesystem on device /dev/sda1 has 5 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): XFS filesystem on device /dev/mapper/centos-root has 5 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): on device (/dev/sda1) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): on device (/dev/sda2) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): on device (/dev/sda) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): /etc/sysctl.conf value for key 'net.ipv4.ip_local_port_range' has value '1025 65535' and expects '10000 65535'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): /etc/sysctl.conf value for key 'kernel.sem' has value '250 512000 100 2048' and expects '500 1024000 200 4096'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): XFS filesystem on device /dev/sda1 has 6 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): XFS filesystem on device /dev/mapper/centos-root has 6 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): on device (/dev/sda1) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): on device (/dev/sda2) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): on device (/dev/sda) blockdev readahead value '8192' does not match expected value '16384'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): /etc/sysctl.conf value for key 'net.ipv4.ip_local_port_range' has value '1025 65535' and expects '10000 65535'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): /etc/sysctl.conf value for key 'kernel.sem' has value '250 512000 100 2048' and expects '500 1024000 200 4096'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): XFS filesystem on device /dev/sda1 has 6 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): XFS filesystem on device /dev/mapper/centos-root has 6 XFS mount options and 4 are expected
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'allocsize=16m'
20210308:11:53:02:017364 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): XFS filesystem on device /dev/mapper/centos-root is missing the recommended mount option 'noatime'
20210308:11:53:02:017364 gpcheck:mdw:root-[INFO]:-gpcheck completing...
- 在master上进行下面的操作:
创建Greenplum数据库配置文件,以gpadmin用户登录
su - gpadmin
cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpinitsystem_config
chmod gpinitsystem_config
添加如下参数:
#添加:
ARRAY_NAME="EMC Greenplum DW"
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/data/primary)
MASTER_HOSTNAME=mdw #注意修改主机名
MASTER_DIRECTORY=/data/master
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=16
ENCODING=UTF8
MIRROR_PORT_BASE=50000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
declare -a MIRROR_DATA_DIRECTORY=(/data/mirror)
- 运行初始化工具初始化数据库
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
gpinitsystem -c gpinitsystem_config -h seg_hosts
正常情况下初始化完成以后最后的日志没有任何报错,而且gp进程也是启动了的。
初始化日志:
:::: gpinitsystem:mdw:gpadmin-[INFO]:-Review options for gpinitstandby
:::: gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
:::: gpinitsystem:mdw:gpadmin-[INFO]:-The Master /data/master/gpseg-/pg_hba.conf post gpinitsystem
:::: gpinitsystem:mdw:gpadmin-[INFO]:-has been configured to allow all hosts within this new
:::: gpinitsystem:mdw:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
:::: gpinitsystem:mdw:gpadmin-[INFO]:-new array must be explicitly added to this file
:::: gpinitsystem:mdw:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
:::: gpinitsystem:mdw:gpadmin-[INFO]:-located in the /usr/local/greenplum-db/./docs directory
:::: gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
查看进程 ps -ef | grep postgres
[root@mdw gpadmin]# ps -ef | grep postgres
gpadmin : ? :: /usr/local/greenplum-db-4.3.7.3/bin/postgres -D /data/master/gpseg- -p -b -z --silent-mode=true -i -M master -C - -x -E
gpadmin : ? :: postgres: port , master logger process
gpadmin : ? :: postgres: port , stats collector process
gpadmin : ? :: postgres: port , writer process
gpadmin : ? :: postgres: port , checkpoint process
gpadmin : ? :: postgres: port , seqserver process
gpadmin : ? :: postgres: port , ftsprobe process
gpadmin : ? :: postgres: port , sweeper process
root : pts/ :: grep postgres
- 现在只有1个master,2个segment,没有standby,那么接下来把standby加入集群。
在master服务器上执行:
gpinitstandby -s smdw
输出如下:
[gpadmin@mdw ~]$ gpinitstandby -s smdw
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Validating environment and parameters for standby initialization...
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Checking for filespace directory /data/master/gpseg- on smdw
:::: gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master initialization parameters
:::: gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master hostname = mdw
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master data directory = /data/master/gpseg-
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master port =
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master hostname = smdw
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master port =
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master data directory = /data/master/gpseg-
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum update system catalog = On
:::: gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------
:::: gpinitstandby:mdw:gpadmin-[INFO]:- Filespace locations
:::: gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------
:::: gpinitstandby:mdw:gpadmin-[INFO]:-pg_system -> /data/master/gpseg-
Do you want to continue with standby master initialization? Yy|Nn (default=N):
> y
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby
:::: gpinitstandby:mdw:gpadmin-[INFO]:-The packages on smdw are consistent.
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Adding standby master to catalog...
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Database catalog updated successfully.
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Updating pg_hba.conf file...
:::: gpinitstandby:mdw:gpadmin-[INFO]:-pg_hba.conf files updated successfully.
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Updating filespace flat files...
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Filespace flat file updated successfully.
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Starting standby master
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Checking if standby master is running on host: smdw in directory: /data/master/gpseg-
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Cleaning up pg_hba.conf backup files...
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Backup files of pg_hba.conf cleaned up successfully.
:::: gpinitstandby:mdw:gpadmin-[INFO]:-Successfully created standby master on smdw
- 设置环境变量,master,standby都设置
以gpadmin用户登录:
su - gpadmin
打开用户启动文件(如.bashrc)。比如:
vi ~/.bashrc
添加新行用以加载greenplum_path.sh文件和设置MASTER_DATA_DIRECTORY环境变量。例如:
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
启动和停止数据库测试是否能正常启动和关闭,命令如下:
gpstart
gpstop
到此 greenplum 就部署完成了。下面进行一些简单的测试。
- 测试 登录数据库:psql -d postgres
就可以执行建库建表,查询语句了。 - 开放远程访问权限
修改/data/master/gpseg-1/pg_hba.conf文件
添加:
host all all 0/0 md5
- navicat测试连接:(如若需要修改gpadmin的默认用户密码,请继续往下看。)
21.postgre相关操作
查看postgre的用户名 密码
SELECT u.usename AS “User name”,u.usesysid AS “User ID”,CASE WHEN u.usesuper AND u.usecreatedb THEN CAST(‘superuser, create database’ AS pg_catalog.text)
WHEN u.usesuper THEN CAST(‘superuser’ AS pg_catalog.text)
WHEN u.usecreatedb THEN CAST(‘create database’ AS
pg_catalog.text)
ELSE CAST(’’ AS pg_catalog.text)
END AS “Attributes”
FROM pg_catalog.pg_user u
ORDER BY 1;
修改postgre的用户名 密码
ALTER USER gpadmin WITH PASSWORD ‘gpadmin’;
标签:Greenplum,Linux,gpcheck,gpadmin,mpp,ERROR,20210308,root,mdw 来源: https://blog.csdn.net/xtwu007/article/details/114526393