Docker启动GPDB

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

下载镜像

# 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 createa cluster installation with master and 6 segment instances(3 primary & 3 mirror).GPHOME ................. : /usr/local/gpdbMASTER_DATA_DIRECTORY .. : /workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1MASTER PORT (PGPORT) ... : 15432SEGMENT PORTS .......... : 25432 25433 25434 25435 25436 25437 25438 25439 25440 25441 25442 25443NOTE(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=# \duList of rolesRole name |            Attributes             | Member of 
-----------+-----------------------------------+-----------cyj       |                                   | {dcyls}dcyls     | Cannot login                      | {}dlw       | Create DB                         | {dcyls}gpadmin   | Superuser, Create role, Create DB | {}

客户端连接

连接之前需要修改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/安装之后启动连接![](https://oscimg.oschina.net/oscnet/c2d217ca62c1b5c3dc519bafbf908d147b6.jpg)成功连接![](https://oscimg.oschina.net/oscnet/5142495bcc78292b2fdec48ec3c67074fb7.jpg)参考连接http://blog.51cto.com/7038006/2056705https://yq.aliyun.com/articles/57656

转载于:https://my.oschina.net/xiaozhublog/blog/2249525


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部