Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Databases in containers

Databases in containers

A demystifying about database within modern containers presented in https://www.pgconf.com.br

Fernando ike

August 03, 2018

More Decks by Fernando ike

Other Decks in Technology


  1. Cache An auxiliary memory from which high-speed retrieval is possible.

  2. Buffer A temporary memory area in which data is stored

    while it is being processed or transferred, especially one used while streaming video or downloading audio. https://en.oxforddictionaries.com/definition/buffer
  3. What’s is Virtual Machine? “...an efficient, isolated duplicate of a

    real computer machine...” Gerald Popek and Robert Goldberg
  4. What’s container? Container is a type of virtualization, more common

    call “operating-system-level virtualization”
  5. Stateless application Applications don’t need to store anything in a

    persistent disk. Data application are storage in other part of architecture system
  6. Stateful application Application that need to store “locally” data and

    need to recover that easy after an “interruption”
  7. Union filesystem It allows files and directories of separate file

    systems, known as branches, to be transparently overlaid, forming a single coherent file system.
  8. Databases operation Plan what type of workload to use Maintain,

    organize and “improve” dataset together application Install security fix releases Archive “old” data (sanitize) Upgrade Database version Tuning OS, Database and Application
  9. Why to use PostgreSQL within containers Lower footprint to start

    Easy to change postgresql.conf and use git to have history change (tracking) Less surface attack in the “application Can “restrict” Linux Capabilities within container “Small” database by microservice Use always a Container Storage
  10. Tips One database per type of workload Take care to

    restrict network, consider restrict database access only own application Push database log to Monitoring system/service Clusters and data replication are more complex Database use intensive CPU and IO, think if there is another service with the same workload type Database is prepare to support two version of application (Deploy strategies without downtime)
  11. version: "3" services: db: image: postgres environment: - POSTGRES_USER=postgres -

    POSTGRES_PASSWORD=postgress - POSTGRES_DB=postgres ports: - "5433:5432" volumes: - pgdata:/var/lib/postgresql/data networks: - postgres volumes: pgdata: networks: postgres:
  12. • Bruce Momjian - Performance tuning • Docker Volumes •

    Kubernetes Volumes • Oxford Dictionaries • Formal requirements for virtualizable third generation architectures - Gerald J. Popek and Robert P. Goldberg • CAP Theorem and Distributed Database Management Systems References