Installation and deployment of GreenPlum database

This article introduces the installation and deployment steps of Greenplum. First, install Greenplum, then configure parameters, and then install the postgis extension.

1, Install and configure GreenPlum

1. Modify the corresponding machine name corresponding to / etc/hosts, which can be viewed through hostname (all nodes) master slave1

2. Create user gpadmin (all nodes)

Passwd gpadmin

3. Modify machine kernel parameters

(the master node is distributed to other nodes) (Note: the same configuration is first configured on the master node, and then copied to other nodes)
Modify the / etc/sysctl.conf file and add the following:

    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
    Execute the command to validate the parameter:
    sysctl –p

4. Modify file opening limit (all nodes)

Modify the / etc/security/limits.conf file and add the following:

* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

5. Install on the greenplus master node

Two versions can be downloaded from the official website, a binary version and an rpm version


Start installation execution


Our installation path is / home / gpadmin / greenplus / greenplus-5.16.0

ll /home/gpadmin/greenplum/

Successfully installed on the master node

6. Start installing other nodes

On the master node

Cd   /home/gpadmin/greenplum/
Mkdir conf

Create a new file hostlist and add the following:


Also create a new seg_hosts file and add the following:
Execute command

Su gpadminsource /home/gpadmin/greenplum/greenplum-db/
gpssh-exkeys -f /home/gpadmin/greenplum/conf/hostlist

The test shown in the figure represents success.

7. Distribute the installation package to the gpadmin user of other nodes for execution

tar -cf gp.5.16.0.tar greenplum-5.16.0/  pack
gpscp -f /home/gpadmin/greenplum//conf/seg_hosts gp.5.16.0.tar =:/home/gpadmin/greenplum/

Enter the / home / gpadmin / greenplus / conf directory and execute the command

gpssh -f seg_hosts
cd /home/gpadmin/greenplum
tar –xf gp.5.16.0.tar
ln -s ./greenplum-db-5.16.0 greenplum-db

8. Initialize the database

/Create in the directory home / gpadmin / greenplus /

mkdir /data

Modify permissions

chown gpadmin.gpadmin /data

Enter the / home / gpadmin / greenplus / conf directory

gpssh -f hostlist
cd /home/gpadmin/greenplum/data
mkdir –p /home/gpadmin/greenplum/data/master
mkdir –p /home/gpadmin/greenplum/data/primary
mkdir –p /home/gpadmin/greenplum/data/mirror

Configure environment variables in the master node
vi /home/gpadmin/.bashrc
Add at the end

9. Modify initialization configuration file

Initialize the Greenplum configuration file template in / usr / local / Greenplum dB / docs / cli_ Under the help / gpconfigs directory, gpinitsystem_config is the template for initializing Greenplum. The configuration of Mirror Segment in this template is annotated; Create a copy and modify its following configuration:

cd /home/gpadmin/greenplum/greenplum-db/docs/cli_help/gpconfigs
cp gpinitsystem_config initgp_config
vi initgp_config  

The modified content is that 4-8 data nodes are recommended, and 4 are installed in the system

declare -a DATA_DIRECTORY=(/home/gpadmin/greenplum/data/primary  /home/gpadmin/greenplum/data/primary /home/gpadmin/greenplum/data/primary /home/gpadmin/greenplum/data/primary )
MASTER_HOSTNAME=master                  #Master node name MASTER_DIRECTORY=/home/gpadmin/greenplum/data/master                 MASTER_DATA_DIRECTORY=/home/gpadmin/greenplum/data/gpseg-1   DATABASE_NAME=gp_sydb            #Consistent with the configured initialization database name
MACHINE_LIST_FILE=(/home/gpadmin/greenplum /conf/seg_hosts 

Perform initialization

gpinitsystem -c initgp_config –S

If the initialization is successful, the installation is successful

2, Install the postgis plug-in and download the gpkg file from the official website

1. Perform the same as the installation steps.

2. Modify the configuration file

Vi hosts_expand

3. Create myexpand database

4. Execute orders

gpexpand -D myexpand

5. Check whether the test is successful:

select a.dbid,a.content,a.role,a.port,a.hostname,b.fsname,c.fselocation from gp_segment_configuration a ,pg_filespace b,pg_filespace_entry c where a.dbid=c.fsedbid and b.oid=c.fsefsoid order by content;

3, Start and log in to the database

su gpadmin
gpstop -M fast
gpstart -a
psql -h -p 5432  -d yourDB -U gpadmin --Enter the password according to the prompt, and the login is successful

4, Common commands for GreenPlum operation

\c --Connect and switch databases(The database name is only lowercase, but postgres Is case sensitive)
\dt --List all tables
\l --List all databases
SELECT block_id,block_name FROM t_aoi_110000 CROSS JOIN ST_MakeEnvelope(116.343242,39.868524,116.362350,39.872238,4326) As geom_src 
 WHERE ST_Intersects(geom,geom_src);

Scan the code to join my knowledge Planet: "spatio-temporal big data", you can obtain more and higher quality knowledge and documents in maps, geographic information, GIS, big data, spatio-temporal analysis, real 3D, map visualization, etc. the top 20 can enjoy a 50% discount coupon.

Tags: Database PostgreSQL

Posted on Tue, 09 Nov 2021 16:05:46 -0500 by rayzun