Greenplum cluster deployment and installation guide

catalogue

1, Official installation link

2, Greenplum installation file download

2. Install Greenplum

(1) Install gpdb

(2) Set password free login

(3) Create hostlist and standby on_ seg_ hosts,seg_only

(4) Use gpssh exkeys to get through all servers

(5) Confirm installation

3. Create a data store

(1) Create a data store on the master machine

(2) Create a data store on the stand by machine

(3) Create a data store on the segment machine

4. Initialize the database

(1) Create initialization profile

(2) Perform installation

(3) Configure environment variables

(4) Allow client connections

4, Command Center installation steps

1. Preparation

(1) Modify profile

(2) Install the gpperfmon database and create passwords for gpmon users

(3) Create installation directory

2. Install Greenplum CC

1, Official installation link

Greenplum

Configuring Your Systems | Pivotal Greenplum Docs

Greenplun Command Center

Installing and Upgrading Pivotal Greenplum Command Center | Tanzu™ Greenplum GPCC Docs

2, Greenplum installation file download

Greenplum

(Click me to download)

Greenplun Command Center

(Click me to download)

3, Database installation steps
1. Preparation
(1) Modify hostname
Naming rules:
Host: mdw
stand by: smdw
sgement: sdw1,sdw2,sdw3...

hostnamectl set-hostname mdw

(2) Close SELinux
Use the following command to view the status

sestatus

If it is not SELinuxstatus: disabled, it needs to be closed manually

Shell copy code

vi /etc/selinux/config
SELINUX=disabled

(3) Turn off firewall
View firewall status
If iptables, execute

service iptables status

Turn off firewall

service iptables stop

Permanently turn off the firewall

chkconfig iptables off

If firewalld, execute

systemctl status firewalld

Turn off firewall

systemctl stop firewalld.service
systemctl disable firewalld.service

(4) Configure / etc/hosts  
Each should be configured

vim /etc/hosts
    192.168.xxx.1   mdw
    192.168.xxx.2   smdw
    192.168.xxx.3   sdw1
    192.168.xxx.4   sdw2
    192.168.xxx.5   sdw3
    192.168.xxx.6   sdw4

(5) Modify kernel configuration parameters
Each machine should be configured (if all nodes are configured the same, you can configure the host first and distribute it to each node after configuration)
Execute getconf_ PHYS_ Of pages acquisition system_ PHYS_PAGES
Execute getconf PAGE_SIZE gets the page of the system_ SIZE
vim /etc/sysctl.conf

kernel.shmall = _PHYS_PAGES / 2 ###Modify according to the actual situation
kernel.shmmax = kernel.shmall * PAGE_SIZE ###Modify according to the actual situation
kernel.shmmni = 4096
vm.overcommit_memory = 2 
vm.overcommit_ratio = 95

net.ipv4.ip_local_port_range = 10000 65535
kernel.sem = 500 2048000 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_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.swappiness = 10
vm.zone_reclaim_mode = 0
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100

###For machines with memory larger than 64G, add the following four configurations
vm.dirty_background_ratio = 0 
vm.dirty_ratio = 0
vm.dirty_background_bytes = 1610612736
vm.dirty_bytes = 4294967296
###################################
###For machines with memory less than 64G, add the following two configurations
vm.dirty_background_ratio = 3
vm.dirty_ratio = 10
###################################

After saving the file, execute the following command

awk 'BEGIN {OFMT = "%.0f";} /MemTotal/ {print "vm.min_free_kbytes =", $2 * .03;}' /proc/meminfo >> /etc/sysctl.conf

Execute the order to make it effective

sysctl -p

(6) Configure resource limit parameters
Each should be configured
vim  /etc/security/limits.conf

* soft nofile 524288
* hard nofile 524288
* soft nproc 131072
* hard nproc 131072

(7) Disk I/O settings
Each should be configured
Execute first

fdisk -l

View disk information
For each disk, execute

