greenplum database docker 운용 :

Running GPDB using Docker

A look into how the GPDB R&D team uses Docker to increase development consistency.

 

 

Compiling in different environments is an incredibly frustrating hurdle in the development process. To combat this, the GPDB R&D team uses Docker to improve workflow speed and consistency. Docker pushes for a standard compilation environment for GPDB users, sidestepping the compilation confusions that often pop up. Through Docker, the GPDB R&D team synchronizes after the development stage and easily compares results in the Docker-run environment. Testing is also expedited due to the consistent and streamlined nature of Docker. | What is Docker? | Basic Overview |

Getting Started with Docker

Docker is composed of three core elements: dockerfiles, images, and containers. A dockerfile provides command-line instructions which are used to build an image. An image is a collection of root filesystem changes and the corresponding execution parameters for use in runtime [1], and is read-only. Finally, a container is the stateful instance of an image [2]. GPDB runs inside the container, but is compiled when the image is constructed. The GPDB dockerfile, the initial piece of the puzzle, was recently added to master, so it is easier than ever to get Docker and GPDB running.

Step 1: Gather Resources

Two important tools are needed to run GPDB on Docker: Docker and VirtualBox. VirtualBox manages virtual machines, which is where we will run our instance of GPDB. Detailed installation guides are on their websites.

Downloads: Docker | VirtualBox

We also need a Github repository: GPDB Master. This repo contains the GPDB source files in addition to the dockerfile. There is also a GPDB Dockerhub repository, found here. The following commands clone and update GPDB master, but feel free to employ your own Git routine for these steps.

# Clone
git clone git@github.com:greenplum-db/gpdb.git

# Update
git fetch --all
git checkout -b [BRANCH_NAME]
git pull --rebase origin master

Step 2: Create your virtual environment

In order to create a Docker container, inside of which we will run an instance of the database, we need to create a virtual space for our container to go into. We can do so through VirtualBox. In this step, make sure not to over-allocate resources.

# Create virtual machine
docker-machine create -d virtualbox --virtualbox-cpu-count 2 --virtualbox-disk-size 50000 --virtualbox-memory 4096 gpdb

# Set environment variables for Docker
eval $(docker-machine env gpdb)

Step 3: Build and run the Docker image

We will use the dockerfile to build an image. Note that when we build, GPDB will compile and install. Beforehand, we need to update submodules. After entering the run command, we will immediately be inside of the container.

If you run into an error, you may need to add “RUN yum -y install wget” to /docker/base/dockerfile. Also, you may need to be connected to ethernet.

# Update submodules
git submodule update --init --recursive

# Build Docker image
docker build -t pivotaldata/gpdb-devel -f ./src/tools/docker/[base]/Dockerfile .

# Run Docker image
docker run -it pivotaldata/gpdb-devel

Step 4: Starting GPDB

Now that we are inside of the container, we are able to work with the database itself. We do not need to compile GPDB because it was already done for us when we built the image, so all we have to do is make our database. There are a few different ways to do this, but easiest is creating a GPDB demo cluster. Since the update, the ‘su gpadmin’ command also runs the ‘make cluster’ command, in addition to a few others. After entering the below, a demo cluster will run.

# Prerequisites and make cluster
su gpadmin 

# Install check
make installcheck-good

# Quick test
createdb test 
psql test

Congratulations! An instance of GPDB is running inside of the Docker container. From here, the steps will cover using your Docker image and making changes to GPDB.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

Step 5: Using Docker images and containers

Exiting your Docker container stops it, however it still exists. Periodically remove unnecessary containers and/or images so as to not waste disk space. Another thing to note is that containers maintain changes, even when exited. To maintain changes after deleting a container, first commit the changes to the Docker image.

Using the Docker command line

# Show running containers
docker ps

# Show all containers
docker ps -a

# Start a container and enter it
docker start [CONTAINER_ID]
docker attach [CONTAINER_ID]

# Commit changes in container to image
docker commit

# Remove container
docker rm [CONTAINER_ID]

To reuse the same image, simply enter ‘docker run -it IMAGE_ID’. This does not include changes from the remote repository. There are a few different ways to include those changes, but the following is one example:

