Greenplum单机安装
本文gpdb版本:greenplum-db-4.3.6.2
创建gpadmin用户
- snippet.bash
[root@yz_dev /]# groupadd -g 8000 gpadmin [root@yz_dev /]# useradd -m -d /home/gpadmin -g gpadmin -u 8000 gpadmin [root@yz_dev /]# passwd gpadmin
准备路径
- snippet.bash
[root@yz_dev /]# mkdir -p /opt/gp/greenplum # install path [root@yz_dev /]# mkdir -p /opt/gp/gpmaster [root@yz_dev /]# mkdir -p /opt/gp/gpdata [root@yz_dev /]# chown -R gpadmin:gpadmin /opt/gp
安装
- snippet.bash
[gpadmin@yz_dev ~]$ ./greenplum-db-4.3.6.2-build-1-RHEL5-x86_64.bin # 在询问安装路径时,输入安装路径:/opt/gp/greenplum
设置环境变量
- snippet.bash
[gpadmin@yz_dev ~]$ vi .bash_profile # 增加: . /opt/gp/greenplum/greenplum_path.sh # 执行完此操作请重新登录以便使环境变量生效
创建节点列表文件~/hostlist_singlenode
hostname为localhost.localdomain会报warning。因此设置新的hostname,永久保存需要修改/etc/sysconfig/network。
- snippet.bash
[root@yz_dev /]# hostname dev1_230 [gpadmin@yz_dev ~]$ hostname yz_dev [gpadmin@yz_dev ~]$ hostname > hostlist_singlenode [root@dev1_230 /]# vi /etc/hosts # 如果没有DNS 192.168.3.144 yz_dev
执行gpssh-exkeys
- snippet.bash
[gpadmin@yz_dev ~]$ gpssh-exkeys -h 127.0.0.1 [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 127.0.0.1 [STEP 4 of 5] determine common authentication file content [STEP 5 of 5] copy authentication files to all remote hosts ... finished key exchange with 127.0.0.1 [INFO] completed successfully
编辑配置文件
- snippet.bash
[gpadmin@yz_dev ~]$ cp /opt/gp/greenplum/docs/cli_help/gpconfigs/gpinitsystem_singlenode ~ [gpadmin@yz_dev ~]$ chmod +w gpinitsystem_singlenode [gpadmin@yz_dev ~]$ vi gpinitsystem_singlenode
# 192.168.3.144有4核CPU,因此创建4个segment instance
# gpinitsystem需要添加参数"-m 25",即master的maxconnections=25,segment的maxconnections=75。默认值为master的maxconnections=250,segment的maxconnections=750,这时在192.168.3.144上最多只能创建两个segment,否则报错,提示超过系统semaphore个数限制。
创建数据库实例
- snippet.bash
[gpadmin@yz_dev ~]$ gpinitsystem -m 25 -c gpinitsystem_singlenode
导出MASTER_DATA_DIRECTORY
- snippet.bash
[gpadmin@yz_dev ~]$ vi .bash_profile # 增加: export MASTER_DATA_DIRECTORY=/opt/gp/gpmaster/gpsne-1
客户端授权
- snippet.bash
[gpadmin@yz_dev ~]$ vi /opt/gp/gpmaster/gpsne-1/pg_hba.conf # 增加: host all gpadmin 192.168.0.0/16 trust
测试服务状态
- snippet.bash
[gpadmin@yz_dev ~]$ gpstate
测试连接
- snippet.bash
[gpadmin@yz_dev ~]$ psql -d template1 -h yz_dev -p 5432 -U gpadmin [gpadmin@yz_dev ~]$ psql template1
创建并设置.psqlrc文件
- snippet.bash
[gpadmin@yz_dev ~]$ touch .psqlr [gpadmin@yz_dev ~]$ vi .psqlr
内容:
- snippet.sql
\timing \pset NULL 'NULL' \encoding unicode
打赏作者以资鼓励: