centos7.3下 greenplum-db 安裝、配置文件

cc_coder發表於2018-01-26

centos7.3下 greenplum-db 安裝、配置文件

一.系統要求

  • 1.系統版本要求:
    根據官方文件: greenplumd-b支援以下幾種linux系統:
    SUSE Linux Enterprise Server 64-bit 12 SP2 or SP3, with kernel 4.4.73-5.1 or newer
    SUSE Linux Enterprise Server 64-bit 11 SP4

    CentOS 64-bit 6.x or 7.x

    Red Hat Enterprise Linux (RHEL) 64-bit 6.x or 7.x
  • 2.檔案系統要求:
    資料儲存目錄為 xfs檔案系統

二. centos7.3下安裝greenplum-db

  • gp伺服器列表

     144.131.252.198 mdw                master 主節點
     144.131.252.199 sdw1-1             資料節點1
     144.131.252.144 sdw2-1             資料節點2
     144.131.252.195 sdw3-1             主節點切換備用節點
  • 1.修改系統配置項

    1.1 關閉SELINUX
    vi /etc/selinux/config

    SELINUX=disabled

    1.2 關閉防火牆

    systemctl status firewalld
    systemctl stop firewalld.service
    systemctl disable firewalld.service
    iptable -L -n

    1.3
    修改核心配置引數,並執行 sysctl -p使之生效
    vi /etc/sysctl.conf

    kernel.shmmax = 500000000
    kernel.shmmni = 4096
    kernel.shmall = 4000000000
    kernel.sem = 2000 4096000 2000 2048
    kernel.sysrq = 1
    kernel.core_uses_pid = 1
    kernel.msgmnb = 65536
    kernel.msgmax = 65536
    kernel.msgmni = 2048
    net.ipv4.tcp_syncookies = 1
    net.ipv4.ip_forward = 0
    net.ipv4.conf.default.accept_source_route = 0
    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

    1.4
    vi /etc/security/limits.conf

    * soft nofile 65536
    * hard nofile 65536
    * soft nproc 131072
    * hard nproc 131072

    1.5
    配置叢集中各節點hosts資訊
    vi /etc/hosts

144.131.252.198    mdw        # master node
144.131.252.199    sdw1-1     # segment node 1
144.131.252.144    sdw2-1     # segment node 2
144.131.252.195    sdw3-1     # segment node 3

2 安裝greenplum-db

2.1 從https://network.pivotal.io/pr…
greenplum-db-5.4.0-rhel7-x86_64.rpm
greenplum-cc-web-3.3.1-LINUX-x86_64.zip
拷貝至mdw(144.131.252.198)主節點/opt目錄下
執行

tar -xzvf greenplum-cc-web-3.3.1-LINUX-x86_64.zip
rpm -ivh greenplum-db-5.4.0-rhel7-x86_64.rpm
unzip greenplum-db-5.4.0-rhel7-x86_64.zip
./greenplum-db-5.4.0-rhel7-x86_64.bin

2.2 按照提示輸入安裝目錄

    /opt/greenplum-db

執行

    ./greenplum-cc-web-3.3.1-LINUX-x86_64.bin

按照提示輸入安裝目錄

    /opt/greenplum-cc-web

解壓完成後建立gpadmin使用者和組,用來管理greenplum-db

    groupadd gpadmin                    # 建立分組
    useradd gpadmin -g gpadmin            # 建立使用者並分配組
    passwd gpadmin                        # 為gpadmin分配密碼
    cd /opt/greenplum-db
    chown -R gpadmin:gpadmin greenplum-db/
    chown -R gpadmin:gpadmin greenplum-cc-web/

2.3 切換到gpadmin使用者下:

    su - gpadmin
    mkdir -p /opt/greenplum-db/gpconfigs
    cd /opt/greenplum-db/gpconfigs

建立配置檔案

vim hostfile_exkeys    
    mdw
    sdw1-1
    sdw2-1
    sdw3-1
vi hostfile
    sdw1-1
    sdw2-1
    sdw3-1

2.4 在gpadmin使用者下新增環境變數

vi ~/.bashrc
    #新增以下內容
    export LD_LIBRARY_PATH=$GPHOME/lib
    export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/master/gpseg-1
    . /opt/greenplum-db/greenplum_path.sh
    . /opt/greenplum-cc-web/gpcc_path.sh
     source ~/.bashrc