cd $HOME/workspace/gpdb
git status
git checkout -b [BRANCH_NAME]
git pull --rebase origin master
eval $(docker-machine env gpdb)
docker build .
docker run -it pivotaldata/gpdb-devel

Step 6: Compiling and making changes

The GPDB R&D team uses Docker to compile uniformly. If you want to alter the source code, the best practice is to make the changes outside of Docker, then build a brand new image. When the new image is built, the altered GPDB will be compiled, installed and ready to run. Below are example steps for this process:

# Clone repo
git clone git@github.com:greenplum-db/gpdb.git
git checkout -b [BRANCH_NAME]

# After a source code change
docker build .
docker run -it pivotaldata/gpdb-devel

# Committing changes to remote
git add [FILE_NAME]
git commit -m 'Message'
git push origin [BRANCH_NAME]

Step 7: Volumes

Volumes allow you to save and persist data across containers. A volume is basically a directory outside of the default file system and exists on the host file system. They are a great way to maintain changes when working with multiple containers. A full explanation and guide can be found below:

Guides to Volumes: What are volumes? | Commands

Conclusion

Within the GPDB R&D team, Docker is used to improve overall consistency through a uniform compilation environment. Each team member is able to develop in their own way and still end up in the same place, which is incredibly helpful in the iterative process. If inconsistent compilation environments is an issue for you, Docker is worth a try.

 

[출처] https://engineering.pivotal.io/post/docker-gpdb/

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
공지 오라클 기본 샘플 데이터베이스 졸리운_곰 2014.01.02 86772
공지 [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE 가을의 곰을... 2013.02.10 79083
공지 [G_SQL] Sample Database 가을의 곰을... 2012.05.20 95845
38 버트(BERT) 파인튜닝 간단하게 해보자 file 졸리운_곰 2019.09.01 1275
37 Quick Start to TensorFlow in Docker with a GUI file 졸리운_곰 2019.05.05 1058
36 What is Deep Learning ? 딥러닝에 대한 간략한 정리 file 졸리운_곰 2019.04.04 1274
35 tensorflow로 rest api 서비스구축 : Creating REST API for TensorFlow models file 졸리운_곰 2018.12.05 1590
34 kor-char-rnn-tensorflow 한글텍스트 RNN 학습 텐서플로우 file 졸리운_곰 2018.09.06 1247
33 torch lua install on ubuntu 16.04 LTS [machine learning] 졸리운_곰 2018.08.13 1616
32 머신러닝 초보자에게 바치는 5가지 “하지 마라” 시리즈 졸리운_곰 2018.07.13 1016
31 Get Started With Keras For Beginners 졸리운_곰 2018.07.11 1257
30 한글 데이터 머신러닝 및 word2vec을 이용한 유사도 분석 file 졸리운_곰 2018.07.06 1003
29 Awesome TensorFlow 텐서플로우 예제와 활용예들 졸리운_곰 2018.07.04 1198
28 A simple deep learning model for stock price prediction using TensorFlow file 졸리운_곰 2018.07.03 1100
27 Text Generation With LSTM Recurrent Neural Networks in Python with Keras 졸리운_곰 2018.07.02 1279
26 Easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code. file 졸리운_곰 2018.07.02 1437
25 Recurrent Neural Network for Text Calssification file 졸리운_곰 2018.07.02 1651
24 char-rnn-tensorflow file 졸리운_곰 2018.07.02 1242
23 TensorFlow-Char-RNN file 졸리운_곰 2018.07.02 1240
22 Install TensorFlow with GPU Support the Easy Way on Ubuntu 18.04 (without installing CUDA) file 졸리운_곰 2018.06.25 1074
21 A step by Step Guide to Install Tensorflow GPU on Ubuntu 18.04 LTS file 졸리운_곰 2018.06.25 968
20 Lessons from installing TensorFlow 1.7 for NVIDIA GPU on a Samsung Odyssey running Ubuntu 17.10 file 졸리운_곰 2018.06.20 1073
19 CNTK 설치 및 테스트 file 졸리운_곰 2018.06.11 1194
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED