GreenPlum 4.3 SUSE集群安装手册
1.0 建立数据存储区域
以下操作在moster主机上操作。(数据库的创建目录为/opt/greenplum)
操作步骤
步骤 1 在master主机上以root用户登录数据库服务器。
步骤 1 执行如下命令:
linux-82:/opt # mkdir -p greenplum/master
步骤 2 修改创建文件夹的权限,如下:
linux-82:/opt # chown -R gpadmin:gpadmin greenplum
步骤 3 运用gpssh在segment主机上创建文件夹及修改文件夹的权限,如下:
# source /usr/local/greenplum-db/greenplum_path.sh
# gpssh -h linux113 -e 'mkdir -p /opt/greenplum/master'
执行后的信息如下:
[linux113] mkdir -p /opt/greenplum/master
# gpssh -h linux113 -e 'chown -R gpadmin:gpadmin /opt/greenplum'
[linux113] chown -R gpadmin:gpadmin /opt/greenplum
步骤 4 配置segment主机的数据目录信息,先在master主机上建立配置文件hostfile_gpssh_segonly,如下:
linux-82:/usr/local # vi hostfile_gpssh_segonly
然后执行如下命令:
# source /usr/local/greenplum-db/greenplum_path.sh
linux-82:/usr/local # gpssh -f hostfile_gpssh_segonly -e 'mkdir -p /opt/greenplum/primary'
执行后的信息如下:
[linux113] mkdir -p /opt/greenplum/primary
linux-82:/usr/local # gpssh -f hostfile_gpssh_segonly -e 'mkdir -p /opt/greenplum/mirror'
执行后的信息如下:
[linux113] mkdir -p /opt/greenplum/mirror
linux-82:/usr/local # gpssh -f hostfile_gpssh_segonly -e 'chown -R gpadmin:gpadmin /opt/greenplum/primary'
执行后的信息如下:
[linux113] chown -R gpadmin:gpadmin /opt/greenplum/primary
linux-82:/usr/local # gpssh -f hostfile_gpssh_segonly -e 'chown -R gpadmin:gpadmin /opt/greenplum/mirror'
执行后的信息如下:
[linux113] chown -R gpadmin:gpadmin /opt/greenplum/mirro
2.0 同步系统时钟
操作步骤
步骤 1 在master主机上以root用户登录数据库服务器;
步骤 2 执行如下命令来修改master中ntp的server配置:
# vi /etc/ntp.conf 修改
server masterip 如:server 10.41.28.82
步骤 3 再在每台segment主机上以root用户登录执行下面的操作:
# vi /etc/ntp.conf 修改
server masterip prefer 如:server 10.41.28.82 prefer
server standby masterip
步骤 4 在master主机上以root用户新建配置文件hostfile_gpssh_allhosts,如下:
# cd /usr/local/greenplum-db
# vi hostfile_gpssh_allhosts 添加
Linux-82
Linux113
步骤 5 在master主机上执行gpssh命令,如下:
# source /usr/local/greenplum-db/greenplum_path.sh
# gpssh -f hostfile_gpssh_allhosts -v -e 'ntpd'
执行后的信息如下:
[Reset ...]
[INFO] login linux-82
[INFO] login linux113
[linux-82] ntpd
[linux113] ntpd
[INFO] completed successfully
[Cleanup...]
注:需要等几分钟,时钟才会自动同步。
3.0 系统检查
操作步骤
步骤 1 在master主机上以root用户登录数据库服务器;
步骤 2 在conf文件夹下新建配置文件hostfile_gpcheck,如下:
# cd /usr/local/greenplum-db/conf
# vi hostfile_gpcheck 添加
Linux-82
Linux113
步骤 3 在master主机上执行gpcheck命令,如下:
# source /usr/local/greenplum-db/greenplum_path.sh
# gpcheck -f hostfile_gpcheck -m linux-82 -s linux113
执行后的信息如下:
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-dedupe hostnames
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-Detected platform: Generic Linux Cluster
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-generate data on servers
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-copy data files from servers
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-delete remote tmp files
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-Using gpcheck config file: /usr/local/greenplum-db/etc/gpcheck.cnf
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-GPCHECK_NORMAL
20140415:11:15:47:013028 gpcheck:linux-82:root-[INFO]:-gpcheck completing...
4.0 配置字符集
操作步骤
步骤 1 在每台主机上分别以gpadmin用户登录数据库服务器;
步骤 2 编辑.bashrc配置文件,添加如下:
export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
步骤 3 source .bashrc 后,用命令locale查看字符集设置情况,如下:
LANG=en_US.utf-8
LC_CTYPE="en_US.utf-8"
LC_NUMERIC="en_US.utf-8"
LC_TIME="en_US.utf-8"
LC_COLLATE="en_US.utf-8"
LC_MONETARY="en_US.utf-8"
LC_MESSAGES="en_US.utf-8"
LC_PAPER="en_US.utf-8"
LC_NAME="en_US.utf-8"
LC_ADDRESS="en_US.utf-8"
LC_TELEPHONE="en_US.utf-8"
LC_MEASUREMENT="en_US.utf-8"
LC_IDENTIFICATION="en_US.utf-8"
LC_ALL=en_US.utf-8
5.0 初始化数据库
9.0.1 创建初始化主机文件
操作步骤
步骤 1 在master主机上gpadmin用户登录数据库服务器;
步骤 2 创建文件夹,并编辑hostfile_gpinitsystem配置文件,如下:
gpadmin@linux-82:~> mkdir gpconfigs
gpadmin@linux-82:~> cd gpconfigs/
gpadmin@linux-82:~/gpconfigs> vi hostfile_gpinitsystem
添加各segment hostname,如:linux113
9.0.2 创建数据库配置文件
操作步骤
步骤 1 在master主机上gpadmin用户登录数据库服务器;
su - gpadmin
步骤 2 备份gpinitsystem_config配置文件,如下:
gpadmin@linux-82:~> source /usr/local/greenplum-db/greenplum_path.sh
gpadmin@linux-82:~> cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config
步骤 3 打开备份的gpinitsystem_config配置文件进行编辑,如下:
(需修改部分已红色字体标记)
# FILE NAME: gpinitsystem_config
# Configuration file needed by the gpinitsystem
################################################
#### REQUIRED PARAMETERS
################################################
#### Name of this Greenplum system enclosed in quotes.
ARRAY_NAME="EMC Greenplum DW"
#### Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg
#### Base number by which primary segment port numbers
#### are calculated.
PORT_BASE=40000
#### File system location(s) where primary segment data directories
#### will be created. The number of locations in the list dictate
#### the number of primary segments that will get created per
#### physical host (if multiple addresses for a host are listed in
#### the hostfile, the number of segments will be spread evenly across
#### the specified interface addresses).
declare -a DATA_DIRECTORY=(/opt/greenplum/primary /opt/greenplum/primary)
#### OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=linux-82
#### File system location where the master data directory
#### will be created.
MASTER_DIRECTORY=/opt/greenplum/master
#### Port number for the master instance.
MASTER_PORT=5432
#### Shell utility used to connect to remote hosts.
TRUSTED_SHELL=ssh
#### Maximum log file segments between automatic WAL checkpoints.
CHECK_POINT_SEGMENTS=8
#### Default server-side character set encoding.
ENCODING=UNICODE
################################################
#### OPTIONAL MIRROR PARAMETERS
################################################
#### Base number by which mirror segment port numbers
#### are calculated.
MIRROR_PORT_BASE=50000
#### Base number by which primary file replication port
#### numbers are calculated.
REPLICATION_PORT_BASE=41000
#### Base number by which mirror file replication port
#### numbers are calculated.
MIRROR_REPLICATION_PORT_BASE=51000
#### File system location(s) where mirror segment data directories
#### will be created. The number of mirror locations must equal the
#### number of primary locations as specified in the
#### DATA_DIRECTORY parameter.
declare -a MIRROR_DATA_DIRECTORY=(/opt/greenplum/mirror /opt/greenplum/mirror)
################################################
#### OTHER OPTIONAL PARAMETERS
################################################
#### Create a database of this name after initialization.
#DATABASE_NAME=name_of_database
#### Specify the location of the host address file here instead of
#### with the the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem