Skip to content

Instantly share code, notes, and snippets.

@tschwaerzl
Last active February 6, 2018 10:12
Show Gist options
  • Save tschwaerzl/988e618ec6c665fe1a6647ff3f9166ae to your computer and use it in GitHub Desktop.
Save tschwaerzl/988e618ec6c665fe1a6647ff3f9166ae to your computer and use it in GitHub Desktop.
How to install WAL-E with PostgreSQL 9.5 on Ubuntu 16.04 or Ubuntu 14.04

How to install Wal-E

This is a step per step guide on how to install and configure Wal-E on a Ubuntu 16.04 or Ubuntu 14.04 server.

Install

  1. First install the required packages from apt

    apt install -y python3-setuptools daemontools \
                   python3-pip python3-venv lzop \
                   software-properties-common \
                   apt-transport-https pv
    

    for Ubuntu 14.04 use

    apt install -y python3-setuptools daemontools python3-pip lzop \
                   software-properties-common apt-transport-https pv
                   
    # then install virtualenv
    pip3 install virtualenv
    
  2. Create a virtual environment for Wal-E

    python3 -m venv /opt/wal-e
    

    for Ubuntu 14.04 use

    python3 -m virtualenv /opt/wal-e
    
  3. In some cases you may get an error which says you're missing python3-venv and you need to install it. In this case you need to update your locales with

  export LC_ALL="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8" sudo dpkg-reconfigure locales  

  1. Upgrade PIP

    /opt/wal-e/bin/pip3 install --upgrade pip
    
  2. Install Wal-E and required Swift clients

    /opt/wal-e/bin/pip3 install wal-e python-swiftclient python-keystoneclient
    
  3. Create Wal-E environment folder which holds the configuration

    mkdir -p /etc/wal-e.d/env
    
  4. Create the environment files for Wal-E

  5. WALE_SWIFT_PREFIX

swift://CONTAINER_NAME
  1. SWIFT_AUTHURL
https://example.com:8010/auth/v1.0
  1. SWIFT_USER
storage_account:access_key_id

The storage account is from your QNAP OSS. Mostly it is the same as the user you created in QNAP management.

  1. SWIFT_PASSWORD
access_key_secret
  1. SWIFT_AUTH_VERSION
1

QNAP OSS uses Swift auth version 1.

  1. Change owner of Wal-E environment folder to the database user, mostly postgres.

    cd /etc
    chown -R postgres:postgres wal-e.d/
    
  2. Add the following parameters to your postgresql.conf to enable WAL archiving

    wal_level = archive # hot_standby and logical in 9.x is also acceptable. wal_level should be 'hot_standby' in our setup
    archive_mode = on
    archive_command = 'envdir /etc/wal-e.d/env /opt/wal-e/bin/wal-e wal-push %p'
    archive_timeout = 60
    

You need to restart PostgreSQL to take the changes effect.

That's it.

@tarasinf
Copy link

There is some issue related to this guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment