您好,登錄后才能下訂單哦!
2、下載依賴包并啟動(dòng)ssh,并配置時(shí)間同步
docker中默認(rèn)沒有啟動(dòng)ssh,為了方便各節(jié)點(diǎn)之間的互連,啟動(dòng)docker的每個(gè)節(jié)點(diǎn)里面的ssh,并創(chuàng)建相關(guān)的認(rèn)證key
yum install -y net-tools which openssh-clients openssh-server less zip
unzip iproute.x86_64 vim ntp ed
yum install update 更新系統(tǒng)內(nèi)核
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
/usr/sbin/sshd
ntpdate ntp1.aliyun.com
配置主機(jī)域名映射關(guān)系
172.17.0.2 dw-greenplum-1 mdw
172.17.0.3 dw-greenplum-2 sdw1
172.17.0.4 dw-greenplum-3 sdw2
172.17.0.4 dw-greenplum-4 sdw3
同時(shí),修改所有節(jié)點(diǎn)里面的 /etc/sysconfig/network 文件,保持主機(jī)名一致
修改/etc/hostname 的名字
[root@mdw /]# cat /etc/hostname
mdw
[root@mdw /]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mdw
修改內(nèi)核參數(shù)
sysctl -w kernel.sem="500 64000 50 150"
cat /proc/sys/kernel/sem
關(guān)閉所有節(jié)點(diǎn)的防火墻和selinux
service iptables stop
chkconfig iptables off
setenforce 0
7.所有節(jié)點(diǎn)創(chuàng)建 greenplum 的用戶和用戶組
groupadd -g 530 gpadmin
useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin
chown -R gpadmin:gpadmin /home/gpadmin
echo 123456 |passwd gpadmin --stdin
在master上面安裝greenplum
su - gpadmin
unzip greenplum-db-4.3.14.1-rhel5-x86_64.zip
sh /greenplum-db-4.3.14.1-rhel5-x86_64.bin
安裝期間需要修改默認(rèn)安裝目錄,輸入/home/gpadmin/greenplum-db
為了方便安裝集群,greenplum提供了批量操作的指令,通過創(chuàng)建配置文件,以使用批處理命令
創(chuàng)建文件
[gpadmin@mdw ~]$ cat conf/hostlist
mdw
sdw1
sdw2
sdw3
[gpadmin@mdw ~]$ cat conf/seg_hosts
sdw1
sdw2
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] authorize current user on remote hosts
... send to sdw1
... send to sdw2
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
... finished key exchange with sdw1
... finished key exchange with sdw2
... finished key exchange with sdw3
[INFO] completed successfully
使用gpssh-exkeys命令時(shí)一定要使用gpadmin身份,因?yàn)闀?huì)在/home/gpadmin/.ssh
中生成ssh的免密碼登錄秘鑰,
[gpadmin@mdw ~]$ gpssh -f /home/gpadmin/conf/hostlist
Note: command history unsupported on this machine ...
=> pwd
[ mdw] /home/gpadmin
[sdw2] /home/gpadmin
[sdw1] /home/gpadmin
[sdw3] /home/gpadmin
分發(fā)所有的安裝包到每個(gè)值節(jié)點(diǎn)
tar cf greenplum.tar greenplum-db/
將文件拷貝到每個(gè)機(jī)器上面
gpscp -f /home/gpadmin/conf/hostlist greenplum.tar =:/home/gpadmin/
批量解壓
tar -xf greenplum.tar
這樣所有的節(jié)點(diǎn)就完成的安裝
每個(gè)節(jié)點(diǎn)上面配置環(huán)境變量
cat .bash_profile
source /home/gpadmin/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/gpmaster/gpseg-1
export PGPORT=6500
export PGDATABASE=postgres
source .bash_profile
配置初始化文件
[gpadmin@mdw conf]$ cat gpinitsystem_config
ARRAY_NAME="Greenplum"
MACHINE_LIST_FILE=/home/gpadmin/conf/seg_hosts
SEG_PREFIX=gpseg
PORT_BASE=33000
declare -a DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatap1 /home/gpadmin/gpdata/gpdatap2)
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/home/gpadmin/gpdata/gpmaster
MASTER_PORT=6500
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=256
MIRROR_PORT_BASE=43000
REPLICATION_PORT_BASE=34000
MIRROR_REPLICATION_PORT_BASE=44000
declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatam1 /home/gpadmin/gpdata/gpdatam2)
初始化數(shù)據(jù)庫
gpinitsystem -c gpinitsystem_config -h hostlist -s sdw3 -S
//如無報(bào)錯(cuò)就是初始化完成,如果有報(bào)錯(cuò),就需要根據(jù)日志提示修改配置,并重新初始化
[gpadmin@mdw conf]$ psql
psql (8.2.15)
Type "help" for help.
postgres=# select version();
version
PostgreSQL 8.2.15 (Greenplum Database 4.3.10.0 build commit: f413ff3b006655f14b6b9aa217495ec94da5c96c) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compi
led on Oct 21 2016 19:36:26
(1 row)
錯(cuò)誤截圖,日志和截圖
節(jié)點(diǎn)有部分起來,一部分沒有起來。主機(jī)資源不夠。
2019-10-28 21:20:25.520556 CST,,,p6788,th-1469757664,,,,0,,,seg-1,,,,,"FATAL","XX000","could not create semaphores: No space left on device (pg_sema.c:132)","Failed system call was semget(43001004, 17, 03600).","This error does not mean that you have run out of disk space.
It occurs when either the system limit for the maximum number of semaphore sets (SEMMNI), or the system wide maximum number of semaphores (SEMMNS), would be exceeded. You need to raise the respective kernel parameter. Alternatively, reduce PostgreSQL's consumption of semaphores by reducing its max_connections parameter (currently 750).
The PostgreSQL documentation contains more information about configuring your system for PostgreSQL.",,,,,,"InternalIpcSemaphoreCreate","pg_sema.c",132,1 0xb0a80e postgres errstart + 0x4de
調(diào)整配置文件
vim /home/gpadmin/gpdata/gpdatam1/gpseg6/postgresql.conf
//每臺(tái)機(jī)器4個(gè)segments 都要修改
max_connections = 200 //原值750 ,調(diào)整到200
shared_buffers = 500MB //原值275 調(diào)整到500
gpstart -a 重啟啟動(dòng)集群
gpstop -u 重新加載配置文件
#常用操作命令
gpstate:查看數(shù)據(jù)庫集群狀態(tài),示例:gpstate -a
gpstart:啟動(dòng)數(shù)據(jù)庫集群,示例:gpstart -a
gpstop:關(guān)閉數(shù)據(jù)庫集群,示例:gpstop -a -M fast
gpssh:遠(yuǎn)程執(zhí)行shell命令,示例:gpssh -f hosts -e 'date'
部署參考博文
https://www.cnblogs.com/dap570/archive/2015/03/21/greenplum_4node_install.html
https://my.oschina.net/u/876354/blog/1606419
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。