您当前的位置: 首页 >  docker

qq_34412985

暂无认证

  • 0浏览

    0关注

    1061博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Docker启动单机版GreenPlum(GPDB)数据库

qq_34412985 发布时间:2020-12-27 14:57:51 ,浏览量:0

下载镜像

# 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) 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. 执行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 | {}

重启容器

    容器暂停后,下次启动会出现报错,提示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  

关注
打赏
1653291990
查看更多评论
立即登录/注册

微信扫码登录

0.0409s