規(guī)劃:1個(gè)msater, 2個(gè)segments
為鐵西等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計(jì)制作服務(wù),及鐵西網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為成都網(wǎng)站建設(shè)、網(wǎng)站制作、鐵西網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!
環(huán)境:ubuntu 16.04
Greenplum Version: 'postgres (Greenplum Database) 5.3.0 build 2155c5a-oss
1、安裝
sudo add-apt-repository ppa:greenplum/db
sudo apt-get update
sudo apt-get install greenplum-db-oss
2. 配置/etc/hosts
Edit the /etc/hosts file and make sure that it includes the host names and all interface address names for every machine participating in your Greenplum Database system.
3、關(guān)閉防火墻
service iptables stop
4、修改/etc/sysctl.conf,添加
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 512000 100 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.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_forward=0
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
5、配置 /etc/security/limits.conf,添加
* soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072
6. 設(shè)置預(yù)讀塊大小
/sbin/blockdev --setra16384/dev/sda
7、重啟系統(tǒng)
8、安裝greenplum
http://greenplum.org/install-greenplum-oss-on-ubuntu/
https://launchpad.net/~greenplum/+archive/ubuntu/db
Installation into /opt/gpdb
---------------------------
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:greenplum/db
sudo apt-get update
sudo apt-get install -y greenplum-db-oss
9、初始化環(huán)境變量
$ su root
$ source /opt/gpdb/greenplum_path.sh
10、創(chuàng)建主機(jī)文件 all_hosts
$ vi all_hosts
ifreBigData1
ifreBigData2
ifreBigData4
11、運(yùn)行g(shù)pseginstall工具
$ gpseginstall -f all_hosts -u gpadmin-p gpadmin
有可能免密失敗
20171215:08:55:57:054683 gpseginstall:ifreBigData1:root-[INFO]:-exchange ssh keys for user root
20171215:08:55:57:054683 gpseginstall:ifreBigData1:root-[INFO]:-Cmd 'gpssh-exkeys -f all_hosts' failed with error code 1
20171215:08:55:57:054683 gpseginstall:ifreBigData1:root-[INFO]:-gppsh-exkeys failed running from within pexpect ... now try outside of pexpect
Problem getting hostname for ifreBigData1: [Errno 0] Resolver Error 0 (no error)
Traceback (most recent call last):
File "/opt/gpdb/bin/gpssh-exkeys", line 534, in
(primary, aliases, ipaddrs) = socket.gethostbyaddr(hostname)
socket.herror: [Errno 0] Resolver Error 0 (no error)
20171215:08:55:58:054683 gpseginstall:ifreBigData1:root-[ERROR]:-error on cmd: gpssh-exkeys -f all_hosts
解決方法
$su gpadmin
$source /opt/gpdb/greenplum_path.sh
$gpssh-exkeys -f all_hosts
12.驗(yàn)證安裝及免密登錄
$ gpssh -f all_hosts -e ls $GPHOME
13. 將source /opt/gpdb/greenplum_path.sh添加到.bashrc文件最后(所有的節(jié)點(diǎn)都要做)
14、創(chuàng)建存儲(chǔ)區(qū)域
a) 創(chuàng)建Master數(shù)據(jù)存儲(chǔ)區(qū)域
mkdir -p /data/master
b)改變目錄所有權(quán)
chown gpadmin /data/master
c)創(chuàng)建包含所有segment主機(jī)的文件seg_hosts
d)root用戶用gpssh 工具在segment主機(jī)上創(chuàng)建主數(shù)據(jù)和鏡像數(shù)據(jù)目錄
$ su root
$ source /opt/gpdb/greenplum_path.sh
$ gpssh-exkeys -f all_hosts
gpssh -f seg_hosts -e 'mkdir -p /data/primary'
gpssh -f seg_hosts -e 'mkdir -p /data/mirror'
gpssh -f seg_hosts -e ‘chown gpadmin /data/primary'
gpssh -f seg_hosts -e ‘chown gpadmin /data/mirror'
15、同步系統(tǒng)時(shí)間
在各個(gè)機(jī)器安裝 ntp
a.gpssh -f all_hosts -e 'apt install -y ntp'
b.修改/etc/ntp.conf添加
server masterhostname
c.gpssh -f /data/all_hosts -e 'ntpd'
16、驗(yàn)證操作系統(tǒng)設(shè)置
#gpcheck -f /data/all_hosts -m ifreBigData1
17、初始化GP數(shù)據(jù)庫系統(tǒng)
#su - gpadmin
$ cp /opt/gpdb/docs/cli_help/gpconfigs/gpinitsystem_config ~/gpinitsystem_config
$ chmod 775 gpinitsystem_config
$ vi gpinitsystem_config
ARRAY_NAME="Greenplum Data Platform"
SEG_PREFIX=ifreseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/data/primary)
MASTER_HOSTNAME=ifreBigData1
MASTER_DIRECTORY=/data/master
MASTER_PORT=5432
#### OPTIONAL MIRROR PARAMETERS
MIRROR_PORT_BASE=50000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
declare -a MIRROR_DATA_DIRECTORY=(/data/mirror)
a)運(yùn)行初始化工具
$ cp /data/seg_hosts ~
$ gpinitsystem -c gpinitsystem_config -h seg_hosts
檢查結(jié)果
b)設(shè)置環(huán)境變量
添加
export MASTER_DATA_DIRECTORY=/data/master/ifreseg-1
到master 的~/.bashrc
在segment機(jī)器上做同樣的操作
18、啟動(dòng)停止數(shù)據(jù)庫
$ gpstart
$gpstop
驗(yàn)證
$ psql -d template1