Docker如何启动GPDB
发表于:2025-01-23 作者:千家信息网编辑
千家信息网最后更新 2025年01月23日,这篇文章将为大家详细讲解有关Docker如何启动GPDB,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。下载镜像# docker pull pivotaldata/g
千家信息网最后更新 2025年01月23日Docker如何启动GPDB
这篇文章将为大家详细讲解有关Docker如何启动GPDB,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
下载镜像
# 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
首次切换gpadmin用户,会自动启动gp数据库
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) nShall the new role be allowed to create databases? (y/n) yShall the new role be allowed to create more new roles? (y/n) nNOTICE: resource queue required -- using default resource queue "pg_default"
创建数据库
bash-4.1$ createdb dlwdbbash-4.1$ psql dlwdb psql (8.3.23)Type "help" for help.执行help查看命令帮助dlwdb=# helpYou 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 ROLEdlwdb=# GRANT dcyls TO dlw,cyj; GRANT ROLEdlwdb=# \du List of roles Role name | Attributes | Member of -----------+-----------------------------------+----------- cyj | | {dcyls} dcyls | Cannot login | {} dlw | Create DB | {dcyls} gpadmin | Superuser, Create role, Create DB | {}
重启容器
容器暂停后,下次启动会出现报错,提示ssh连接问题
# docker stop gpdb0gpdb0# docker start gpdb0gpdb0# docker exec -it gpdb0 bashbash-4.1# su gpadminbash-4.1$ createuser -P dlw Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) ycreateuser: 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 required20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Commencing recovery startup checks20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Have lock file /tmp/.s.PGSQL.15432 but no process running on port 1543220190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-No Master instance process, entering recovery startup mode20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Clearing Master instance lock files20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Clearing Master instance pid file20190827:02:42:25:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting Master instance in admin mode20190827:02:42:26:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20190827: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 era20190827:02:42:26:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Commencing forced instance shutdown20190827:02:42:28:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Starting Master instance in admin mode20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20190827: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 era20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Started...20190827:02:42:29:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Shutting down master20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:---------------------------20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master instance parameters20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:---------------------------20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Database = template120190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Port = 1543220190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master directory = /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-120190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:-Timeout = 600 seconds20190827: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 started20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:---------------------------------------20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- Host Datadir Port Role20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast1/demoDataDir0 25432 Primary20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror1/demoDataDir0 25435 Mirror20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast2/demoDataDir1 25433 Primary20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror2/demoDataDir1 25436 Mirror20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast3/demoDataDir2 25434 Primary20190827:02:42:30:000018 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror3/demoDataDir2 25437 MirrorContinue with Greenplum instance startup Yy|Nn (default=N):> y20190827: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 = 020190827: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) = 020190827: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 reported20190827: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.log20190827: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服务,第一次启动的时候应该是启动脚本里附带了启动sshd服务,之后再启动,需要自己手动启动下sshd服务,此处是centos6.8的系统
bash-4.1$ hostname 3ce34f890d16bash-4.1$ ssh 3ce34f890d16 ssh: connect to host 3ce34f890d16 port 22: Connection refusedbash-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 deniedStarting sshd: /etc/ssh/sshd_config: Permission denied [FAILED]bash-4.1$ exitexitbash-4.1# service sshd startStarting sshd: [ OK ]
启动sshd后再启动数据库,正常运行
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 mode20190827:02:43:50:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20190827: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 era20190827:02:43:51:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Started...20190827:02:43:51:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Shutting down master20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:---------------------------20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master instance parameters20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:---------------------------20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Database = template120190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master Port = 1543220190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Master directory = /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-120190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Timeout = 600 seconds20190827: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 started20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:---------------------------------------20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- Host Datadir Port Role20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast1/demoDataDir0 25432 Primary20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror1/demoDataDir0 25435 Mirror20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast2/demoDataDir1 25433 Primary20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror2/demoDataDir1 25436 Mirror20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast3/demoDataDir2 25434 Primary20190827:02:43:52:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- 3ce34f890d16 /workspace/gpdb/gpAux/gpdemo/datadirs/dbfast_mirror3/demoDataDir2 25437 MirrorContinue with Greenplum instance startup Yy|Nn (default=N):> y20190827: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 = 620190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- Failed segment starts = 020190827:02:43:58:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 020190827: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 active20190827:02:43:59:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-No standby master configured. skipping...20190827:02:43:59:000169 gpstart:3ce34f890d16:gpadmin-[INFO]:-Database successfully startedbash-4.1$ createuser -P dlw Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) ybash-4.1$ bash-4.1$ createdb dlwdbbash-4.1$ psql dlwdb psql (8.3.23)Type "help" for help.dlwdb=#
客户端连接
连接之前需要修改pgdb的配置文件,允许客户端所在网络可以连接 配置文件目录可以在初始化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/
安装之后启动连接
成功连接
关于"Docker如何启动GPDB"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
用户
容器
数据
数据库
客户
客户端
篇文章
服务
文件
时候
更多
问题
帮助
运行
配置
不错
实用
成功
内容
启动会
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
企业内部软件开发平台
安卓软件开发大概要多少钱
计算机网络技术学习计划书
数据库共享池高速缓存的作用
计算机专业英语网络安全论文
保定飞速网络技术有限公司
怎么添加obdc数据库
通信与网络技术研讨会
网络安全方面所存在的问题
电脑软件开发相关资料
太原市智贤网络技术有限公司
浙江迅的网络技术有限公司
六级网络安全事故
好店主软件开发
群晖流媒体服务器搭建
幽冥传奇服务器需要什么配置
计算机网络技术买什么台式电脑
学籍管理系统 数据库
0072数据库技术大作业
保障电力系统网络安全
监控网络安全专业就业方向
移动软件开发工程师学一些什么
外置云数据库组件
外文文摘型数据库有哪些特点
网络安全维护工程师工作条件
ftp服务器的安全
oracle数据库百度云
网吧服务器怎么连接千兆网线
修改数据库中的字符集为gbk
太仓电子网络技术质量保证