hawq-docker is based on wangzw's repo hawq-devel-env. It is the docker images and scripts to help developers of Apache HAWQ to setup building and testing environment with docker.
Both CentOS 7 and CentOS 6 are supported. Change variable OS_VERSION (:= centos7 OR centos6) in Makefile to switch between CentOS 7 and CentOS 6.
Take CentOS 7 as an example below.
git clone https://github.com/apache/hawq.git . cd hawq/contrib/hawq-docker
make pull (recommended) OR make build
(Command make pull
is to pull docker images from Docker Hub, while command make build
is to build docker images locally. In general, make pull
is faster than make build
.)
make run
Now let's have a look about what we creted.
[root@localhost hawq-docker]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 382b2b3360d1 hawq/hawq-test:centos7 "entrypoint.sh bash" 2 minutes ago Up 2 minutes centos7-datanode3 86513c331d45 hawq/hawq-test:centos7 "entrypoint.sh bash" 2 minutes ago Up 2 minutes centos7-datanode2 c0ab10e46e4a hawq/hawq-test:centos7 "entrypoint.sh bash" 2 minutes ago Up 2 minutes centos7-datanode1 e27beea63953 hawq/hawq-test:centos7 "entrypoint.sh bash" 2 minutes ago Up 2 minutes centos7-namenode 1f986959bd04 hawq/hawq-dev:centos7 "/bin/true" 2 minutes ago Created centos7-data
centos7-data is a data container and mounted to /data directory on all other containers to provide a shared storage for the cluster.
docker exec -it centos7-namenode bash
sudo -u hdfs hdfs dfsadmin -report
git clone https://github.com/apache/hawq.git /data/hawq
cd /data/hawq ./configure --prefix=/data/hawq-dev make make install
(When you are using CentOS 6, run command scl enable devtoolset-2 bash
before configuring hawq and run command exit
after installing hawq.)
sed 's|localhost|centos7-namenode|g' -i /data/hawq-dev/etc/hawq-site.xml echo 'centos7-datanode1' > /data/hawq-dev/etc/slaves echo 'centos7-datanode2' >> /data/hawq-dev/etc/slaves echo 'centos7-datanode3' >> /data/hawq-dev/etc/slaves
sudo -u hdfs hdfs dfs -chown gpadmin / source /data/hawq-dev/greenplum_path.sh hawq init cluster
Now you can connect to database with psql
command.
[gpadmin@centos7-namenode data]$ psql -d postgres psql (8.2.15) Type "help" for help. postgres=#
Usage: To setup a build and test environment: make run To start all containers: make start To stop all containers: make stop To remove hdfs containers: make clean To remove all containers: make distclean To build images locally: make build To pull latest images: make pull