greenplum单机安装⽅法安装前准备:
在/f ⽂件中加⼊有关共享内存与⽹络参数配置
vi /f
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 512000 100 2048
kernel.sysrq = 1
<_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni=2048
p_syncookies = 1
net.ipv4.ip_forward = 0
f.default.accept_source_route = 0
p_tw_recycle=1
p_max_syn_backlog=4096
f.all.arp_filter = 1
f.default.arp_filter = 1
net.ipv4.ip_local_port_range=1025 65535
vm.overcommit_memory=2
在/etc/f 中加⼊限制参数
vi /etc/f
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
vi /etc/hosts
127.0.0.1 mdw
127.0.0.1 sdw
127.0.0.1 localhost
192.168.1.204 sggp
例如:
[gpadmin@sgpc146 ~]$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost mdw sdw1
129.100.253.146 sgpc146
vi /etc/hosts
127.0.0.1 localhost loghost
10.1.18.138 mdw-ext1 #eth0 on master node. Use IP sensible for LAN
172.28.0.250 mdw-sp #iDRAC - Shared Management port on master node
172.28.4.250 mdw-cm #eth0 - Shared with management port
172.28.8.250 mdw-1 mdw #eth4 on master node
greenplum数据库172.28.12.250 mdw-2 #eth5 on master node
172.28.0.1 sdw1-sp #iDRAC - Shared Management port on master node
172.28.4.1 sdw1-cm #eth0 - Shared with management port
172.28.8.1 sdw1-1 sdw1 #eth2 on first segment node
172.28.12.1 sdw1-2 #eth3 on first segment node
172.28.0.2 sdw2-sp #iDRAC - Shared Management port on master node
172.28.4.2 sdw2-cm #eth0 - Shared with management port
172.28.8.2 sdw2-1 sdw2 #eth2 on second data node
172.28.12.2 sdw2-2 #eth3 on second segment node
正式安装
[root@sggp tools]# /bin/bash greenplum-db-4.2.1.2-build-2-RHEL5-x86_64.bin
安装⽬录确认,默认是: /usr/local/greenplum-db-4.2.1.2
安装完成(⾄此gp的软件安装完成,下⾯需要进⾏配置及初始化)
配置:
1-创建greenplum组:
# groupadd gpadmin
2-创建greenplum⽤户:
# useradd -g gpadmin gpadmin
# passwd gpadmin
# New password: <gpadmin_password>
# Retype new password: <gpadmin_password>
3-改变greenplum安转⽬录的owner
# chown -R gpadmin /usr/local/greenplum-db
# chgrp -R gpadmin /usr/local/greenplum-db
4-配置环境变量:
将 /usr/local/greenplum-db/greenplum_path.sh中的内容加到/etc/profile⾥,同是追加到greenplum⽤户gpadmin 的.bash_profile⾥.
以gpadmin⽤户⾝份登陆master节点,修改~/.bashrc⽂件,增加⼀⾏:
. /usr//greenplum_path.sh
. /usr/local/greenplum-db-4.2.1.2/greenplum_path.sh
5-创建master和segment主机上的数据存放⽬录:
mkdir /home/gpadmin/masterdata
mkdir /home/gpadmin/segmentdata
创建greenplum_db像征⽬录(查看有没有,如果有不需要执⾏⼀下命令):
ln -s /usr/local/greenplum-db-3.2.3.0 /usr/local/greenplum-db
ln命令⽤来建⽴链接⽂件命令格式:ln [选项] 源⽂件或⽬录 链接名或⽬录
常⽤选项:
-s 建⽴符号链接
-f 强⾏建⽴链接
-i 交互式建⽴链接
例:要为当前⽬录下的file⽂件建⽴⼀个硬链接,名为/home/lbt/doc/file/,可⽤如下命令:
ln file /home/lbt/doc/file
建⽴名为 /home/lbt/doc/file1 的符号链接:ln -s file /home/lbt/doc/file1
# touch indsgzb.dbf
# ln -fs /dev/rora_l
mkdir /data/masterdata
chown gpadmin:gpadmin /data/masterdata
mkdir /data/segmentdata
chown gpadmin:gpadmin /data/segmentdata
6-创建包含所有主机名的⽂件 all_hosts(seg_hosts与包括master与segment的机器名的hosts⽂件放在/home/gpadmin/下⾯) [gpadmin@sgpc146 ~]$ more all_hosts
mdw
sdw
7-含segment 主机名的⽂件 seg_hosts
[gpadmin@sgpc146 ~]$ more seg_hosts
sdw
给greenplum 加管理员 (system user可选项)都是 root 下执⾏的
source /usr/local/greenplum-db/greenplum_path.sh
gpseginstall -f all_hosts -u gpadmin -p sgtest
现在加了 gpadmin, 登⼊到 gpadmin, 加⼀下 $GPHOME(/usr/local/greenplum-db-4.2.1.2)
export GPHOME=/usr/local/greenplum-db-4.2.1.2
source $GPHOME/greenplum_path.sh
gpcheck -f all_hosts -m mdw
还可以验证 Disk I/O 和 Memory Bandwidth
source $GPHOME/greenplum_path.sh
gpcheckperf -f seg_hosts -r ds -D -d segmentdata
初始化系统/启动/测试:
1-复制⼀个配置⽂件模板 (如果gpinitsystem_config_example不存在,则cp gpinitsystem_config gpinitsystem_config_bak备份⼀下) $ cp $GPHOME/docs/cli_help/gpconfigs/gp_init_config_example /home/gpadmin/gpinitsystem_config
[root@sggp gpconfigs]# ll
total 52
-r--r--r-- 1 gpadmin gpadmin 2660 Jun 12 2012 gpinitsystem_config
-r--r--r-- 1 gpadmin gpadmin 4511 Jun 12 2012 gpinitsystem_singlenode
-r--r--r-- 1 gpadmin gpadmin 359 Jun 12 2012 hostfile_exkeys
-r--r--r-- 1 gpadmin gpadmin 96 Jun 12 2012 hostfile_gpcheck
-r--r--r-- 1 gpadmin gpadmin 119 Jun 12 2012 hostfile_gpchecknet_ic1
-r--r--r-- 1 gpadmin gpadmin 119 Jun 12 2012 hostfile_gpchecknet_ic2
-r--r--r-- 1 gpadmin gpadmin 87 Jun 12 2012 hostfile_gpcheckperf
-r--r--r-- 1 gpadmin gpadmin 255 Jun 12 2012 hostfile_gpexpand
-r--r--r-- 1 gpadmin gpadmin 237 Jun 12 2012 hostfile_gpinitsystem
-r--r--r-- 1 gpadmin gpadmin 96 Jun 12 2012 hostfile_gpssh_allhosts
-r--r--r-- 1 gpadmin gpadmin 87 Jun 12 2012 hostfile_gpssh_segonly
-r--r--r-- 1 gpadmin gpadmin 44 Jun 12 2012 hostlist_singlenode
[root@sggp gpconfigs]# pwd
/usr/local/greenplum-db-4.2.1.2/docs/cli_help/gpconfigs
2-修改配置参数 vi /home/gpadmin/gpinitsystem_config
ARRAY_NAME="EMC Greenplum DW"
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/data/segmentdata /data/segmentdata)
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/data/masterdata
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=256
ENCODING=UNICODE
MACHINE_LIST_FILE=/home/gpadmin/seg_hosts
ARRAY_NAME="Greenplum"
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/data/d1 /data/d2 /data/d3 /data/d4 )
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/data/master
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=256
ENCODING=UNICODE
MIRROR_PORT_BASE=50000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
declare -a MIRROR_DATA_DIRECTORY=(/data/m1 /data/m2 /data/m3 /data/m4)
3-把所有主机建⽴信任关系
gpssh-exkeys -f /home/gpadmin/all_hosts
[root@sggp gpadmin]# gpssh-exkeys -f /home/gpadmin/all_hosts
[STEP 1 of 5] create local ID and authorize on local host
... /root/.ssh/id_rsa file exists ... key generation skipped
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] authorize current user on remote hosts
... send to mdw
... send to sdw
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
... finished key exchange with mdw
... finished key exchange with sdw
[INFO] completed successfully
[root@sggp gpadmin]#
4-运⾏配置⽂件初始化greenplum数据库
$gpinitsystem -c /home/gpadmin/gpinitsystem_config
gpinitsystem -c /home/gpadmin/gpinitsystem_config -h seg_hosts
0130219:14:47:15:006465 gpinitsystem:sggp:gpadmin-[INFO]:----------------------------------------
20130219:14:47:15:006465 gpinitsystem:sggp:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
20130219:14:47:15:006465 gpinitsystem:sggp:gpadmin-[INFO]:----------------------------------------
20130219:14:47:15:006465 gpinitsystem:sggp:gpadmin-[INFO]:-sdw /data/segmentdata/gpseg0 40000 2 0 20130219:14:47:16:006465 gpinitsystem:sggp:gpadmin-[INFO]:-sdw /data/segmentdata/gpseg1 40001 3 1 Continue with Greenplum creation Yy/Nn>
y
20130219:14:48:06:006465 gpinitsystem:sggp:gpadmin-[INFO]:-Building the Master instance database, 20130219:14:48:27:006465 gpinitsystem:sggp:gpadmin-[INFO]:-Starting the Master in admin mode
20130219:14:48:48:006465 gpinitsystem:sggp:gpadmin-[INFO]:-Commencing parallel build of primary segment instances
5-将MASTER_DATA_DIRECTORY加⼊环境中,修改gpadmin⽤户的.bash_profile,加⼊
初始化结束后,运⾏gpstat -s查看状态,会失败,它会提⽰你需要设置MASTER_DATA_DIRECTORY环境
MASTER_DATA_DIRECTORY=/data/masterdata/gpseg-1
export MASTER_DATA_DIRECTORY
export MASTER_DATA_DIRECTORY=/data/masterdata/gpseg-1
source ~/.bash_profile
gpstate -s
6-启动服务(以gpadmin的⾝份启动):
gpstart
psql postgres
psql sg
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论