In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Prepare the environment 1.1 cluster introduction
System environment: centos6.5
Database version: greenplum-db-4.3.3.1-build-1-RHEL5-x86_64.zip
In the greenplum cluster, the IP of the four machines is
[root@dw-greenplum-1 ~] # cat / etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.96.101 dw-greenplum-1 mdw
192.168.96.102 dw-greenplum-2 sdw1
192.168.96.103 dw-greenplum-3 sdw2
192.168.96.104 dw-greenplum-4 sdw3
Each / etc/hosts should be added as above.
1. Architecture diagram:
1.2 create users and user groups (per machine)
[root@dw-greenplum-1] # groupadd-g 530 gpadmin
[root@dw-greenplum-1] # useradd-g 530-u530-m-d / home/gpadmin-s / bin/bash gpadmin
[root@dw-greenplum-1 ~] # passwd gpadmin
Changing password for user gpadmin.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
Passwd: all authentication tokens updated successfully.
1.3 modify the system kernel (per machine)
Make sure you modify it or you will make mistakes.
[root@dw-greenplum-1 ~] # vi / etc/sysctl.conf
Kernel.shmmax = 500000000
Kernel.shmmni = 4096
Kernel.shmall = 4000000000
Kernel.sem = 250 512000 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
Modify parameters according to your own server
Let the parameter take effect
[root@dw-greenplum-1~] # sysctl-p
1.4 modify restrictions such as the number of file openings (per machine)
Make sure you modify it or you will make mistakes.
[root@dw-greenplum-1 ~] # vi / etc/security/limits.conf
# End of file
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
2.greenplum installation
Create an installation directory for the greenplum software and assign gpadmin user rights (per operation)
[root@dw-greenplum-1 ~] # mkdir / opt/greenplum
[root@dw-greenplum-1] # chown-R gpadmin:gpadmin / opt/greenplum
First prepare the installation file (operate on MASTER 192.168.96.101)
Greenplum-db-4.3.3.1-build-1-RHEL5-x86_64.zip
Execute the unzip command to extract the installation file:
[root@dw-greenplum-1 ~] # unzip greenplum-db-4.3.3.1-build-1-RHEL5-x86_64.zip
Execute to start installing the software:
[root@dw-greenplum-1 ~] # chmod + x greenplum-db-4.3.3.1-build-1-RHEL5-x86_64.bin
[root@dw-greenplum-1 ~] #. / greenplum-db-4.3.3.1-build-1-RHEL5-x86_64.bin
Information about installing License for greenplum
Whether to accept License or not
Select installation directory
After installing the above steps, how to install the software begins, and finally shows that the software installation is successful.
Configure system environment variables (master,master standy two configurations)
[root@dw-greenplum-1 ~] # su-gpadmin
[gpadmin@dw-greenplum-1 ~] $vi .bash _ profile
Source / opt/greenplum/greenplum-db/greenplum_path.sh
Export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/gpmaster/gpseg-1
Export PGPORT=5432
Export PGDATABASE=trjDB
Let the above configuration take effect
[gpadmin@dw-greenplum-1 ~] $source .bash _ profile
Configure hostlist
Configuration file, in which all server names are recorded
[gpadmin@dw-greenplum-1 ~] $mkdir conf
[gpadmin@dw-greenplum-1 ~] $cd conf/
[gpadmin@dw-greenplum-1 conf] $vi hostlist
Mdw
Sdw1
Sdw2
Sdw3
[gpadmin@dw-greenplum-1 conf] $vi seg_hosts
Sdw1
Sdw2
Sdw3
[gpadmin@dw-greenplum-1 conf] $gpssh-exkeys-f hostlist
[STEP 1 of 5] create local ID and authorize on local host
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] authorize current user on remote hosts
... Send to sdw1
***
* Enter password for sdw1:
... Send to sdw2
... Send to sdw3
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
... Finished key exchange with sdw1
... Finished key exchange with sdw2
... Finished key exchange with sdw3
[INFO] completed successfully
After opening all the machine channels, we can use the gpssh command to perform batch operations on all machines
[gpadmin@dw-greenplum-1 conf] $gpssh-f hostlist
Note: command history unsupported on this machine...
= > pwd
[sdw3] / home/gpadmin
[sdw1] / home/gpadmin
[sdw2] / home/gpadmin
[mdw] / home/gpadmin
= >
Distribute the software to each machine
Next, package the installed files.
[gpadmin@dw-greenplum-1 conf] $cd / opt/greenplum/
[gpadmin@dw-greenplum-1 greenplum] $tar-cf gp.4.3.3.1.tar greenplum-db-4.3.3.1/
Then use the gpscp command to copy this file to each machine:
[gpadmin@dw-greenplum-1 greenplum] $gpscp-f / home/gpadmin/conf/hostlist gp.4.3.3.1.tar =: / opt/greenplum/
Use the gpssh command to extract the package in batches:
[gpadmin@dw-greenplum-1 greenplum] $cd / home/gpadmin/conf/
[gpadmin@dw-greenplum-1 conf] $gpssh-f hostlist
= > cd / opt/greenplum
[sdw3]
[sdw1]
[sdw2]
[mdw]
= > tar-xf gp.4.3.3.1.tar
[sdw3]
[sdw1]
[sdw2]
[mdw]
Establish a software connection
= > ln-s greenplum-db-4.3.3.1 greenplum-db
[sdw3]
[sdw1]
[sdw2]
[mdw]
= > ll
[sdw3] total 397060
[sdw3]-rw-rw-r-- 1 gpadmin gpadmin 406579200 Apr 22 23:32 gp.4.3.3.1.tar
[sdw3] lrwxrwxrwx 1 gpadmin gpadmin 20 Apr 22 23:53 greenplum-db- > greenplum-db-4.3.3.1
[sdw3] drwxr-xr-x 11 gpadmin gpadmin 4096 Apr 22 23:00 greenplum-db-4.3.3.1
[sdw1] total 397056
[sdw1]-rw-rw-r-- 1 gpadmin gpadmin 406579200 Apr 22 23:32 gp.4.3.3.1.tar
[sdw1] lrwxrwxrwx 1 gpadmin gpadmin 20 Apr 22 23:53 greenplum-db- > greenplum-db-4.3.3.1
[sdw1] drwxr-xr-x 11 gpadmin gpadmin 4096 Apr 22 23:00 greenplum-db-4.3.3.1
[sdw2] total 397060
[sdw2]-rw-rw-r-- 1 gpadmin gpadmin 406579200 Apr 22 23:32 gp.4.3.3.1.tar
[sdw2] lrwxrwxrwx 1 gpadmin gpadmin 20 Apr 22 23:53 greenplum-db- > greenplum-db-4.3.3.1
[sdw2] drwxr-xr-x 11 gpadmin gpadmin 4096 Apr 22 23:00 greenplum-db-4.3.3.1
[mdw] total 397056
[mdw]-rw-rw-r-- 1 gpadmin gpadmin 406579200 Apr 22 23:31 gp.4.3.3.1.tar
[mdw] lrwxrwxrwx 1 gpadmin gpadmin 22 Apr 22 23:00 greenplum-db
Let's create the database data directory
MASTER directory:
= > mkdir-p / home/gpadmin/gpdata/gpmaster
Primary node directory:
= > mkdir-p / home/gpadmin/gpdata/gpdatap1
= > mkdir-p / home/gpadmin/gpdata/gpdatap2
Mirror node directory:
= > mkdir-p / home/gpadmin/gpdata/gpdatam1
= > mkdir-p / home/gpadmin/gpdata/gpdatam2
Let the other node environment take effect
[root@dw-greenplum-2 greenplum] # su-gpadmin
[gpadmin@dw-greenplum-2 ~] $source .bash _ profile
Initialize the configuration file for greenplum
[gpadmin@dw-greenplum-1 conf] $cd $GPHOME/docs/cli_help/gpconfigs
[gpadmin@dw-greenplum-1 gpconfigs] $cp gpinitsystem_config / home/gpadmin/conf/
[gpadmin@dw-greenplum-1 gpconfigs] $cd / home/gpadmin/conf/
[gpadmin@dw-greenplum-1 conf] $chmod Ubunw gpinitsystem_config
ARRAY_NAME= "Greenplum"
SEG_PREFIX=gpseg
PORT_BASE=33000
Declare-a DATA_DIRECTORY= (/ home/gpadmin/gpdata/gpdatap1 / home/gpadmin/gpdata/gpdatap2)
DATABASE_NAME=trjDB
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/home/gpadmin/gpdata/gpmaster
MASTER_PORT=5432
TRUSTED_SHELL=/usr/bin/ssh
MIRROR_PORT_BASE=43000
REPLICATION_PORT_BASE=34000
MIRROR_REPLICATION_PORT_BASE=44000
Declare-a MIRROR_DATA_DIRECTORY= (/ home/gpadmin/gpdata/gpdatam1 / home/gpadmin/gpdata/gpdatam2)
MACHINE_LIST_FILE=/home/gpadmin/conf/seg_hosts
Initialize the database
Initialize the database using the gpinitsystem script with the following command:
[gpadmin@dw-greenplum-1 conf] $gpinitsystem-c gpinitsystem_config-h seg_hosts-s sdw3
See the figure above shows that the initialization is successful, try to log in to greenplum's default database postgres
[gpadmin@dw-greenplum-1 conf] $psql-d postgres
Psql (8.2.15)
Type "help" for help.
Postgres=#\ l
List of databases
Name | Owner | Encoding | Access privileges
-+-
Postgres | gpadmin | UTF8 |
Template0 | gpadmin | UTF8 | = c/gpadmin
: gpadmin=CTc/gpadmin
Template1 | gpadmin | UTF8 | = c/gpadmin
: gpadmin=CTc/gpadmin
TrjDB | gpadmin | UTF8 |
(4 rows)
Postgres=#
3. Fault handling
3.1 activate standby
[gpadmin@dw-greenplum-4 conf] $gpactivatestandby
3.2Restoration of all failed segment
[gpadmin@dw-greenplum-4 gpseg-1] $gprecoverseg
Restore all segment roles
[gpadmin@dw-greenplum-4 gpseg-1] $gprecoverseg-r
If you want to create a new standby, but you already have a standby, delete it first.
Gpinitstandby-r
3.4 change the original master into standby
[gpadmin@dw-greenplum-1 gpmaster] $mv gpseg-1 gpseg-1.bak
In the new main operation, the following command:
[gpadmin@dw-greenplum-4] $gpinitstandby-F pg_system:/home/gpadmin/gpdata/gpmaster/gpseg-1-s mdw
Start standby
[gpadmin@dw-greenplum-4] $gpinitstandby-n
20160424 gpinitstandby:dw-greenplum-4:gpadmin- 0614 Standy master is already up and running 1719 Standy master is already up and running 003594.
View cluster status
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
Select * from gp_segment_configuration where content='-1'
To view the standby latency, just view the pg_stat_replication view.
Select pg_switch_xlog ()
Select * from pg_stat_replication
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.