PostgreSQL® Archives - Page 2 of 2 - credativ®

Yesterday, the fourth beta of the upcoming PostgreSQL®-major version 12 was released.

Compared to its predecessor PostgreSQL® 11, there are many new features:

Of course, PostgreSQL® 12 will be tested using sqlsmith, the SQL “fuzzer” from our colleague Andreas Seltenreich. Numerous bugs in different PostgreSQL® versions were found with sqlsmith by using randomly generated SQL queries.

Debian and Ubuntu packages for PostgreSQL® 12 are going to be published on apt.postgresql.org with credativ’s help. This work will be handled by our colleague Christoph Berg.

The release of PostgreSQL® 12 is expected in the next weeks.

In this article we will look at the highly available operation of PostgreSQL® in a Kubernetes environment. A topic that is certainly of particular interest to many of our PostgreSQL® users.

Together with our partner company MayaData, we will demonstrate below the application possibilities and advantages of the extremely powerful open source project – OpenEBS.

OpenEBS is a freely available storage management system, whose development is supported and backed by MayaData.

We would like to thank Murat-Karslioglu from MayaData and our colleague Adrian Vondendriesch for this interesting and helpful article. This article simultaneously also appeared on OpenEBS.io.

PostgreSQL® anywhere — via Kubernetes with some help from OpenEBS and credativ engineering

by Murat Karslioglu, OpenEBS and Adrian Vondendriesch, credativ

Introduction

If you are already running Kubernetes on some form of cloud whether on-premises or as a service, you understand the ease-of-use, scalability and monitoring benefits of Kubernetes — and you may well be looking at how to apply those benefits to the operation of your databases.

PostgreSQL® remains a preferred relational database, and although setting up a highly available Postgres cluster from scratch might be challenging at first, we are seeing patterns emerging that allow PostgreSQL® to run as a first class citizen within Kubernetes, improving availability, reducing management time and overhead, and limiting cloud or data center lock-in.

There are many ways to run high availability with PostgreSQL®; for a list, see the PostgreSQL® Documentation. Some common cloud-native Postgres cluster deployment projects include Crunchy Data’s, Sorint.lab’s Stolon and Zalando’s Patroni/Spilo. Thus far we are seeing Zalando’s operator as a preferred solution in part because it seems to be simpler to understand and we’ve seen it operate well.

Some quick background on your authors:

  • OpenEBS is a broadly deployed OpenSource storage and storage management project sponsored by MayaData.
  • credativ is a leading open source support and engineering company with particular depth in PostgreSQL®.

In this blog, we’d like to briefly cover how using cloud-native or “container attached” storage can help in the deployment and ongoing operations of PostgreSQL® on Kubernetes. This is the first of a series of blogs we are considering — this one focuses more on why users are adopting this pattern and future ones will dive more into the specifics of how they are doing so.

At the end you can see how to use a Storage Class and a preferred operator to deploy PostgreSQL® with OpenEBS underlying

If you are curious about what container attached storage of CAS is you can read more from the Cloud Native Computing Foundation (CNCF) here.

Conceptually you can think of CAS as being the decomposition of previously monolithic storage software into containerized microservices that themselves run on Kubernetes. This gives all the advantages of running Kubernetes that already led you to run Kubernetes — now applied to the storage and data management layer as well. Of special note is that like Kubernetes, OpenEBS runs anywhere so the same advantages below apply whether on on-premises or on any of the many hosted Kubernetes services.

PostgreSQL® plus OpenEBS