/sbin/blockdev --setra 16384 /dev/Disk name

Since the above command needs to be re executed every time you restart, you can add the above command to the / etc/rc.d/rc.local file and execute it automatically every time you restart
Give the following permissions after adding

chmod +x /etc/rc.d/rc.local

Execute the following two commands to modify disk IO scheduling settings and disable THP to improve performance

grubby --update-kernel=ALL --args="elevator=deadline"
grubby --update-kernel=ALL --args="transparent_hugepage=never"

After execution, restart the system to take effect
(8)IPC Object Removal
Each should be configured
vim /etc/systemd/logind.conf

RemoveIPC=no

After modification, restart logind to take effect

service systemd-logind restart

(9)SSH connection threshold
Each should be configured
vim /etc/ssh/sshd_config

Max Startups 10:30:200
MaxSessions 200

After modification, restart sshd to take effect

service sshd restart

(10) Synchronous system clock
Each should be configured
On mdw, vim  / etc/ntp.conf file. Set the parameters of the NTP time server that the server points to in the data center. For example, if   10.6.220.20   Is the IP address of your data center NTP server)

On mdw, vim  / etc/ntp.conf

server 10.6.220.20

On smdw, vim  / etc/ntp.conf

server mdw prefer
server 10.6.220.20

On all sdw s, vim  / etc/ntp.conf

server mdw prefer
server smdw

After setting, execute the following command to synchronize NTP (this step is ignored first, and then execute after installing gpssh)

 gpssh -f ./hostlist -v -e 'ntpd'

(11) Create users and user groups
Each should be configured

groupadd gpadmin
useradd gpadmin -r -m -g gpadmin
passwd gpadmin

Input password
Generate ssh key for gpadmin

su gpadmin
ssh-keygen -t rsa -b 4096

All the way back
Grant sudo access to gpadmin users
Execute visudo

%wheel        ALL=(ALL)       NOPASSWD: ALL

Assign gpadmin to this group

usermod -aG wheel gpadmin

(12) Create swap file
First confirm whether the server has a swap file or partition. If it already exists, skip the following steps
The default size is equal to the machine ram size
Each machine should be configured and executed using the root account

#Create a 128G empty file
dd if=/dev/zero  of=/home/swap/swap  bs=1G  count=128
 Modify permissions
chmod 600 /home/swap/swap
#View modification results
ls -lh /home/swap/swap
#Use the mkswap command to format the created file as swap
mkswap /home/swap/swap
 use swapon Command make swap take effect
swapon /home/swap/swap
#Check whether it is effective
swapon -s
#Add the newly added swap to the / etc/fstab file to start it
echo '/home/swap/swap         none                    swap    sw              0 0' >> /etc/fstab
#Verify that the / etc/fstab file is modified correctly
mount -a

2. Install Greenplum

(1) Install gpdb

Each should be configured

Distribute the installation package to the / home path of each server and execute it with root

yum install ./greenplum-db-6.11.1-rhel7-x86_64.rpm

After installation, modify the owner of the installation file

chown -R gpadmin:gpadmin /usr/local/greenplum*

(2) Set password free login

Execute only on mdw

Switch to dbadmin and do the following

su gpadmin

Application environment variable

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

Use SSH copy ID command to distribute gpadmin public key to other servers to realize secret free login

ssh-copy-id smdw
ssh-copy-id sdw1
ssh-copy-id sdw2
ssh-copy-id sdw3
...

(3) Create hostlist and standby on_ seg_ hosts,seg_only

Execute only on mdw

Create directory / home/gpadmin/conf

Create hostlist and standby under this path_ seg_ hosts,seg_only

Fill in the host alias of all nodes in the hostlist

mdw
smdw
sdw1
sdw2
...

standby_ seg_ In hosts, fill in the stand by node and the host aliases of all segments

smdw
sdw1
sdw2
...

seg_only fill in the host aliases of all segments

