這篇文章將為大家詳細(xì)講解有關(guān)Docker如何啟動GPDB,小編覺得挺實(shí)用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名與空間、虛擬主機(jī)、營銷軟件、網(wǎng)站建設(shè)、龍泉驛網(wǎng)站維護(hù)、網(wǎng)站推廣。
# docker pull pivotaldata/gpdb-devel
# docker run -it -p 15430:15432 --name gpdb0 -v /root/greenplum-db-gpdb-sandbox-tutorials-d734733/:/workspace/gpdb/tutorials -d pivotaldata/gpdb-devel
# docker exec -it gpdb0 bash
bash-4.1# su gpadmin /workspace/gpdb/gpAux/gpdemo /workspace/gpdb ====================================================================== ______ _____ ______ _______ _______ _____ | ____ |_____] | \ |______ | | | | | |_____| | |_____/ |______ | | | |_____| ---------------------------------------------------------------------- This is a demo of the Greenplum Database system. We will create a cluster installation with master and 6 segment instances (3 primary & 3 mirror). GPHOME ................. : /usr/local/gpdb MASTER_DATA_DIRECTORY .. : /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 MASTER PORT (PGPORT) ... : 15432 SEGMENT PORTS .......... : 25432 25433 25434 25435 25436 25437 25438 25439 25440 25441 25442 25443 NOTE(s): * The DB ports identified above must be available for use. * An environment file gpdemo-env.sh has been created for your use. ====================================================================== ========================================================================================== executing: /usr/local/gpdb/bin/gpinitsystem -a -c clusterConfigFile -l /workspace/gpdb/gpAux/gpdemo/datadirs/gpAdminLogs "" ========================================================================================== 。。。省略部分輸出 gp_opt_version --------------------------------------- Server has been compiled without ORCA (1 row) ====================================================================== /workspace/gpdb
bash-4.1$ createuser -P dlw Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) n NOTICE: resource queue required -- using default resource queue "pg_default"
bash-4.1$ createdb dlwdb bash-4.1$ psql dlwdb psql (8.3.23) Type "help" for help. 執(zhí)行help查看命令幫助 dlwdb=# help You are using psql, the command-line interface to PostgreSQL. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit
dlwdb=# CREATE USER cyj WITH PASSWORD 'cyj' NOSUPERUSER; NOTICE: resource queue required -- using default resource queue "pg_default" CREATE ROLE
dlwdb=# CREATE ROLE dcyls; NOTICE: resource queue required -- using default resource queue "pg_default" CREATE ROLE dlwdb=# GRANT dcyls TO dlw,cyj; GRANT ROLE dlwdb=# \du List of roles Role name | Attributes | Member of -----------+-----------------------------------+----------- cyj | | {dcyls} dcyls | Cannot login | {} dlw | Create DB | {dcyls} gpadmin | Superuser, Create role, Create DB | {}
容器暫停后,下次啟動會出現(xiàn)報(bào)錯,提示ssh連接問題
# docker stop gpdb0 gpdb0 # docker start gpdb0 gpdb0 # docker exec -it gpdb0 bash bash-4.1# su gpadmin bash-4.1$ createuser -P dlw Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) y createuser: could not connect to database postgres: could not connect to server: Connection refused Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.15432"? bash-4.1$ gpstart 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting gpstart with args: 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Gathering information and validating the environment... 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.3.99.00 build dev' 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Greenplum Catalog Version: '301605129' 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[WARNING]:-postmaster.pid file exists on Master, checking if recovery startup required 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Commencing recovery startup checks 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Have lock file /tmp/.s.PGSQL.15432 but no process running on port 15432 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-No Master instance process, entering recovery startup mode 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Clearing Master instance lock files 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Clearing Master instance pid file 20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting Master instance in admin mode 20190827:02:42:26:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20190827:02:42:26:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Segment details from master... 20190827:02:42:26:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Setting new master era 20190827:02:42:26:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Commencing forced instance shutdown 20190827:02:42:28:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting Master instance in admin mode 20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Segment details from master... 20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Setting new master era 20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Started... 20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Shutting down master 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------- 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master instance parameters 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------- 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Database = template1 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Port = 15432 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master directory = /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Timeout = 600 seconds 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master standby = Off 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------------------- 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Segment instances that will be started 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------------------- 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- Host Datadir Port Role 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast1/demoDataDir0 25432 Primary 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror1/demoDataDir0 25435 Mirror 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast2/demoDataDir1 25433 Primary 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror2/demoDataDir1 25436 Mirror 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast3/demoDataDir2 25434 Primary 20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror3/demoDataDir2 25437 Mirror Continue with Greenplum instance startup Yy|Nn (default=N): > y 20190827:02:42:35:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Commencing parallel primary and mirror segment instance startup, please wait... . 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Process results... 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[ERROR]:-No segment started for content: 0. 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-dumping success segments: [] 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-DBID:2 FAILED host:'3ce34f890d16' datadir:'/workspace/gpdb/gpAux/gpdemo/datadirs/dbfast1/demoDataDir0' with reason:'cmd had rc=255 completed=True halted=False stdout='' stderr='ssh: connect to host 3ce34f890d16 port 22: Connection refused '' 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-DBID:5 FAILED host:'3ce34f890d16' datadir:'/workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror1/demoDataDir0' with reason:'cmd had rc=255 completed=True halted=False stdout='' stderr='ssh: connect to host 3ce34f890d16 port 22: Connection refused '' 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-DBID:3 FAILED host:'3ce34f890d16' datadir:'/workspace/gpdb/gpAux/gpdemo/datadirs/dbfast2/demoDataDir1' with reason:'cmd had rc=255 completed=True halted=False stdout='' stderr='ssh: connect to host 3ce34f890d16 port 22: Connection refused '' 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-DBID:6 FAILED host:'3ce34f890d16' datadir:'/workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror2/demoDataDir1' with reason:'cmd had rc=255 completed=True halted=False stdout='' stderr='ssh: connect to host 3ce34f890d16 port 22: Connection refused '' 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-DBID:4 FAILED host:'3ce34f890d16' datadir:'/workspace/gpdb/gpAux/gpdemo/datadirs/dbfast3/demoDataDir2' with reason:'cmd had rc=255 completed=True halted=False stdout='' stderr='ssh: connect to host 3ce34f890d16 port 22: Connection refused '' 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-DBID:7 FAILED host:'3ce34f890d16' datadir:'/workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror3/demoDataDir2' with reason:'cmd had rc=255 completed=True halted=False stdout='' stderr='ssh: connect to host 3ce34f890d16 port 22: Connection refused '' 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- Successful segment starts = 0 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[WARNING]:-Failed segment starts = 6 <<<<<<<< 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Successfully started 0 of 6 segment instances <<<<<<<< 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[WARNING]:-Segment instance startup failures reported 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[WARNING]:-Failed start 6 of 6 segment instances <<<<<<<< 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[WARNING]:-Review /home/gpadmin/gpAdminLogs/gpstart_20190827.log 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:42:36:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Commencing parallel segment instance shutdown, please wait... . 20190827:02:42:37:000018 gpstart:3ce34f890d16:gpadmin-[ERROR]:-gpstart error: Do not have enough valid segments to start the array.
這個問題很好處理,它是ssh自己,看下ssh服務(wù),第一次啟動的時候應(yīng)該是啟動腳本里附帶了啟動sshd服務(wù),之后再啟動,需要自己手動啟動下sshd服務(wù),此處是centos6.8的系統(tǒng)
bash-4.1$ hostname 3ce34f890d16 bash-4.1$ ssh 3ce34f890d16 ssh: connect to host 3ce34f890d16 port 22: Connection refused bash-4.1$ cat /etc/redhat-release CentOS release 6.8 (Final) bash-4.1$ service sshd start /etc/init.d/sshd: line 33: /etc/sysconfig/sshd: Permission denied Starting sshd: /etc/ssh/sshd_config: Permission denied [FAILED] bash-4.1$ exit exit bash-4.1# service sshd start Starting sshd: [ OK ]
啟動sshd后再啟動數(shù)據(jù)庫,正常運(yùn)行
bash-4.1# su gpadmin bash-4.1$ gpstart 20190827:02:43:49:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting gpstart with args: 20190827:02:43:49:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Gathering information and validating the environment... 20190827:02:43:49:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.3.99.00 build dev' 20190827:02:43:49:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Greenplum Catalog Version: '301605129' 20190827:02:43:49:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting Master instance in admin mode 20190827:02:43:50:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20190827:02:43:50:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Segment details from master... 20190827:02:43:51:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Setting new master era 20190827:02:43:51:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Started... 20190827:02:43:51:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Shutting down master 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------- 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master instance parameters 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------- 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Database = template1 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Port = 15432 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master directory = /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Timeout = 600 seconds 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master standby = Off 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------------------- 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Segment instances that will be started 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:--------------------------------------- 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- Host Datadir Port Role 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast1/demoDataDir0 25432 Primary 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror1/demoDataDir0 25435 Mirror 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast2/demoDataDir1 25433 Primary 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror2/demoDataDir1 25436 Mirror 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast3/demoDataDir2 25434 Primary 20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror3/demoDataDir2 25437 Mirror Continue with Greenplum instance startup Yy|Nn (default=N): > y 20190827:02:43:54:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Commencing parallel primary and mirror segment instance startup, please wait... .... 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Process results... 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- Successful segment starts = 6 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- Failed segment starts = 0 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Successfully started 6 of 6 segment instances 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:----------------------------------------------------- 20190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting Master instance 3ce34f890d16 directory /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 20190827:02:43:59:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Command pg_ctl reports Master 3ce34f890d16 instance active 20190827:02:43:59:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-No standby master configured. skipping... 20190827:02:43:59:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Database successfully started bash-4.1$ createuser -P dlw Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) y bash-4.1$ bash-4.1$ createdb dlwdb bash-4.1$ psql dlwdb psql (8.3.23) Type "help" for help. dlwdb=#
連接之前需要修改pgdb的配置文件,允許客戶端所在網(wǎng)絡(luò)可以連接 配置文件目錄可以在初始化pgdb的時候看到
bash-4.1$ cd /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 bash-4.1$ vi pg_hba.conf 添加 host all all 192.16.126.0/24 trust 重啟gpdb bash-4.1$ gpstop -r
下載windows客戶端
https://www.postgresql.org/ftp/pgadmin/pgadmin3/v1.22.2/win32/
安裝之后啟動連接
成功連接
關(guān)于“Docker如何啟動GPDB”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
標(biāo)題名稱:Docker如何啟動GPDB
文章路徑:http://jinyejixie.com/article36/ggeipg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、網(wǎng)站收錄、響應(yīng)式網(wǎng)站、自適應(yīng)網(wǎng)站、域名注冊、網(wǎng)頁設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)