®-with-OpenEBS-persistent-volumes.png”>Postgres-Operator (for cluster deployment)

  • Docker installed
  • Kubernetes 1.9+ cluster installed
  • kubectl installed
  • OpenEBS installed
  • Install OpenEBS

    1. If OpenEBS is not installed in your K8s cluster, this can be done from here. If OpenEBS is already installed, go to the next step.
    2. Connect to MayaOnline (Optional): Connecting the Kubernetes cluster to MayaOnline provides good visibility of storage resources. MayaOnline has various support options for enterprise customers.

    Configure cStor Pool

    1. If cStor Pool is not configured in your OpenEBS cluster, this can be done from here. As PostgreSQL® is a StatefulSet application, it requires a single storage replication factor. If you prefer additional redundancy you can always increase the replica count to 3.
      During cStor Pool creation, make sure that the maxPools parameter is set to >=3. If a cStor pool is already configured, go to the next step. Sample YAML named openebs-config.yaml for configuring cStor Pool is provided in the Configuration details below.

    openebs-config.yaml

    #Use the following YAMLs to create a cStor Storage Pool.
    # and associated storage class.
    apiVersion: openebs.io/v1alpha1
    kind: StoragePoolClaim
    metadata:
     name: cstor-disk
    spec:
     name: cstor-disk
     type: disk
     poolSpec:
     poolType: striped
     # NOTE — Appropriate disks need to be fetched using `kubectl get disks`
     #
     # `Disk` is a custom resource supported by OpenEBS with `node-disk-manager`
     # as the disk operator
    # Replace the following with actual disk CRs from your cluster `kubectl get disks`
    # Uncomment the below lines after updating the actual disk names.
     disks:
     diskList:
    # Replace the following with actual disk CRs from your cluster from `kubectl get disks`
    # — disk-184d99015253054c48c4aa3f17d137b1
    # — disk-2f6bced7ba9b2be230ca5138fd0b07f1
    # — disk-806d3e77dd2e38f188fdaf9c46020bdc
    # — disk-8b6fb58d0c4e0ff3ed74a5183556424d
    # — disk-bad1863742ce905e67978d082a721d61
    # — disk-d172a48ad8b0fb536b9984609b7ee653
     — -

    Create Storage Class

    1. You must configure a StorageClass to provision cStor volume on a cStor pool. In this solution, we are using a StorageClass to consume the cStor Pool which is created using external disks attached on the Nodes. The storage pool is created using the steps provided in the Configure StoragePool section. In this solution, PostgreSQL® is a deployment. Since it requires replication at the storage level the cStor volume replicaCount is 3. Sample YAML named openebs-sc-pg.yaml to consume cStor pool with cStorVolume Replica count as 3 is provided in the configuration details below.

    openebs-sc-pg.yaml

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: openebs-postgres
      annotations:
        openebs.io/cas-type: cstor
        cas.openebs.io/config: |
          - name: StoragePoolClaim
            value: "cstor-disk"
          - name: ReplicaCount
            value: "3"       
    provisioner: openebs.io/provisioner-iscsi
    reclaimPolicy: Delete
    ---

    Launch and test Postgres Operator

    1. Clone Zalando’s Postgres Operator.
    git clone https://github.com/zalando/postgres-operator.git
    cd postgres-operator

    Use the OpenEBS storage class

    1. Edit manifest file and add openebs-postgres as the storage class.
    nano manifests/minimal-postgres-manifest.yaml

    After adding the storage class, it should look like the example below:

    apiVersion: "acid.zalan.do/v1"
    kind: postgresql
    metadata:
      name: acid-minimal-cluster
      namespace: default
    spec:
      teamId: "ACID"
      volume:
        size: 1Gi
        storageClass: openebs-postgres
      numberOfInstances: 2
      users:
        # database owner
        zalando:
        - superuser
        - createdb
     
    # role for application foo
        foo_user: []
     
    #databases: name->owner
      databases:
        foo: zalando
      postgresql:
        version: "10"
        parameters:
          shared_buffers: "32MB"
          max_connections: "10"
          log_statement: "all"

    Start the Operator

    1. Run the command below to start the operator
    kubectl create -f manifests/configmap.yaml # configuration
    kubectl create -f manifests/operator-service-account-rbac.yaml # identity and permissions
    kubectl create -f manifests/postgres-operator.yaml # deployment

    Create a Postgres cluster on OpenEBS

    Optional: The operator can run in a namespace other than default. For example, to use the test namespace, run the following before deploying the operator’s manifests:

    kubectl create namespace test
    kubectl config set-context $(kubectl config current-context) — namespace=test
    1. Run the command below to deploy from the example manifest:
    kubectl create -f manifests/minimal-postgres-manifest.yaml

    2. It only takes a few seconds to get the persistent volume (PV) for the pgdata-acid-minimal-cluster-0 up. Check PVs created by the operator using the kubectl get pv command:

    $ kubectl get pv
    NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
    pvc-8852ceef-48fe-11e9–9897–06b524f7f6ea 1Gi RWO Delete Bound default/pgdata-acid-minimal-cluster-0 openebs-postgres 8m44s
    pvc-bfdf7ebe-48fe-11e9–9897–06b524f7f6ea 1Gi RWO Delete Bound default/pgdata-acid-minimal-cluster-1 openebs-postgres 7m14s

    Connect to the Postgres master and test

    1. If it is not installed previously, install psql client:
    sudo apt-get install postgresql-client

    2. Run the command below and note the hostname and host port.

    kubectl get service — namespace default |grep acid-minimal-cluster

    3. Run the commands below to connect to your PostgreSQL® DB and test. Replace the [HostPort] below with the port number from the output of the above command:

    export PGHOST=$(kubectl get svc -n default -l application=spilo,spilo-role=master -o jsonpath="{.items[0].spec.clusterIP}")
    export PGPORT=[HostPort]
    export PGPASSWORD=$(kubectl get secret -n default postgres.acid-minimal-cluster.credentials -o ‘jsonpath={.data.password}’ | base64 -d)
    psql -U postgres -c ‘create table foo (id int)’

    Congrats you now have the Postgres-Operator and your first test database up and running with the help of cloud-native OpenEBS storage.

    Partnership and future direction

    As this blog indicates, the teams at MayaData / OpenEBS and credativ are increasingly working together to help organizations running PostgreSQL® and other stateful workloads. In future blogs, we’ll provide more hands-on tips.

    We are looking for feedback and suggestions on where to take this collaboration. Please provide feedback below or find us on Twitter or on the OpenEBS slack community.

    Patroni is a PostgreSQL high availability solution with a focus on containers and Kubernetes. Until recently, the available Debian packages had to be configured manually and did not integrate well with the rest of the distribution. For the upcoming Debian 10 “Buster” release, the Patroni packages have been integrated into Debian’s standard PostgreSQL framework by credativ. They now allow for an easy setup of Patroni clusters on Debian or Ubuntu.

    Patroni employs a “Distributed Consensus Store” (DCS) like Etcd, Consul or Zookeeper in order to reliably run a leader election and orchestrate automatic failover. It further allows for scheduled switchovers and easy cluster-wide changes to the configuration. Finally, it provides a REST interface that can be used together with HAProxy in order to build a load balancing solution. Due to these advantages Patroni has gradually replaced Pacemaker as the go-to open-source project for PostgreSQL high availability.

    However, many of our customers run PostgreSQL on Debian or Ubuntu systems and so far Patroni did not integrate well into those. For example, it does not use the postgresql-common framework and its instances were not displayed in pg_lsclusters output as usual.

    Integration into Debian

    In a collaboration with Patroni lead developer Alexander Kukushkin from Zalando the Debian Patroni package has been integrated into the postgresql-common framework to a large extent over the last months. This was due to changes both in Patroni itself as well as additional programs in the Debian package. The current Version 1.5.5 of Patroni contains all these changes and is now available in Debian “Buster” (testing) in order to setup Patroni clusters.

    The packages are also available on apt.postgresql.org and thus installable on Debian 9 “Stretch” and Ubuntu 18.04 “Bionic Beaver” LTS for any PostgreSQL version from 9.4 to 11.

    The most important part of the integration is the automatic generation of a suitable Patroni configuration with the pg_createconfig_patroni command. It is run similar to pg_createcluster with the desired PostgreSQL major version and the instance name as parameters:

    pg_createconfig_patroni 11 test
    

    This invocation creates a file /etc/patroni/11-test.yml, using the DCS configuration from /etc/patroni/dcs.yml which has to be adjusted according to the local setup. The rest of the configuration is taken from the template /etc/patroni/config.yml.in which is usable in itself but can be customized by the user according to their needs. Afterwards the Patroni instance is started via systemd similar to regular PostgreSQL instances:

    systemctl start patroni@11-test
    

    A simple 3-node Patroni cluster can be created and started with the following few commands, where the nodes pg1, pg2 and pg3 are considered to be hostnames and the local file dcs.yml contains the DCS configuration:

    
    for i in pg1 pg2 pg3; do ssh $i 'apt -y install postgresql-common'; done
    for i in pg1 pg2 pg3; do ssh $i 'sed -i "s/^#create_main_cluster = true/create_main_cluster = false/" /etc/postgresql-common/createcluster.conf'; done
    for i in pg1 pg2 pg3; do ssh $i 'apt -y install patroni postgresql'; done
    for i in pg1 pg2 pg3; do scp ./dcs.yml $i:/etc/patroni; done
    for i in pg1 pg2 pg3; do ssh @$i 'pg_createconfig_patroni 11 test' && systemctl start patroni@11-test'; done
    

    Afterwards, you can get the state of the Patroni cluster via

    ssh pg1 'patronictl -c /etc/patroni/11-patroni.yml list'
    +---------+--------+------------+--------+---------+----+-----------+
    | Cluster | Member |    Host    |  Role  |  State  | TL | Lag in MB |
    +---------+--------+------------+--------+---------+----+-----------+
    | 11-test |  pg1   | 10.0.3.111 | Leader | running |  1 |           |
    | 11-test |  pg2   | 10.0.3.41  |        | stopped |    |   unknown |
    | 11-test |  pg3   | 10.0.3.46  |        | stopped |    |   unknown |
    +---------+--------+------------+--------+---------+----+-----------+
    

    Leader election has happened and pg1 has become the primary. It created its instance with the Debian-specific pg_createcluster_patroni program that runs pg_createcluster in the background. Then the two other nodes clone from the leader using the pg_clonecluster_patroni program which sets up an instance using pg_createcluster and then runs pg_basebackup from the primary. After that, all nodes are up and running:

    +---------+--------+------------+--------+---------+----+-----------+
    | Cluster | Member |    Host    |  Role  |  State  | TL | Lag in MB |
    +---------+--------+------------+--------+---------+----+-----------+
    | 11-test |  pg1   | 10.0.3.111 | Leader | running |  1 |         0 |
    | 11-test |  pg2   | 10.0.3.41  |        | running |  1 |         0 |
    | 11-test |  pg3   | 10.0.3.46  |        | running |  1 |         0 |
    +---------+--------+------------+--------+---------+----+-----------+
    

    The well-known Debian postgresql-common commands work as well:

    ssh pg1 'pg_lsclusters'
    Ver Cluster Port Status Owner    Data directory                 Log file
    11  test    5432 online postgres /var/lib/postgresql/11/test    /var/log/postgresql/postgresql-11-test.log
    

    Failover Behaviour

    If the primary is abruptly shutdown, its leader token will expire after a while and Patroni will eventually initiate failover and a new leader election:

    +---------+--------+-----------+------+---------+----+-----------+
    | Cluster | Member |    Host   | Role |  State  | TL | Lag in MB |
    +---------+--------+-----------+------+---------+----+-----------+
    | 11-test |  pg2   | 10.0.3.41 |      | running |  1 |         0 |
    | 11-test |  pg3   | 10.0.3.46 |      | running |  1 |         0 |
    +---------+--------+-----------+------+---------+----+-----------+
    [...]
    +---------+--------+-----------+--------+---------+----+-----------+
    | Cluster | Member |    Host   |  Role  |  State  | TL | Lag in MB |
    +---------+--------+-----------+--------+---------+----+-----------+
    | 11-test |  pg2   | 10.0.3.41 | Leader | running |  2 |         0 |
    | 11-test |  pg3   | 10.0.3.46 |        | running |  1 |         0 |
    +---------+--------+-----------+--------+---------+----+-----------+
    [...]
    +---------+--------+-----------+--------+---------+----+-----------+
    | Cluster | Member |    Host   |  Role  |  State  | TL | Lag in MB |
    +---------+--------+-----------+--------+---------+----+-----------+
    | 11-test |  pg2   | 10.0.3.41 | Leader | running |  2 |         0 |
    | 11-test |  pg3   | 10.0.3.46 |        | running |  2 |         0 |
    +---------+--------+-----------+--------+---------+----+-----------+
    

    The old primary will rejoin the cluster as standby once it is restarted:

    +---------+--------+------------+--------+---------+----+-----------+
    | Cluster | Member |    Host    |  Role  |  State  | TL | Lag in MB |
    +---------+--------+------------+--------+---------+----+-----------+
    | 11-test |  pg1   | 10.0.3.111 |        | running |    |   unknown |
    | 11-test |  pg2   | 10.0.3.41  | Leader | running |  2 |         0 |
    | 11-test |  pg3   | 10.0.3.46  |        | running |  2 |         0 |
    +---------+--------+------------+--------+---------+----+-----------+
    [...]
    +---------+--------+------------+--------+---------+----+-----------+
    | Cluster | Member |    Host    |  Role  |  State  | TL | Lag in MB |
    +---------+--------+------------+--------+---------+----+-----------+
    | 11-test |  pg1   | 10.0.3.111 |        | running |  2 |         0 |
    | 11-test |  pg2   | 10.0.3.41  | Leader | running |  2 |         0 |
    | 11-test |  pg3   | 10.0.3.46  |        | running |  2 |         0 |
    +---------+--------+------------+--------+---------+----+-----------+
    

    If a clean rejoin is not possible due to additional transactions on the old timeline the old primary gets re-cloned from the current leader. In case the data is too large for a quick re-clone, pg_rewind can be used. In this case a password needs to be set for the postgres user and regular database connections (as opposed to replication connections) need to be allowed between the cluster nodes.

    Creation of additional Instances

    It is also possible to create further clusters with pg_createconfig_patroni, one can either assign a PostgreSQL port explicitly via the --port option, or let pg_createconfig_patroni assign the next free port as is known from pg_createcluster:

    for i in pg1 pg2 pg3; do ssh $i 'pg_createconfig_patroni 11 test2 && systemctl start patroni@11-test2'; done
    ssh pg1 'patronictl -c /etc/patroni/11-test2.yml list'
    +----------+--------+-----------------+--------+---------+----+-----------+
    | Cluster  | Member |       Host      |  Role  |  State  | TL | Lag in MB |
    +----------+--------+-----------------+--------+---------+----+-----------+
    | 11-test2 |  pg1   | 10.0.3.111:5433 | Leader | running |  1 |         0 |
    | 11-test2 |  pg2   |  10.0.3.41:5433 |        | running |  1 |         0 |
    | 11-test2 |  pg3   |  10.0.3.46:5433 |        | running |  1 |         0 |
    +----------+--------+-----------------+--------+---------+----+-----------+
    

    Ansible Playbook

    In order to easily deploy a 3-node Patroni cluster we have created an Ansible playbook on Github. It automates the installation and configuration of PostgreSQL and Patroni on the three nodes, as well as the DCS server on a fourth node.

    Questions and Help

    Do you have any questions or need help? Feel free to write to info@credativ.com.

    This week version 1.3 of our PostgreSQL® appliance Elephant Shed was released.

    The highlight of the new version is support for Red Hat Enterprise Linux 7 and CentOS 7. As is already the case for Debian, the appliance heavily relies on the postgresql-common infrastructure which was previously ported to RPM.
    The well-known PostgreSQL® RPM packages from yum.postgresql.org are integrated into the system via pg_createcluster and can be administrated from the Elephant Shed web interface.

    All other Elephant Shed components like pgAdmin4, Grafana, Prometheus, pgbackrest, Cockpit or shellinabox work in the same way as in the Debian version of the appliance. Only the SELinux functionality has to be deactivated in order to run pgAdmin4 and shellinabox as their packages do not support this.

    Besides the port to RPM the appliance infrastructure was updated. The Prometheus node-exporter is now available in version 0.16 in which many metric names were adjusted to the Prometheus naming scheme. The Grafana dashboard was updated accordingly. The Apache configuration was switched from authnz_pam to authnz_external as the former is not available on CentOS and stable functionality could not longer be guaranteed on Debian Buster.

    The next items on the Elephant-Shed roadmap are the integration of the REST-API in order to control particular components, as well as multi-host support so that several Elephant-Shed instances can be controlled simultaneously.
    An overhaul of the user interface is planned as well.

    The updated packages are available for download at packages.credativ.com. If Elephant-Shed was installed already, the updates are provided via apt as usual.

    The open-source PostgreSQL® appliance Elephant-Shed is developed by credativ and is increasingly popular, as the most important compontents for the administration of PostgreSQL® servers are already included. Adjustments and extensions can be done at any time.

    Comprehensible technical support for Elephant-Shed is offered by credativ including guaranteed service-level agreements and optional 365 days and 24/7 hours.

    Today PostgreSQL® version 11 was released. The new release brings improvements in many areas.

    Since version 9.6 query plans can be executed on multiple CPU cores in parallel, this is now supported for other plan types, especially the creation of B-tree indexes. Sequential scans and UNION queries have also been improved.

    Brand new is the possibility to optimize queries via Just-in-Time Compilation (JIT). When PostgreSQL® is compiled, the source code is stored as LLVM bit code. When executing a query whose planner cost exceeds a limit, libllvm then translates this bit code into native machine code specifically for that query. Since all used data types etc. are known in advance, the machine code eliminates all case distinctions that are generally necessary. The feature is disabled by default and can be enabled with “SET jit = on;”. In PostgreSQL® 12 it should then be active by default.

    Until now only functions could be defined on SQL level. New are now procedures which can manage BEGIN/COMMIT independently. Batch operations can now be completely transferred to the database side.

    Table Partitioning section has been further improved to support hash partitioning. Integration with partitions using postgres_fdw has also been improved. It is now possible to create a default partition that holds data that does not fall into any of the existing partitions.

    This Amp goes to 11!

    Other improvements include the ability to add columns with default values to tables without having to rewrite the table completely. “Covering Indexes” allows more index accesses than “Index Only Scan”. Window functions now also support the RANGE and GROUPS keywords.

    More information can be found in the release announcement of the PostgreSQL® project.

    Next week the PGConf.EU will take place in Lisbon. We from credativ are present with a booth and celebrate the PostgreSQL® release with our “This Amp goes to 11” T-shirt.

    The shirt is available for free at our booth. If you don’t attend the conference, you can order a shirt. The profits will be donated to the PostgreSQL® project.

    From mid to late June credativ attended 3 consecutive conferences in Asia. The Open Source Summit Japan, the LC3 China and the PG Open China.

    Open Source Summit Japan

    As in the previous year, the Open Source Summit Japan was held again at the Ariake Conference Center on Odaiba, in the Bay of Tokyo. In order to cover the increasing number of participants, the event area was extended by several rooms. Accordingly, there was plenty of space for everyone.

    Open Source Summit Japan 2018 Foto 1

    Open Source Summit Japan 2018 Foto 2

    In addition to a large number of technical presentations, mainly on containers, cloud and applications for automotive, there were also business and strategy orientated talks. All visitors could find topics of interest for themselves.

    Specifically the presentation “Is There an Open Source Business Model: YES or NO?” by Jeffrey Borek (IBM) and Stephen Walli (Microsoft), deserves special mention, as it was the starting point for extensive discussions that day. Jeffrey and Stephen each gave their views and then gave the floor to the attendees to mix ask questions or give comments. The title being worded as it is doesn’t really explain the topic in detail. What the talk really was about is the question if a Open Source business model exists for large software companies.

    Further to be emphasized is the presentation by our CEO Dr. Michael Meskes, whose question ”Is There a Future for Open SourceLC3 China

    LC3 China (LinuxCon + ContainerCon + CloudOpen) was held in Beijing at the China National Convention Center. In the immediate vicinity of the Olympic Green Olympia Park, which was built for the 2008 Olympic Games.

    LinuxCon China Foto 1

    LinuxCon China Foto 2

    Most of the presentations were held in English, although the vast majority of those attending were from China. A very welcoming gesture that definitely contributed to the international character. A large number of lectures with technical and business topics were held over the 4 days. Particularly interesting were the so called “office hours” as a separate position on the schedule. For this, 3 tables were provided at which discussions within the community could take place.

    On the whole, LC3 seemed to be a platform for China’s largest IT companies, but it also showed that hacker groups and student groups have their own place in the community. We were certainly very happy to be able to participate and are looking forward to the next year.

    PG Open China

    Postgres’ growing success and the well-attended PostgreSQL® conferences, which have been held in China since 2015, led to the first PG Open China being held at the Hotel Nikko New Century Beijing this year.

    PG Open China Foto 1

    The aim of this conference was to provide a starting point for the Chinese PostgreSQL community and strenghthen its connection to the global PostgreSQL community

    . For or this purpose, an international committee was established consisting of Bruce Momjian, Joshua D. Drake, Oleg Bartunov, Ray Feng and Dr. Michael Meskes.

    After introducing this committee in a keynote, the event rooms were used for presentations and talks from the Chinese community. Joshua D. Drake and Oleg Bartunov also held a presentation. All lectures were translated with the help of an interpreter, so that all those present with less understanding of the English language nuances could comprehend everything.

    The number of visitors of the PG Open China fortunately exceeded expectations and as such that the growth potential can clearly be seen. Especially with the focus on connection to the international community, the conference will certainly grow significantly over the next few years. It is therefore highly probable that we will be back on site next year. We were very happy to be one of the fist to participate in the PG Open China.

    The second beta release of PostgreSQL 11 (which is now feature frozen) has been released recently. Time to look at some of the improvements that credativ has contributed in the area of checksums and backups.

    Checksum verification during base backups

    Since version 9.3 it is possible to enable checksums for the underlying storage of tables and indices during instance creation. Those checksums raise SQL errors if bit errors are encountered in their respective data pages, which allows for early discovery of storage issues. However those checksums are only verified if queries access the corrupted page. Running an explicit check is only possible with the forthcoming pg_verify_checksums application from version 11, however, it requires an offline instance in order to work.

    Our change allows for verification of checksums during base backups. This is a good opportunity to verify the checksum consistency as all data blocks needs to be read during a base backup anyway. Checksum failures are logged as warnings (rather than errors) in order not to abort the whole base backup when they occur. The commonly used pg_basebackup application was extended with the –no-verify-checksums option which disables the verification.

    Replication slots during base backups

    The second change concerns the handling of replication slots by pg_basebackup during the setup of standby servers. Replication slots allow a primary to reserve the required transaction logs for the standby associated with the slot, even if it is temporarily down. Previous releases already allowed using a replication slot with pg_basebackup, however, this slot had to be created manually beforehand. Our change adds the new option -C or –create-slot and allows the on-shot creation of a standby clone including the usage of replication slots:

    $ pg_basebackup -v -h primary.lan -D data --slot=standby1 --create-slot --write-recovery-conf
    pg_basebackup: initiating base backup, waiting for checkpoint to complete
    pg_basebackup: checkpoint completed
    pg_basebackup: write-ahead log start point: 0/1D000028 on timeline 1
    pg_basebackup: starting background WAL receiver
    pg_basebackup: created replication slot "standby1"
    pg_basebackup: write-ahead log end point: 0/1D0000F8
    pg_basebackup: waiting for background process to finish streaming ...
    pg_basebackup: base backup completed
    $ cat data2/recovery.conf
    standby_mode = 'on'
    primary_conninfo = 'user=postgres passfile=''/var/lib/postgresql/.pgpass'' host=primary.lan
      port=5432 sslmode=prefer sslcompression=1 krbsrvname=postgres target_session_attrs=any'
    primary_slot_name = 'standby1'
    

    Afterwards the standby just has to be started and will replicate automatically.

    In addition, several other small improvements to pg_basebackup and its testsuite were done by us.

    Parallel dump to /dev/null

    A patch that did not make it into the release is presented here nevertheless: parallel pg_dump to /dev/null in the directory format. The reason for it is the common usage of pg_dump to check for errors in a PostgreSQL instance where /dev/null/ is used a target in order not to use additional disk space. The problem is that /dev/null can only be used in the custom format which does not allow dumping in parallel. The directory format supports multiple concurrent processes but cannot use /dev/null as target as it is not a directory. Our patch adds support for /dev/null as a target when using the directory format.

    The reasons for the rejection were not technical issues with the patch but the fact that pg_dump is not a diagnostics tool and no special support for that should be included. Nevertheless, the submitted patch works and is being used by our clients. Versions of the patch for PostgreSQL 9.3, 9.4, 9.5, 9.6 and 10 are available.

    The credativ PostgreSQL® Competence Center has released a project roadmap for the PostgreSQL® Appliance Elephant Shed.

    Elephant Shed is a freely available PostgreSQL® solution developed by credativ, which combines management, monitoring and administration into one system.

    The project roadmap for 2018 includes following points:

    An additional planned feature is the implementation of REST API to control individual components. REST stands for REpresentational State Transfer and is an application programming interface based on the behavior of the World Wide Web. Specifically the PostgreSQL® database and the backup via pgBackRest should be addressed.

    Multi host support is also planned. A central control of several Elephant Shed instances is thus possible.

    In order to make Elephant Shed even more user friendly, various configuration parameters of the web interface are going to be adjusted.

    The project roadmap is of course also constantly being worked on. On GitHub you can leave us your feedback at any time.

    We would like to take this opportunity to thank all users and testers, and look forward to further development of the project!

    For further information please visit elephant-shed.io and GitHub.

    This article was originally written by Philip Haas

    Elephant Shed is now available as a Vagrant box. This makes it very easy to test and try out the PostgreSQL® appliance.

    Vagrant is an Open Source tool for creating portable virtual software environments. By being fully script controlled Vagrant makes it easy to generate virtual machines, in which a software component is installed for testing purposes. Vagrant itself is only the manager, whereas various backends such as Virtualbox or cloud providers can be used for the actual virtualization.

    For the development of Elephant Shed we have relied on Vagrant from the very beginning. This “box” is now also available in the Vagrant Cloud.

    To use this box Vagrant and VirtualBox must be installed. The host operating system hereby is irrelevant (Linux/MacOS/Windows), but inside the box runs Debian Stretch. The box is then automatically downloaded.

    vagrant init credativ/elephant-shed
    vagrant up

    This creates a virtual machine where Elephant Shed runs in a VirtualBox on your computer.

    We are looking forward to your feedback!

    Further information can be found on our Elephant Shed project page and on Github as well.

    The credativ PostgreSQL® Appliance is now available for download as a completely free Open Source solution. The new appliance called ‘Elephant Shed PostgreSQL® Appliance‘ offers a tremendous ease of use for enterprise PostgreSQL® operations. The long-term maintenance of the appliance will be handled by the PostgreSQL® experts of credativ. Prepared images for the major cloud and virtualization platforms are already in work and will be released soon for VMWare, Virtualbox, Vagrant and for the cloud platforms Microsoft Azure, Amazon Web Services and Google Cloud Platform.

    Elephant Shed builds on proven components, which are published exclusively under recognized Open Source licenses. These tools are an effective support for the management of a PostgreSQL® server. All components used are pre-installed and integrated into the integral automation system. The majority of these tools can be used via a comfortable web interface.

    Service and Support

    For Elephant Shed, credativ offers comprehensive technical support with guaranteed service level agreements, which is also available 24 hours a day, 365 days a year. Support during installation and integration, as well as an introduction to Elephant Shed is of course also part of credativ’s services.

    Please do not hesitate to contact us if you have any questions about Elephant Shed and our service and support services.

    For more information, please visit our Elephant Shed- project page and Github.

    This article was originally written by Philip Haas.