本文参考https://blog.csdn.net/qq_32323239/article/details/101689486修改为单机版安装,用于测试使用
1、安装包下载
https://network.pivotal.io/products/pivotal-gpdb/#/releases/449820/file_groups/2047
2、将安装包上传到服务器
3、使用yum进行安装
yum -y install greenplum-db-6.0.0-rhel7-x86_64.rpm
4、配置tcp参数。修改/etc/sysctl.conf,修改完成后执行sysctl -p让配置生效
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10240 65535
vm.swappiness=0
net.ipv4.tcp_sack=1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_congestion_control=cubic
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_tw_recycle=0
net.ipv4.tcp_max_syn_backlog=65535
net.core.somaxconn=65535
net.core.rmem_max=16777216
net.core.wmem_max=16777216
vm.overcommit_memory=1
fs.file-max = 2097152
fs.nr_open = 2097152
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_mem = 786432 2097152 3145728
net.core.optmem_max=4194304
net.ipv4.tcp_max_tw_buckets = 1048576
net.ipv4.tcp_fin_timeout = 30
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.eth0.rp_filter = 0
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.default.arp_filter = 1
vm.max_map_count = 1048575
kernel.shmmni = 4096
kernel.sem= 250 512000 100 2048
kernel.sysrq = 1
kernel.msgmni = 2048
kernel.pid_max=4096000
5、修改/etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
6、创建gpadmin用户
useradd gpadmin
passwd gpadmin
7、修改安装目录的权限
[root@node1 ~]chown -R gpadmin.gpadmin /usr/local/greenplum-db*
[root@node1 ~]chown gpadmin.gpadmin /usr/local
8、创建数据目录并给gpadmin赋权限
[root@node1 ~]mkdir -p /data/{primary,mirror,master}
[root@node1 ~]chown -R gpadmin.gpadmin /data/{primary,mirror,master}
9、切换到gpadmin用户下,并在用户目录中执行以下操作:添加本机hostname
[gpadmin@node1 ~]$ vi list
node1
10、添加环境变量
[gpadmin@node1 ~]$ cat /usr/local/greenplum-db/greenplum_path.sh >>~/.bashrc
[gpadmin@node1 ~]$ cat >> ~/.bashrc <
11、从模板中拷贝一份gpinitsystem_config文件
[gpadmin@node1 ~]$ cp /usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpinitsystem_config
[gpadmin@node1 ~]$ chmod 775 /home/gpadmin/gpinitsystem_config
[gpadmin@node1 ~]$ vi /home/gpadmin/gpinitsystem_config #对配置进行修改
## 数据文件的位置
declare -a DATA_DIRECTORY=(/data/primary)
MASTER_HOSTNAME=node1
MASTER_DIRECTORY=/data/master
MIRROR_PORT_BASE=7000
declare -a MIRROR_DATA_DIRECTORY=(/data/mirror)
12、初始化数据库:
[gpadmin@node1 ~]$ gpinitsystem -a -c gpinitsystem_config -h list
13、初始化完了之后,使用psql登录验证:
[gpadmin@node1 ~]$ psql -d postgres # 当成功进入数据库后表示安装成功
14、开启远程访问
[gpadmin@node1 ~]$ vi /data/master/gpseg-1/pg_hba.conf
#允许任意用户从任意机器上以密码方式访问数据库,把下行添加为第一条规则:
host all all 0.0.0.0/0 md5
15、重启gp使配置生效
[gpadmin@node1 ~]$ gpstop
[gpadmin@node1 ~]$ gpstart
16、greenplum安装完成后使用psql命令进入控制台(默认无需密码)
使用\password命令,为gpadmin用户设置一个密码
alter role gpadmin password 'gpadmin'
17、可以使用pgadmin对数据库进行访问
下载地址:https://www.postgresql.org/download/