├── .dockerignore ├── configs ├── bash_profile ├── limits.conf.add ├── run.sh ├── sysctl.conf.add └── gpinitsystem_singlenode ├── README.md └── Dockerfile /.dockerignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /configs/bash_profile: -------------------------------------------------------------------------------- 1 | export MASTER_DATA_DIRECTORY=/gpdata/master/gpseg-1 2 | source /usr/local/greenplum-db/greenplum_path.sh 3 | -------------------------------------------------------------------------------- /configs/limits.conf.add: -------------------------------------------------------------------------------- 1 | ###################### 2 | # HAWQ CONFIG PARAMS # 3 | ###################### 4 | 5 | * soft nofile 65536 6 | * hard nofile 65536 7 | * soft nproc 131072 8 | * hard nproc 131072 9 | -------------------------------------------------------------------------------- /configs/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "host all all 0.0.0.0/0 md5" >> /gpdata/master/gpseg-1/pg_hba.conf 4 | export MASTER_DATA_DIRECTORY=/gpdata/master/gpseg-1 5 | source /usr/local/greenplum-db/greenplum_path.sh 6 | gpstart -a 7 | psql -d template1 -c "alter user gpadmin password 'pivotal'" 8 | -------------------------------------------------------------------------------- /configs/sysctl.conf.add: -------------------------------------------------------------------------------- 1 | ###################### 2 | # HAWQ CONFIG PARAMS # 3 | ###################### 4 | 5 | kernel.shmmax = 1000000000 6 | kernel.shmmni = 4096 7 | kernel.shmall = 4000000000 8 | kernel.sem = 250 512000 100 2048 9 | kernel.sysrq = 1 10 | kernel.core_uses_pid = 1 11 | kernel.msgmnb = 65536 12 | kernel.msgmax = 65536 13 | kernel.msgmni = 2048 14 | net.ipv4.tcp_syncookies = 0 15 | net.ipv4.ip_forward = 0 16 | net.ipv4.conf.default.accept_source_route = 0 17 | net.ipv4.tcp_tw_recycle = 1 18 | net.ipv4.tcp_max_syn_backlog = 200000 19 | net.ipv4.conf.all.arp_filter = 1 20 | net.ipv4.ip_local_port_range = 1025 65535 21 | net.core.netdev_max_backlog = 200000 22 | fs.nr_open = 3000000 23 | kernel.threads-max = 798720 24 | kernel.pid_max = 798720 25 | net.core.rmem_max=2097152 26 | net.core.wmem_max=2097152 27 | vm.overcommit_memory=2 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gpdb-docker 2 | Pivotal Greenplum Database Base Docker Image (4.3.7.1) 3 | 4 | [![](https://images.microbadger.com/badges/version/pivotaldata/gpdb-base.svg)](https://microbadger.com/images/pivotaldata/gpdb-base "Get your own version badge on microbadger.com") 5 | 6 | 7 | # Building the Docker Image 8 | You will first need to download the Pivotal Greenplum Database 4.3.7.1 installer (.zip) located at https://network.pivotal.io/products/pivotal-gpdb and place it inside the docker working directory. 9 | 10 | cd [docker working directory] 11 | 12 | docker build -t [tag] . 13 | 14 | # Running the Docker Image 15 | docker run -i -p 5432:5432 [tag] 16 | 17 | # Container Accounts 18 | root/pivotal 19 | 20 | gpadmin/pivotal 21 | 22 | # Using psql in the Container 23 | su - gpadmin 24 | 25 | psql 26 | 27 | # Using pgadmin outside the Container 28 | Launch pgAdmin3 29 | 30 | Create new connection using IP Address and Port # (5432) 31 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Dockerfile for a GPDB SNE Sandbox Base Image 3 | # 4 | 5 | FROM centos:6.7 6 | MAINTAINER dbaskette@pivotal.io 7 | 8 | COPY * /tmp/ 9 | RUN echo root:pivotal | chpasswd \ 10 | && yum install -y unzip which tar more util-linux-ng passwd openssh-clients openssh-server ed m4; yum clean all \ 11 | && unzip /tmp/greenplum-db-4.3.7.1-build-1-RHEL5-x86_64.zip -d /tmp/ \ 12 | && rm /tmp/greenplum-db-4.3.7.1-build-1-RHEL5-x86_64.zip \ 13 | && sed -i s/"more << EOF"/"cat << EOF"/g /tmp/greenplum-db-4.3.7.1-build-1-RHEL5-x86_64.bin \ 14 | && echo -e "yes\n\nyes\nyes\n" | /tmp/greenplum-db-4.3.7.1-build-1-RHEL5-x86_64.bin \ 15 | && rm /tmp/greenplum-db-4.3.7.1-build-1-RHEL5-x86_64.bin \ 16 | && cat /tmp/sysctl.conf.add >> /etc/sysctl.conf \ 17 | && cat /tmp/limits.conf.add >> /etc/security/limits.conf \ 18 | && rm -f /tmp/*.add \ 19 | && echo "localhost" > /tmp/gpdb-hosts \ 20 | && chmod 777 /tmp/gpinitsystem_singlenode \ 21 | && hostname > ~/orig_hostname \ 22 | && mv /tmp/run.sh /usr/local/bin/run.sh \ 23 | && chmod +x /usr/local/bin/run.sh \ 24 | && /usr/sbin/groupadd gpadmin \ 25 | && /usr/sbin/useradd gpadmin -g gpadmin -G wheel \ 26 | && echo "pivotal"|passwd --stdin gpadmin \ 27 | && echo "gpadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ 28 | && mv /tmp/bash_profile /home/gpadmin/.bash_profile \ 29 | && chown -R gpadmin: /home/gpadmin \ 30 | && mkdir -p /gpdata/master /gpdata/segments \ 31 | && chown -R gpadmin: /gpdata \ 32 | && chown -R gpadmin: /usr/local/green* \ 33 | && service sshd start \ 34 | && su gpadmin -l -c "source /usr/local/greenplum-db/greenplum_path.sh;gpssh-exkeys -f /tmp/gpdb-hosts" \ 35 | && su gpadmin -l -c "source /usr/local/greenplum-db/greenplum_path.sh;gpinitsystem -a -c /tmp/gpinitsystem_singlenode -h /tmp/gpdb-hosts; exit 0 "\ 36 | && su gpadmin -l -c "export MASTER_DATA_DIRECTORY=/gpdata/master/gpseg-1;source /usr/local/greenplum-db/greenplum_path.sh;psql -d template1 -c \"alter user gpadmin password 'pivotal'\"; createdb gpadmin; exit 0" 37 | 38 | EXPOSE 5432 22 39 | 40 | VOLUME /gpdata 41 | # Set the default command to run when starting the container 42 | 43 | CMD echo "127.0.0.1 $(cat ~/orig_hostname)" >> /etc/hosts \ 44 | && service sshd start \ 45 | # && sysctl -p \ 46 | && su gpadmin -l -c "/usr/local/bin/run.sh" \ 47 | && /bin/bash 48 | -------------------------------------------------------------------------------- /configs/gpinitsystem_singlenode: -------------------------------------------------------------------------------- 1 | # FILE NAME: gpinitsystem_singlenode 2 | 3 | # A configuration file is needed by the gpinitsystem utility. 4 | # This sample file initializes a Greenplum Database Single Node 5 | # Edition (SNE) system with one master and two segment instances 6 | # on the local host. This file is referenced when you run gpinitsystem. 7 | 8 | ################################################ 9 | # REQUIRED PARAMETERS 10 | ################################################ 11 | 12 | # A name for the array you are configuring. You can use any name you 13 | # like. Enclose the name in quotes if the name contains spaces. 14 | 15 | ARRAY_NAME="GPDB SANDBOX" 16 | 17 | 18 | # This specifies the file that contains the list of segment host names 19 | # that comprise the Greenplum system. For a single-node system, this 20 | # file contains the local OS-configured hostname (as output by the 21 | # hostname command). If the file does not reside in the same 22 | # directory where the gpinitsystem utility is executed, specify 23 | # the absolute path to the file. 24 | 25 | MACHINE_LIST_FILE=/tmp/gpdb-hosts 26 | 27 | 28 | # This specifies a prefix that will be used to name the data directories 29 | # of the master and segment instances. The naming convention for data 30 | # directories in a Greenplum Database system is SEG_PREFIX 31 | # where starts with 0 for segment instances and the master 32 | # is always -1. So for example, if you choose the prefix gpsne, your 33 | # master instance data directory would be named gpsne-1, and the segment 34 | # instances would be named gpsne0, gpsne1, gpsne2, gpsne3, and so on. 35 | 36 | SEG_PREFIX=gpseg 37 | 38 | 39 | # Base port number on which primary segment instances will be 40 | # started on a segment host. The base port number will be 41 | # incremented by one for each segment instance started on a host. 42 | 43 | PORT_BASE=40000 44 | 45 | 46 | # This specifies the data storage location(s) where the script will 47 | # create the primary segment data directories. The script creates a 48 | # unique data directory for each segment instance. If you want multiple 49 | # segment instances per host, list a data storage area for each primary 50 | # segment you want created. The recommended number is one primary segment 51 | # per CPU. It is OK to list the same data storage area multiple times 52 | # if you want your data directories created in the same location. The 53 | # number of data directory locations specified will determine the number 54 | # of primary segment instances created per host. 55 | # You must make sure that the user who runs gpinitsystem (for example, 56 | # the gpadmin user) has permissions to write to these directories. You 57 | # may want to create these directories on the segment hosts before running 58 | # gpinitsystem and chown them to the appropriate user. 59 | 60 | declare -a DATA_DIRECTORY=(/gpdata/segments /gpdata/segments) 61 | 62 | 63 | # The OS-configured hostname of the Greenplum Database master instance. 64 | 65 | MASTER_HOSTNAME=localhost 66 | 67 | 68 | 69 | # The location where the data directory will be created on the 70 | # Greenplum master host. 71 | # You must make sure that the user who runs gpinitsystem 72 | # has permissions to write to this directory. You may want to 73 | # create this directory on the master host before running 74 | # gpinitsystem and chown it to the appropriate user. 75 | 76 | MASTER_DIRECTORY=/gpdata/master 77 | 78 | 79 | # The port number for the master instance. This is the port number 80 | # that users and client connections will use when accessing the 81 | # Greenplum Database system. 82 | 83 | MASTER_PORT=5432 84 | 85 | 86 | # The shell the gpinitsystem script uses to execute 87 | # commands on remote hosts. Allowed value is ssh. You must set up 88 | # your trusted host environment before running the gpinitsystem 89 | # script. You can use gpssh-exkeys to do this. 90 | 91 | TRUSTED_SHELL=ssh 92 | 93 | 94 | # Maximum distance between automatic write ahead log (WAL) 95 | # checkpoints, in log file segments (each segment is normally 16 96 | # megabytes). This will set the checkpoint_segments parameter 97 | # in the postgresql.conf file for each segment instance in the 98 | # Greenplum Database system. 99 | 100 | CHECK_POINT_SEGMENTS=8 101 | 102 | 103 | # The character set encoding to use. Greenplum supports the 104 | # same character sets as PostgreSQL. See 'Character Set Support' 105 | # in the PostgreSQL documentation for allowed character sets. 106 | # Should correspond to the OS locale specified with the 107 | # gpinitsystem -n option. 108 | 109 | ENCODING=UNICODE 110 | 111 | 112 | ################################################ 113 | # OPTIONAL PARAMETERS 114 | ################################################ 115 | 116 | # Optional. Uncomment to create a database of this name after the 117 | # system is initialized. You can always create a database later using 118 | # the CREATE DATABASE command or the createdb script. 119 | 120 | #DATABASE_NAME=warehouse 121 | --------------------------------------------------------------------------------