SlideShare a Scribd company logo
Docker
• Based on containerization – in Linux kernel since 2008
• Platform to deploy and run lightweight virtualized servers
• Initial release in 2013
• explosive growth in 2014
• Becoming a de facto standard for Linux virtualization
• Evolution of purpose – core idea was a regularized one-size-
fits-all approach to managing virtualized environments.
Became an ecosystem: platform, delivery service, tools.
From this
ToThis
Container Analogy
• Shipping containers (intermodal freight containers)
• Standardized dimensions (20’ X 8’)
• Standardized hooks for hoisting and moving
• One-size-fits-all, BUT… carefully chosen to handle 98% of transportation needs
• And if it doesn’t fit, it can be made to fit (ship in pieces and reassemble – still
saves $$$)
• Docker containers
• Standardized footprint (10G filesystem by default)
• Standardized methods to deploy – doesn’t matter what’s inside
(start/stop/snapshot/export/import/destroy)
• Make it fit--many complex systems can be decomposed into orchestrated
groups of containers
Virtualization approaches
Host OS
VMWare
VirtualBox
Xen
BSD Jails
Solaris Zones
Virtual Machine Jailed System
Pros: complete
isolation, full
machine mimicry,
run any OS
Cons: performance
hit, heavyweight
deployment
Pros: native
performance, easy
deployment, full
system init
Cons: IT’S NOT
LINUX (& some
nitpicks about IPC)
Docker
CoreOS
LXC
MirageOS
???
Containers Unikernel
Pros: native
performance,
stripped down,
MANY options
Cons: Limited
interaction by design
Pros: stripped-down,
better than native
performance for
some tasks
Cons: ?? Need more
info
Case Study: Client X
• Needs
• Database-as-a-service, SaaS model
• High-throughput, update-intensive, lots of JSON data
• Replication, failover, PITR, etc…
• Flexible roll-out and deployment of many instances (some multi-tenant, some
dedicated)
• Redundancy across physical machines
• Infrastructure
• Essentially the largest x86-based servers available
• Essentially the fastest hard drive storage available
• Essentially the fastest network throughput available
• 2 Availability zones, 4 machines
OK,You want Details
• Cores: 60 (120 with hyperthreading)
• RAM 3TB (with parity)
• Onboard storage
• 200G SATA array (OS and applications)
• 3TB FusionIO IODrive2 RAID ($PGDATA, indexes, WAL)
• Remote storage
• 55TB Invicta SSD SAN array (Other tablespaces, logs, diff. backup)
• Dual 55TB NFS-mounted backup arrays (Backup archives)
• Network
• Multiple 40GbE NIC (database replication, SSD storage)
• Multiple 10GbE NIC (backup and remote replication)
• Dual 1GbE NIC (admin network)
What does that look like?
What does that look like?
Judgment Call:
• Treat your containers
• like a full VM?
• like a single service box?
• The “Docker way” is single service box
• You do not perform “server maintenance”
• No sysinit, no syslogd, no cron
• All important data (including logs) mapped to external volumes
• Processes can be started, stopped, restarted from outside the container
• Applications don’t interact inside a container
• Limited shell access (only by root from host, via docker exec, docker attach)
• Reasons to emulate full VM
• Software architecture expectations (EDB Postgres Plus)
• SSH allows administrators to connect to containers rather than host
• Paradigm comfort
• A little rebellion is a good thing now and then
Considerations for Postgres
• Docker internal filesystem is UnionFS
• Great for versioning, snapshotting… slow
• Limited by default to 10GB, defined in docker daemon (one size fits all)
• Ergo – use mapped volumes for any actual work
• Doing things the Docker Way
• No SSH means no modifying postgresql.conf or pg_hba.conf
• Can modify many settings via queries, but not pg_hba.conf
• No restart/reload (just spin up another container) – kind of a pain for simple
modifications
• Doing things the Full VM way
• Still not perfect – init is not the same
• Either use custom init like runit or script your start/stop from the outside via
SSH or nsenter (only applies when starting/stopping the whole container)
Working with Docker
• Containers are based on images (filesystem snapshots)
• Images are containerized versions of a Linux OS
• Can be just a base distro
• Can be a distro+specialized application installed
• Can be any of the above, + any set of files you want on the Union FS
• Images can be fetched from Docker Registry, or built
• Containers are instantiated images
• BUT
• Containers can be saved as images, via docker commit
Docker as aVM
• Found several examples of Docker images with full system init
on Docker Registry (https://registry.hub.docker.com)
• Not perfect
• Could not run a real SysV init (for reasons intrinsic to Docker)
• Settled on runit as the init manager—good for standard services like syslogd,
cron, sshd, not good for Postgres
• But, a starting point
• In the end, built custom image from scratch using the
joliva/centos-baseimage as an example
• Wanted to base it on Oracle Enterprise Linux instead of
CentOS
• Copied Dockerfile, made changes, applied to bare OEL image
Reasons for custom image
• Images pulled from Docker Registry are not secure.
• Even now, with “signed images” the situation is not resolved
• Wanted to be sure we understood all components
• Yes, even so, we had to trust the bare OEL image (security via
locked-down network)
Docker ImageWorkflow
Iterative development to tweak an image
1. Pull a base image to start with, or build your own via
Dockerfile
2. Launch a container based on that image
3. Modify that container however you want
4. Commit that container as a new image
5. Repeat
ContainerImage
Dev Pre Prod
Docker annoyances
• All containers depend on the docker daemon
• More than just an annoyance—stability and availability issue
• Many files in /etc cannot be modified
• Can be hacked by finding container FS on host and modifying
• SSH hostname lookup had to be turned off this way
• BUT, do it once and then commit image and all is good.
• In order to present services on a dedicated IP address and
port, container must be run in –privileged mode (security and
stability implications)
• Docker 1.2 + allows for finer-grained capabilities
• Also, port forwarding must be enabled in host kernel
• net.ipv4.conf.all.forwarding = 1
Docker benefits
• Mapped volumes make life easy
• Default paths inside, custom paths outside
• Port mapping makes life easy
• Default port inside, custom port outside
• Container snapshotting makes life easy
• 1-second startup times makes life easy
docker run 
–v [external filesystem path1]:[internal filesystem path] 
–p [external ip address]:[external port]:[internal port] 
–h [hostname] 
--name [container name] 
--privileged [Docker image] 
[initialization command] &
Why containers over instances?
• Yes, we could have just run many parallel instances of Postgres in
the host.
• How many people here have done that?
• Was it fun?
• Let’s count the ways
With Docker:
• Outer host system is “clean”, only concerned with data files.
• The Postgres installations didn’t have to “know” anything about
outer environment
• Default paths, ports, etc… did not need to be changed. ALL
DEFAULTS = easy.
• If a container has a problem, spin up another one using the same
mapped volumes.
Final system
NOC 1
Server 1 – R/W Primary
Server 2 – R/O Standby
PgPool Dev
PgPool Pre
PgPool Prod
PgPool Dev
PgPool Pre
PgPool Prod
PG Dev
PG Pre
PG Prod
PG Dev
PG Pre
PG Prod
NOC 2
Server 3 - R/O Standby
Server 4 - R/O Standby
PgPool Dev
PgPool Pre
PgPool Prod
PgPool Dev
PgPool Pre
PgPool Prod
PG Dev
PG Pre
PG Prod
PG Dev
PG Pre
PG Prod
Final system
NOC 1
Server 1 – R/W Primary
Server 2 – R/O Standby
PgPool Dev
PgPool Pre
PgPool Prod
PgPool Dev
PgPool Pre
PgPool Prod
PG Dev
PG Pre
PG Prod
PG Dev
PG Pre
PG Prod
NOC 2
Server 3 - R/O Standby
Server 4 - R/O Standby
PgPool Dev
PgPool Pre
PgPool Prod
PgPool Dev
PgPool Pre
PgPool Prod
PG Dev
PG Pre
PG Prod
PG Dev
PG Pre
PG Prod
SSH:22
PgPool:9000
Pg:5432
Things to remember
• If you want full VM style, it will cost you (time, frustration)
• If you want external networking, it will take elevated
privileges in host and containers
• Port forwarding turned on in host
• --privileged, or --cap-add in container
• Mapped volumes need same uid/gid inside and out.
• Clock is the same inside and out, but time zone can differ.
• User in privileged container can set system clock.
• Set your /etc/security/limits.conf and /etc/sysctl.conf in host
• ALSO Set your /etc/security/limits.conf and /etc/sysctl.conf in
container
• Run sysctl -p /etc/sysctl.conf EVERY TIME you
start/restart a container.
The future of Docker for PostgreSQLThe future of Docker for PostgreSQL
The future of Docker for
PostgreSQL
• Docker isn’t going away, anytime soon
• Postgres community involvement
• Docker PostgreSQL builds – many in registry hub.

More Related Content

What's hot

Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Alan Forbes
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
ViSenze - Artificial Intelligence for the Visual Web
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
psconnolly
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
Liang Bo
 
Understand how docker works
Understand how docker worksUnderstand how docker works
Understand how docker works
Justin Li
 
Why we need container in Software
Why we need container in SoftwareWhy we need container in Software
Why we need container in Software
Thach Nguyen
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
Adrian Otto
 
Docker - From Walking To Running
Docker - From Walking To RunningDocker - From Walking To Running
Docker - From Walking To Running
Giacomo Vacca
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
Runcy Oommen
 
Evoluation of Linux Container Virtualization
Evoluation of Linux Container VirtualizationEvoluation of Linux Container Virtualization
Evoluation of Linux Container Virtualization
Imesh Gunaratne
 
KVM and docker LXC Benchmarking with OpenStack
KVM and docker LXC Benchmarking with OpenStackKVM and docker LXC Benchmarking with OpenStack
KVM and docker LXC Benchmarking with OpenStack
Boden Russell
 
Performance characteristics of traditional v ms vs docker containers (dockerc...
Performance characteristics of traditional v ms vs docker containers (dockerc...Performance characteristics of traditional v ms vs docker containers (dockerc...
Performance characteristics of traditional v ms vs docker containers (dockerc...
Boden Russell
 
Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302
Boden Russell
 
Cassandra and docker
Cassandra and dockerCassandra and docker
Cassandra and docker
Ben Bromhead
 
Containerization and Docker
Containerization and DockerContainerization and Docker
Containerization and Docker
Megha Bansal
 
Docker for the new Era: Introducing Docker,its components and tools
Docker for the new Era: Introducing Docker,its components and toolsDocker for the new Era: Introducing Docker,its components and tools
Docker for the new Era: Introducing Docker,its components and tools
Ramit Surana
 
Cgroups, namespaces and beyond: what are containers made from?
Cgroups, namespaces and beyond: what are containers made from?Cgroups, namespaces and beyond: what are containers made from?
Cgroups, namespaces and beyond: what are containers made from?
Docker, Inc.
 
Docker
DockerDocker
Introduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @TwitterIntroduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @Twitter
dotCloud
 
NeXTBSD aka FreeBSD X
NeXTBSD aka FreeBSD XNeXTBSD aka FreeBSD X
NeXTBSD aka FreeBSD X
iXsystems
 

What's hot (20)

Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Understand how docker works
Understand how docker worksUnderstand how docker works
Understand how docker works
 
Why we need container in Software
Why we need container in SoftwareWhy we need container in Software
Why we need container in Software
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
 
Docker - From Walking To Running
Docker - From Walking To RunningDocker - From Walking To Running
Docker - From Walking To Running
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Evoluation of Linux Container Virtualization
Evoluation of Linux Container VirtualizationEvoluation of Linux Container Virtualization
Evoluation of Linux Container Virtualization
 
KVM and docker LXC Benchmarking with OpenStack
KVM and docker LXC Benchmarking with OpenStackKVM and docker LXC Benchmarking with OpenStack
KVM and docker LXC Benchmarking with OpenStack
 
Performance characteristics of traditional v ms vs docker containers (dockerc...
Performance characteristics of traditional v ms vs docker containers (dockerc...Performance characteristics of traditional v ms vs docker containers (dockerc...
Performance characteristics of traditional v ms vs docker containers (dockerc...
 
Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302
 
Cassandra and docker
Cassandra and dockerCassandra and docker
Cassandra and docker
 
Containerization and Docker
Containerization and DockerContainerization and Docker
Containerization and Docker
 
Docker for the new Era: Introducing Docker,its components and tools
Docker for the new Era: Introducing Docker,its components and toolsDocker for the new Era: Introducing Docker,its components and tools
Docker for the new Era: Introducing Docker,its components and tools
 
Cgroups, namespaces and beyond: what are containers made from?
Cgroups, namespaces and beyond: what are containers made from?Cgroups, namespaces and beyond: what are containers made from?
Cgroups, namespaces and beyond: what are containers made from?
 
Docker
DockerDocker
Docker
 
Introduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @TwitterIntroduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @Twitter
 
NeXTBSD aka FreeBSD X
NeXTBSD aka FreeBSD XNeXTBSD aka FreeBSD X
NeXTBSD aka FreeBSD X
 

Viewers also liked

Elizabeth leon powerpoint motivation
Elizabeth leon powerpoint motivationElizabeth leon powerpoint motivation
Elizabeth leon powerpoint motivationLiz0418
 
English basics spelling rules
English basics   spelling rulesEnglish basics   spelling rules
English basics spelling rules
Kevin Baxter, Cert ED, QTLS
 
Writing basics
Writing basicsWriting basics
Writing basics
lbrook
 
Fundamentals of music onlinestudents compressed
Fundamentals of music onlinestudents compressedFundamentals of music onlinestudents compressed
Fundamentals of music onlinestudents compressed
dyneeifertsen
 
Teaching spelling
Teaching spellingTeaching spelling
Teaching spellingitsdanimoe
 
Interview Behaviour and Body Language
Interview Behaviour and Body LanguageInterview Behaviour and Body Language
Interview Behaviour and Body Language
Learn By Watch
 
Body language, etiquette, interview skills
Body language, etiquette, interview skillsBody language, etiquette, interview skills
Body language, etiquette, interview skillsmortress
 
India Festival of Colors 2013
India Festival of Colors 2013India Festival of Colors 2013
India Festival of Colors 2013maditabalnco
 
Politeness And Interaction, By Dr.Shadia.Pptx
Politeness And Interaction, By Dr.Shadia.PptxPoliteness And Interaction, By Dr.Shadia.Pptx
Politeness And Interaction, By Dr.Shadia.Pptx
Dr. Shadia Banjar
 
Pragmatic politeness
Pragmatic politenessPragmatic politeness
Pragmatic politeness
Indra Malasyah
 
MOTIVATION POWERPOINT
MOTIVATION POWERPOINTMOTIVATION POWERPOINT
MOTIVATION POWERPOINT
Andrew Schwartz
 

Viewers also liked (15)

My Image and Me
My Image and MeMy Image and Me
My Image and Me
 
Elizabeth leon powerpoint motivation
Elizabeth leon powerpoint motivationElizabeth leon powerpoint motivation
Elizabeth leon powerpoint motivation
 
English basics spelling rules
English basics   spelling rulesEnglish basics   spelling rules
English basics spelling rules
 
Writing basics
Writing basicsWriting basics
Writing basics
 
Fundamentals of music onlinestudents compressed
Fundamentals of music onlinestudents compressedFundamentals of music onlinestudents compressed
Fundamentals of music onlinestudents compressed
 
Whole hearted commitment!
Whole hearted commitment!Whole hearted commitment!
Whole hearted commitment!
 
Student motivation powerpoint 3
Student motivation powerpoint 3Student motivation powerpoint 3
Student motivation powerpoint 3
 
Teaching spelling
Teaching spellingTeaching spelling
Teaching spelling
 
Interview Behaviour and Body Language
Interview Behaviour and Body LanguageInterview Behaviour and Body Language
Interview Behaviour and Body Language
 
Body language, etiquette, interview skills
Body language, etiquette, interview skillsBody language, etiquette, interview skills
Body language, etiquette, interview skills
 
India Festival of Colors 2013
India Festival of Colors 2013India Festival of Colors 2013
India Festival of Colors 2013
 
Politeness And Interaction, By Dr.Shadia.Pptx
Politeness And Interaction, By Dr.Shadia.PptxPoliteness And Interaction, By Dr.Shadia.Pptx
Politeness And Interaction, By Dr.Shadia.Pptx
 
Pragmatic politeness
Pragmatic politenessPragmatic politeness
Pragmatic politeness
 
Motivation ppt
Motivation pptMotivation ppt
Motivation ppt
 
MOTIVATION POWERPOINT
MOTIVATION POWERPOINTMOTIVATION POWERPOINT
MOTIVATION POWERPOINT
 

Similar to Docking postgres

Docker introduction
Docker introductionDocker introduction
Docker introduction
Walter Liu
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable Infrastructure
Adrian Otto
 
Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015
Jérôme Petazzoni
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Docker
nklmish
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
Ravindu Fernando
 
Postgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh ShahPostgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh Shah
PivotalOpenSourceHub
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
Jignesh Shah
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
Dongwon Kim
 
A Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersA Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersDocker, Inc.
 
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2
John Heaton
 
Live Container Migration: OpenStack Summit Barcelona 2016
Live Container Migration: OpenStack Summit Barcelona 2016Live Container Migration: OpenStack Summit Barcelona 2016
Live Container Migration: OpenStack Summit Barcelona 2016
Phil Estes
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
Gaetano Giunta
 
Docker and the Linux Kernel
Docker and the Linux KernelDocker and the Linux Kernel
Docker and the Linux Kernel
Docker, Inc.
 
[NYC Meetup] Docker at Nuxeo
[NYC Meetup] Docker at Nuxeo[NYC Meetup] Docker at Nuxeo
[NYC Meetup] Docker at Nuxeo
Nuxeo
 
Stateless Hypervisors at Scale
Stateless Hypervisors at ScaleStateless Hypervisors at Scale
Stateless Hypervisors at Scale
Antony Messerl
 
The State of Rootless Containers
The State of Rootless ContainersThe State of Rootless Containers
The State of Rootless Containers
Akihiro Suda
 
Containing the world with Docker
Containing the world with DockerContaining the world with Docker
Containing the world with Docker
Giuseppe Piccolo
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
Jo Ee Liew
 

Similar to Docking postgres (20)

Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable Infrastructure
 
Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015
 
Docker_AGH_v0.1.3
Docker_AGH_v0.1.3Docker_AGH_v0.1.3
Docker_AGH_v0.1.3
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Docker
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 
Postgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh ShahPostgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh Shah
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
A Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersA Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and Containers
 
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2
 
Live Container Migration: OpenStack Summit Barcelona 2016
Live Container Migration: OpenStack Summit Barcelona 2016Live Container Migration: OpenStack Summit Barcelona 2016
Live Container Migration: OpenStack Summit Barcelona 2016
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
 
Docker and the Linux Kernel
Docker and the Linux KernelDocker and the Linux Kernel
Docker and the Linux Kernel
 
[NYC Meetup] Docker at Nuxeo
[NYC Meetup] Docker at Nuxeo[NYC Meetup] Docker at Nuxeo
[NYC Meetup] Docker at Nuxeo
 
Stateless Hypervisors at Scale
Stateless Hypervisors at ScaleStateless Hypervisors at Scale
Stateless Hypervisors at Scale
 
The State of Rootless Containers
The State of Rootless ContainersThe State of Rootless Containers
The State of Rootless Containers
 
Containing the world with Docker
Containing the world with DockerContaining the world with Docker
Containing the world with Docker
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 

Recently uploaded

Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 

Recently uploaded (20)

Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 

Docking postgres

  • 1.
  • 2. Docker • Based on containerization – in Linux kernel since 2008 • Platform to deploy and run lightweight virtualized servers • Initial release in 2013 • explosive growth in 2014 • Becoming a de facto standard for Linux virtualization • Evolution of purpose – core idea was a regularized one-size- fits-all approach to managing virtualized environments. Became an ecosystem: platform, delivery service, tools.
  • 5. Container Analogy • Shipping containers (intermodal freight containers) • Standardized dimensions (20’ X 8’) • Standardized hooks for hoisting and moving • One-size-fits-all, BUT… carefully chosen to handle 98% of transportation needs • And if it doesn’t fit, it can be made to fit (ship in pieces and reassemble – still saves $$$) • Docker containers • Standardized footprint (10G filesystem by default) • Standardized methods to deploy – doesn’t matter what’s inside (start/stop/snapshot/export/import/destroy) • Make it fit--many complex systems can be decomposed into orchestrated groups of containers
  • 6. Virtualization approaches Host OS VMWare VirtualBox Xen BSD Jails Solaris Zones Virtual Machine Jailed System Pros: complete isolation, full machine mimicry, run any OS Cons: performance hit, heavyweight deployment Pros: native performance, easy deployment, full system init Cons: IT’S NOT LINUX (& some nitpicks about IPC) Docker CoreOS LXC MirageOS ??? Containers Unikernel Pros: native performance, stripped down, MANY options Cons: Limited interaction by design Pros: stripped-down, better than native performance for some tasks Cons: ?? Need more info
  • 7. Case Study: Client X • Needs • Database-as-a-service, SaaS model • High-throughput, update-intensive, lots of JSON data • Replication, failover, PITR, etc… • Flexible roll-out and deployment of many instances (some multi-tenant, some dedicated) • Redundancy across physical machines • Infrastructure • Essentially the largest x86-based servers available • Essentially the fastest hard drive storage available • Essentially the fastest network throughput available • 2 Availability zones, 4 machines
  • 8. OK,You want Details • Cores: 60 (120 with hyperthreading) • RAM 3TB (with parity) • Onboard storage • 200G SATA array (OS and applications) • 3TB FusionIO IODrive2 RAID ($PGDATA, indexes, WAL) • Remote storage • 55TB Invicta SSD SAN array (Other tablespaces, logs, diff. backup) • Dual 55TB NFS-mounted backup arrays (Backup archives) • Network • Multiple 40GbE NIC (database replication, SSD storage) • Multiple 10GbE NIC (backup and remote replication) • Dual 1GbE NIC (admin network)
  • 9. What does that look like?
  • 10. What does that look like?
  • 11. Judgment Call: • Treat your containers • like a full VM? • like a single service box? • The “Docker way” is single service box • You do not perform “server maintenance” • No sysinit, no syslogd, no cron • All important data (including logs) mapped to external volumes • Processes can be started, stopped, restarted from outside the container • Applications don’t interact inside a container • Limited shell access (only by root from host, via docker exec, docker attach) • Reasons to emulate full VM • Software architecture expectations (EDB Postgres Plus) • SSH allows administrators to connect to containers rather than host • Paradigm comfort • A little rebellion is a good thing now and then
  • 12. Considerations for Postgres • Docker internal filesystem is UnionFS • Great for versioning, snapshotting… slow • Limited by default to 10GB, defined in docker daemon (one size fits all) • Ergo – use mapped volumes for any actual work • Doing things the Docker Way • No SSH means no modifying postgresql.conf or pg_hba.conf • Can modify many settings via queries, but not pg_hba.conf • No restart/reload (just spin up another container) – kind of a pain for simple modifications • Doing things the Full VM way • Still not perfect – init is not the same • Either use custom init like runit or script your start/stop from the outside via SSH or nsenter (only applies when starting/stopping the whole container)
  • 13. Working with Docker • Containers are based on images (filesystem snapshots) • Images are containerized versions of a Linux OS • Can be just a base distro • Can be a distro+specialized application installed • Can be any of the above, + any set of files you want on the Union FS • Images can be fetched from Docker Registry, or built • Containers are instantiated images • BUT • Containers can be saved as images, via docker commit
  • 14. Docker as aVM • Found several examples of Docker images with full system init on Docker Registry (https://registry.hub.docker.com) • Not perfect • Could not run a real SysV init (for reasons intrinsic to Docker) • Settled on runit as the init manager—good for standard services like syslogd, cron, sshd, not good for Postgres • But, a starting point • In the end, built custom image from scratch using the joliva/centos-baseimage as an example • Wanted to base it on Oracle Enterprise Linux instead of CentOS • Copied Dockerfile, made changes, applied to bare OEL image
  • 15. Reasons for custom image • Images pulled from Docker Registry are not secure. • Even now, with “signed images” the situation is not resolved • Wanted to be sure we understood all components • Yes, even so, we had to trust the bare OEL image (security via locked-down network)
  • 16. Docker ImageWorkflow Iterative development to tweak an image 1. Pull a base image to start with, or build your own via Dockerfile 2. Launch a container based on that image 3. Modify that container however you want 4. Commit that container as a new image 5. Repeat ContainerImage Dev Pre Prod
  • 17. Docker annoyances • All containers depend on the docker daemon • More than just an annoyance—stability and availability issue • Many files in /etc cannot be modified • Can be hacked by finding container FS on host and modifying • SSH hostname lookup had to be turned off this way • BUT, do it once and then commit image and all is good. • In order to present services on a dedicated IP address and port, container must be run in –privileged mode (security and stability implications) • Docker 1.2 + allows for finer-grained capabilities • Also, port forwarding must be enabled in host kernel • net.ipv4.conf.all.forwarding = 1
  • 18. Docker benefits • Mapped volumes make life easy • Default paths inside, custom paths outside • Port mapping makes life easy • Default port inside, custom port outside • Container snapshotting makes life easy • 1-second startup times makes life easy docker run –v [external filesystem path1]:[internal filesystem path] –p [external ip address]:[external port]:[internal port] –h [hostname] --name [container name] --privileged [Docker image] [initialization command] &
  • 19. Why containers over instances? • Yes, we could have just run many parallel instances of Postgres in the host. • How many people here have done that? • Was it fun? • Let’s count the ways With Docker: • Outer host system is “clean”, only concerned with data files. • The Postgres installations didn’t have to “know” anything about outer environment • Default paths, ports, etc… did not need to be changed. ALL DEFAULTS = easy. • If a container has a problem, spin up another one using the same mapped volumes.
  • 20. Final system NOC 1 Server 1 – R/W Primary Server 2 – R/O Standby PgPool Dev PgPool Pre PgPool Prod PgPool Dev PgPool Pre PgPool Prod PG Dev PG Pre PG Prod PG Dev PG Pre PG Prod NOC 2 Server 3 - R/O Standby Server 4 - R/O Standby PgPool Dev PgPool Pre PgPool Prod PgPool Dev PgPool Pre PgPool Prod PG Dev PG Pre PG Prod PG Dev PG Pre PG Prod
  • 21. Final system NOC 1 Server 1 – R/W Primary Server 2 – R/O Standby PgPool Dev PgPool Pre PgPool Prod PgPool Dev PgPool Pre PgPool Prod PG Dev PG Pre PG Prod PG Dev PG Pre PG Prod NOC 2 Server 3 - R/O Standby Server 4 - R/O Standby PgPool Dev PgPool Pre PgPool Prod PgPool Dev PgPool Pre PgPool Prod PG Dev PG Pre PG Prod PG Dev PG Pre PG Prod SSH:22 PgPool:9000 Pg:5432
  • 22. Things to remember • If you want full VM style, it will cost you (time, frustration) • If you want external networking, it will take elevated privileges in host and containers • Port forwarding turned on in host • --privileged, or --cap-add in container • Mapped volumes need same uid/gid inside and out. • Clock is the same inside and out, but time zone can differ. • User in privileged container can set system clock. • Set your /etc/security/limits.conf and /etc/sysctl.conf in host • ALSO Set your /etc/security/limits.conf and /etc/sysctl.conf in container • Run sysctl -p /etc/sysctl.conf EVERY TIME you start/restart a container. The future of Docker for PostgreSQLThe future of Docker for PostgreSQL
  • 23. The future of Docker for PostgreSQL • Docker isn’t going away, anytime soon • Postgres community involvement • Docker PostgreSQL builds – many in registry hub.