sdw1
sdw2
...

(4) Use gpssh exkeys to get through all servers

Execute only on mdw

gpssh-exkeys -f hostlist

In this way, we can remotely control the segment machine on the host at the same time through the gpssh command

Note that the previous command to synchronize ntp has not been executed. You can execute it at this time (just execute it on mdw):

 gpssh -f ./hostlist -v -e 'ntpd'

(5) Confirm installation

Log in to the gpadmin account on the mdw machine and execute the command

gpssh -f hostlist -e 'ls -l /usr/local/greenplum-db'

If the above steps are performed correctly, you can log in to each node correctly and see the installed database directory

3. Create a data store

(1) Create a data store on the master machine

The Master does not store user data, only system catalog tables and system metadata

Create with root on mdw

mkdir -p /data/master
chown gpadmin:gpadmin /data/master

(2) Create a data store on the stand by machine

If smdw exists, it is executed using gpadmin user on mdw

source /usr/local/greenplum-db/greenplum_path.sh 
gpssh -h smdw -e 'sudo mkdir -p /data/master'
gpssh -h smdw -e 'sudo chown gpadmin:gpadmin /data/master'

(3) Create a data store on the segment machine

Using gpadmin user on mdw

source /usr/local/greenplum-db/greenplum_path.sh 
gpssh -f /home/gpadmin/conf/seg_only -e 'sudo mkdir -p /data/primary;mkdir -p /data/mirror'
#For the deployment mode of multiple segments on one machine, create the corresponding storage directory according to the number of segments on each machine
gpssh -f /home/gpadmin/conf/seg_only -e 'sudo mkdir -p /data1/primary;mkdir -p /data1/mirror'
gpssh -f /home/gpadmin/conf/seg_only -e 'sudo mkdir -p /data2/primary;mkdir -p /data2/mirror'
#......
gpssh -f /home/gpadmin/conf/seg_only -e 'sudo chown -R gpadmin:gpadmin /data*'

4. Initialize the database

(1) Create initialization profile

Using gpadmin user on mdw

su gpadmin
mkdir /home/gpadmin/gpconfigs
vim /home/gpadmin/gpconfigs/gpinitsystem_config
#Database code
ARRAY_NAME="Greenplum Data Platform"

#segment prefix
SEG_PREFIX=gpseg

#The starting port number of the primary segment
PORT_BASE=40000

#Specify the data directory of the primary segment
declare -a DATA_DIRECTORY=(/data/primary)
#If there are multiple segment s on each machine
#declare -a DATA_DIRECTORY=(/data/primary /data1/primary /data2/primary ...)

#host name of the machine where the master is located
MASTER_HOSTNAME=mdw

#Data directory of master
MASTER_DIRECTORY=/data/master

#Port of master
MASTER_PORT=5432

#Specifies the version of bash
TRUSTED_SHELL=ssh

#The interval between log writing to disk. Each segment file is usually = 16MB < 2 * check_ POINT_ SEGMENTS + 1
CHECK_POINT_SEGMENTS=8

#character set
ENCODING=UNICODE

#The port number from which the mirror segment starts
MIRROR_PORT_BASE=50000

#The data directory of the mirror corresponds to the master data directory
declare -a MIRROR_DATA_DIRECTORY=(/data/mirror)
#If there are multiple segment s on each machine
#declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data1/mirror /data2/mirror ...)

#segment machine list
MACHINE_LIST_FILE=/home/gpadmin/conf/seg_only

(2) Perform installation

Using gpadmin user on mdw

If there is a stand by machine, execute

gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config -h /home/gpadmin/conf/seg_only -s smdw

If there is no stand by machine, execute

gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config -h /home/gpadmin/conf/seg_only

(3) Configure environment variables

Using gpadmin user on mdw

vi ~/.bashrc

Add at the end of the file

