您好,登錄后才能下訂單哦!
環境:
服務器版本:centos 6.5
數據庫版本:greenplum-db-4.2.8.5-build-1-RHEL5-x86_64.zip
1.創建用戶和組gpadmin
groupadd -g 3030 gpadmin
useradd -u 3030 gpadmin -g gpadmin -d /home/gpadmin
passwd gpadmin
配置內核參數,添加如下內容:
vi /etc/sysctl.conf
#By greenplum
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.sem = 250 64000 100 512
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 64000 100 512
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_max_syn_backlog=4096
net.core.netdev_max_backlog=10000
vm.overcommit_memory=2
net.ipv4.conf.all.arp_filter = 1
以上參數可以根據自己系統配置做適當修改
手工執行命令,讓參數生效
[root@gpmaster ~]# sysctl -p
在limits.conf文件中添加如下配置
[root@gpmaster ~]# vi /etc/security/limits.conf
# End of file
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
配置用戶ssh用戶無密碼登錄,單機也得配置
[root@gpmaster ~]# su - gpadmin
[gpadmin@gpmaster ~]$ mkdir ~/.ssh
[gpadmin@gpmaster ~]$ chmod 700 ~/.ssh
[gpadmin@gpmaster ~]$ cd .ssh/
[gpadmin@gpmaster .ssh]$ ssh-keygen -t rsa
[gpadmin@gpmaster .ssh]$ ssh gpmaster cat /home/gpadmin/.ssh/id_rsa.pub >>authorized_keys
[gpadmin@gpmaster .ssh]$chmod 600 authorized_keys
[gpadmin@gpmaster .ssh]$ ssh gpmaster date
2.安裝GP軟件
[root@gpmaster ~]# unzip greenplum-db-4.2.8.5-build-1-RHEL5-x86_64.zip
[root@gpmaster ~]# ./greenplum-db-4.2.8.5-build-1-RHEL5-x86_64.bin
創建instance需要的目錄
[root@gpmaster ~]# mkdir -p /app/master
[root@gpmaster ~]# mkdir -p /app/data/gp1
[root@gpmaster ~]# mkdir -p /app/data/gp2
[root@gpmaster ~]# mkdir -p /app/data/gp3
[root@gpmaster ~]# mkdir -p /app/data/gp4
修改目錄屬主:
[root@gpmaster ~]# chown -R gpadmin:gpadmin /usr/local/greenplum-db*
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/master
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp1
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp2
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp3
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp4
修改gpadmin用戶環境配置:
[root@gpmaster ~]# su - gpadmin
[gpadmin@gpmaster ~]$ vi .bash_profile
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/app/master/gpseg-1
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=gpmaster
生效:
[gpadmin@gpmaster ~]$ source .bash_profile
編輯all_hosts_file文件,添加如下內容:
[gpadmin@gpmaster ~]$ vi all_hosts_file
gpmaster
執行如下命令驗證用戶等效性
[gpadmin@gpmaster ~]$ gpssh-exkeys -f all_hosts_file
3.初始化系統:
編輯系統初始化的參數文件,這個文件的編輯可以使用模版,模板文件所在目錄如下:
[gpadmin@gpmaster ~]$ cp /usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/
編輯gp參數文件,修改如下配置:
[gpadmin@gpmaster ~]$ vi gpinitsystem_config
declare -a DATA_DIRECTORY=(/app/data/gp1 /app/data/gp2 /app/data/gp3 /app/data/gp4)
MASTER_HOSTNAME=gpmaster
MASTER_DIRECTORY=/app/master
DATABASE_NAME=gpmaster
編輯seg_hosts_file文件
[gpadmin@gpmaster ~]$ vi seg_hosts_file
gpmaster
執行初始化系統命令:
[gpadmin@gpmaster ~]$ gpinitsystem -c gpinitsystem_config -h seg_hosts_file
系統開始初始化,之后會看到如下提示:
Continue with Greenplum creation Yy/Nn>
輸入 Y ,按回車,系統會初始化完成
安裝結束可以連接GP數據庫了:
[gpadmin@gpmaster ~]$ psql -d gpmaster
psql (8.2.15)
Type "help" for help.
gpmaster=#
創建數據庫
[gpadmin@gpmaster ~]$ createdb testDB -E utf-8
給數據庫權限
[gpadmin@gpmaster ~]$ psql -d gpmaster
psql (8.2.15)
Type "help" for help.
gpmaster=# \c testDB
You are now connected to database "testDB" as user "gpadmin".
testDB=# alter role gpadmin with password 'gpadmin';
遠程權限
[gpadmin@gpmaster ~]$ cd $MASTER_DATA_DIRECTORY/
[gpadmin@gpmaster gpseg-1]$ ls
base pg_distributedlog pg_stat_tmp pg_xlog
global pg_distributedxidmap pg_subtrans postgresql.conf
gp_dbid pg_hba.conf pg_tblspc postmaster.opts
gpperfmon pg_ident.conf pg_twophase postmaster.pid
pg_changetracking pg_log pg_utilitymodedtmredo
pg_clog pg_multixact PG_VERSION
[gpadmin@gpmaster gpseg-1]$
[gpadmin@gpmaster gpseg-1]$ vi pg_hba.conf
host testDB gpadmin 192.168.96.1/32 md5
通過gpstop -u命令使配置生效
[gpadmin@gpmaster gpseg-1]$ gpstop -u
通過其他機器登錄數據庫
$ psql -h292.168.96.128 -p5432 -d testDB -Ugpadmin
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。