Greenplum安装手册

2022-04-08 00:00:00 创建 修改 文件 安装 主机
主机名ip
gp_master1192.168.123.101
gp_Seg1192.168.123.102
gp_Seg2192.168.123.103


一、准备工作

1.    检查openss-clients

        rpm -qa|grep openss-clients

        若没有,则安装

        yum install openssh-clients -y

2.    修改所有主机hosts

        vi /etc/hosts

        将表格中的主机添加进去

3.    所有主机创建用户

        groupadd -g 530 gpadmin

        useradd -g 530 -u530 -m -d /home/gpadmin -s /bin/bash gpadmin

        passwd gpadmin

4.    修改所有主机系统内核

        vi /etc/sysctl.conf

        修改项:

        kernel.sysrq = 1

         kernel.shmmax = 500000000

         kernel.shmall = 4000000000 

        新增项:

        kernel.shmmni = 4096

        kernel.sem = 250 512000 100 2048

        kernel.msgmni = 2048

        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

        修改立即生效:

        sysctl -p

5.    修改所有主机文件打开限制

        在末尾新增:

        *                soft    nofile          65536

        *                hard    nofile          65536

        *                soft    nproc           131072

        *                hard    nproc           131072

6.    创建所有主机文件夹并赋权

        mkdir /usr/local/greenplum

        chown -R gpadmin.gpadmin  /usr/local/greenplum/

        chown -R gpadmin.gpadmin /gpdata


二、开始安装

1.    上传Greenplum RPM文件到master主机

2.    安装Greenplum RPM文件

        不指定安装路径的情况下,会默认创建在/usr/local/目录下,为方便后续安装,指定安装路径

        rpm -ivh --prefix=/usr/local/greenplum/  /tmp/greenplum-db-5.8.0-rhel6-x86_64.rpm

3.    所有主机切换gpadmin用户

        su gpadmin

4.    在master主机上创建hosts文件

        mkdir /home/gpadmin/gpconf

        cd /home/gpadmin/gpconf

        vi all_hosts    #所有主机hostname

        vi seg_hosts  #所有segment主机hostname

        vi other_hosts#除master主机外所有主机hostname

5.    在master主机上设置所有主机访问信息

        source /usr/local/greenplum/greenplum-db/greenplum_path.sh

        gpssh-exkeys -f /home/gpadmin/gpconf/all_hosts(需要输入gpadmin密码)

6.    在master主机上为所有主机创建文件夹

        gpssh -f /home/gpadmin/gpconf/all_hosts

        =>cd /gpdata

        =>mkdir master mirror1 mirror2 primary1 primary2

         =>exit

7.    在master主机上为其他所有主机安装

        cd /home/gpadmin/gpconf

        gpseginstall -f other_hosts -u gpadmin -p 密码 #other_hosts 根据实际情况选择,若没有standby主机,则选用seg_hosts

8.    修改所有主机gpadmin配置

        vi ~/.bashrc

        末尾新增:

        source /usr/local/greenplum/greenplum-db/greenplum_path.sh

        export MASTER_DATA_DIRECTORY=/data/master/gpseg-1

        export PGPORT=5432

        export PGDATABASE=greenplum-db

        立即生效:

        source ~/.bashrc

9.    在master主机上修改Greenplum配置文件

        cp /usr/local/greenplum/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconf/

        chown gpadmin.gpadmin  /home/gpadmin/gpconf/gpinitsystem_config

        vi /home/gpadmin/gpconf/gpinitsystem_config

        修改项:

        PORT_BASE=33000

        declare -a DATA_DIRECTORY=(/data/primary1 /data/primary2)

        MASTER_HOSTNAME=GP-MASTER

        MASTER_DIRECTORY=/data/master

        TRUSTED_SHELL=/usr/bin/ssh

        MIRROR_PORT_BASE=43000

        MIRROR_REPLICATION_PORT_BASE=44000

        declare -a MIRROR_DATA_DIRECTORY=(/data/mirror1 /data/mirror2)

        MACHINE_LIST_FILE=/home/gpadmin/gpconf/seg_hosts

10.    在master主机上执行Greenplum初始化

        若不启用standby主机:

        gpinitsystem -c /home/gpadmin/gpconf/gpinitsystem_config

        若启用standby主机

        gpinitsystem -c /home/gpadmin/gpconf/gpinitsystem_config -s standby_hostname


三、检查安装结果

1.    执行命令psql -d postgres

        查看结果如下,说明Greenplum安装成功

        

来源 https://www.modb.pro/db/24832

相关文章