切換到root使用者下,匯出環境變數

su - root
vi ~/.bashrc
    #新增以下內容
    export LD_LIBRARY_PATH=$GPHOME/lib
    export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/master/gpseg-1
    . /opt/greenplum-db/greenplum_path.sh
    . /opt/greenplum-cc-web/gpcc_path.sh

執行

source ~/.bashrc
gpssh-exkeys -f hostfile_exkeys    #拷貝mster節點公鑰至各segment節點             
gpseginstall -f /opt/greenplum-db/gpconfigs/hostfile_exkeys -p gpadmin 

注:

gpssh-exkeys -f hostfile_exkeys
將會在master節點生成公私鑰,並拷貝至hostfile_exkeys各segment節點,實現後續無金鑰登陸
gpseginstall -f /opt/greenplum-db/gpconfigs/hostfile_exkeys -p gpadmin
使用預設使用者名稱(gpadmin) 、密碼:gpadmin 在各segment節點安裝Greenplum—Db

2.5 在master及各segment節點建立資料儲存目錄

mkdir /home/gpadmin/gpdata/master
cd /home/gpadmin/
chown -R gpadmin:gpadmin gpdata/master
gpssh -f /opt/greenplum-db/gpconfigs/hostfile -e "mkdir -p /home/gpadmin/gpdata/data1/primary;mkdir -p /home/gpadmin/gpdata/data2/primary”
gpssh -f /opt/greenplum-db/gpconfigs/hostfile -e "mkdir -p /home/gpadmin/gpdata/data1/mirror;mkdir -p /home/gpadmin/gpdata/data2/mirror"
gpssh -f /opt/greenplum-db/gpconfigs/hostfile -e "chown -R gpadmin:gpadmin /home/gpadmin/gpdata"
gpssh -f /opt/greenplum-db/gpconfigs/hostfile_exkeys -v -e `ntpd`

切換到gpadmin使用者下,初始化資料庫叢集

su - gpadmin
cd /opt/greenplum-db/
cp /opt/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /opt/greenplum-db/gpconfigs/gpinitsystem_config
vi /opt/greenplum-db/gpconfigs/gpinitsystem_config
###修改以下內容
MASTER_HOSTNAME=mdw
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/home/gpadmin/gpdata/data1/primary /home/gpadmin/gpdata/data1/primary /home/gpadmin/gpdata/data2/primary /home/gpadmin/gpdata/data2/primary)
MASTER_DIRECTORY=/home/gpadmin/gpdata/master
MASTER_PORT=5432
MIRROR_PORT_BASE=50000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/gpdata/data1/mirror /home/gpadmin/gpdata/data1/mirror /home/gpadmin/gpdata/data2/mirror /home/gpadmin/gpdata/data2/mirror)
DATABASE_NAME=gpdb
MACHINE_LIST_FILE=/opt/greenplum-db/gpconfigs/hostfile

2.6 配置修改完成之後,執行以下命令初始化資料庫

    gpinitsystem -c gpconfigs/gpinitsystem_config -h         gpconfigs/hostfile

按照提示輸入相應資訊,初始化完成後修改master節點:

vi /home/gpadmin/gpdata/master/gpseg-/pg_hba.conf
    #新增以下內容(允許172.16網段通過密碼登陸)
    host     all         gpadmin         172.16.1.1/16       md5

psql修改資料庫密碼:

    psql -d gpdb
    gpdb=# alter user gpadmin with password `gpadmin`
    gpdb=# q
    重啟greenplumdb叢集
gpstop -a
gpstart -a

2.7 啟動greenplum-db commond center(gpcc)

    gpperfmon_install --enable --port 5432 --password gpadmin

重啟greenplumdb叢集,載入gpperfmon_install採集資料

gpstop -a
gpstart -a

啟動web控制檯介面

gpcmdr --setup

按照提示輸入例項名、監聽埠資訊等

#Please enter the instance name
gpcc
#Press ENTER to use instance name
gpcc
#Is the master host for the Greenplum Database remote? Yy/Nn (default=N)
N
#What port does the Greenplum Database use? (default=5432)
5432
#Enable kerberos login for this instance? Yy/Nn (default=N)
N
#What port would you like the new web server to use for this instance? (default=28080)
28080

啟動、停止

gpcmdr --start  #啟動
gpcmdr --stop   #停止

相關文章