source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
#Default login port number
export PGPORT=5432
#Default login user
export PGUSER=gpadmin
#Database used by default login
export PGDATABASE=postgres
#If the server uses RHEL 7 or CentOS 7, you need to add the following configuration
export LD_PRELOAD=/lib64/libz.so.1 ps

Save and source it

source ~/.bashrc

If a stand by machine exists, copy the configuration file to the stand by machine

cd ~
scp .bashrc smdw:`pwd`

(4) Allow client connections

Using gpadmin user on mdw

psql

If the previous configuration is correct, you will log in to the Greenplum database without secret

Change the password of gpadmin

alter role gpadmin with password 'gpadmin';

Exit the database and use the gpadmin user on the mdw machine

vim $MASTER_DATA_DIRECTORY/pg_hba.conf

Add a line at the end

#ADDRESS can be modified into the corresponding ip segment according to the actual situation
#Connection mode connected database connected user connected host IP authentication mode
host     all       gpadmin    all         md5

Execute the command to make the configuration effective

gpstop -u

You can use external client tools or development platform data sources to test whether the configuration is successful.

4, Command Center installation steps

1. Preparation

(1) Modify profile

Using gpadmin user on mdw

Edit the postgresql.conf file

vim $MASTER_DATA_DIRECTORY/postgresql.conf

Add or modify at the end of the file

gp_enable_gpperfmon=on
gpperfmon_port=8888
gp_external_enable_exec=on
gpperfmon_log_alert_level=warning

Edit pg_hba.conf file

vim $MASTER_DATA_DIRECTORY/pg_hba.conf

Add at the end of file

local    gpperfmon         gpmon         md5
host     all               gpmon         127.0.0.1/28    md5

(2) Install the gpperfmon database and create passwords for gpmon users

Using gpadmin user on mdw

gpperfmon_install --enable --password gpmon --port 5432

Restart database

gpstop -r

Check whether gp monitoring is started

ps -ef | grep gpmmon

Check that gp monitoring detects each host in the greenplus cluster

psql -d 'gpperfmon' -c 'select * from system_now;'

(3) Create installation directory

Using gpadmin user on mdw

source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f /home/gpadmin/conf/hostlist 'sudo mkdir -p /usr/local/greenplum-cc-6.3.0;sudo chown -R gpadmin:gpadmin /usr/local/greenplum-cc-6.3.0'
gpssh -f /home/gpadmin/conf/hostlist 'sudo ln -s /usr/local/greenplum-cc-6.3.0 /usr/local/greenplum-cc;sudo chown -R gpadmin:gpadmin /usr/local/greenplum-cc'

2. Install Greenplum CC

Execute with root on mdw

Upload the file to the / home directory, extract it, and modify the owner

unzip /home/greenplum-cc-web-6.3.0-gp6-rhel7-x86_64.zip
mv /home/greenplum-cc-web-6.3.0-gp6-rhel7-x86_64 /home/greenplum-cc
chown -R gpadmin:gpadmin /home/greenplum-cc

Switch to gpadmin and execute the installation command

su gpadmin
/home/greenplum-cc/gpccinstall-6.3.0

The installation path and port will be prompted during installation. If there are no special requirements, it is recommended to use the default settings

After installation, configure the environment variables

vi ~/.bashrc

Add a line at the end

source /usr/local/greenplum-cc/gpcc_path.sh

Save and source it

source ~/.bashrc

Assign the. bashrc file under gpadmin to machines other than master as gpadmin user

gpscp -f /home/gpadmin/conf/standby_seg_hosts ~/.bashrc =:~

Execute the command to start the monitoring service

gpcc start

If a stand by machine exists

Log in to smdw and copy the pgpass file of the host

After installation, you can log in http://mdwIP:28080 After checking and monitoring, the 2 account is gpmon and the password is the preset password in Chapter IV-1 - (2).

 

Keywords: Linux Operation & Maintenance server

Added by sameveritt on Tue, 26 Oct 2021 13:32:34 +0300