nl2go.clickhouse_backup

Ansible Role: ClickHouse Backup

This is an Ansible Role that helps you install and set up the ClickHouse backup tool.

Role Variables

You can find the available variables along with their default values in defaults/main.yml.

Dependencies

This role does not have any dependencies.

Example Playbook

Here's an example of how to use this role:

- hosts: all
  roles:
     - { role: nl2go.clickhouse_backup }
  vars:
    clickhouse_backup_version: 0.5.2
    clickhouse_backup_general_remote_storage: gcs
    clickhouse_backup_gcs_credentials_json: !vault |
      $ANSIBLE_VAULT;1.2;AES256;production
      1234xxx...
    clickhouse_backup_gcs_bucket: clickhouse-backup-bucket
    clickhouse_backup_gcs_path: "clickhouse"
    clickhouse_backup_clickhouse_host: "{{ ansible_default_ipv4.address }}"
    clickhouse_backup_clickhouse_password: 123SECURE

Set Up Cron Jobs for Backups

This role can automatically create 3 cron jobs to run backups regularly. You can control this by setting the variable clickhouse_backup_install_crontab, which is set to true by default. The default setup includes daily, weekly, and monthly backups. You can also manage how many backups to keep on remote storage with the following variables:

clickhouse_backup_general_backups_to_keep_remote_daily: 7
clickhouse_backup_general_backups_to_keep_remote_weekly: 4
clickhouse_backup_general_backups_to_keep_remote_monthly: 12

These numbers are the default values.

Development

To test this role, you can use docker-molecule following the instructions to run Molecule, or you can install Molecule on your machine (not recommended due to potential version conflicts).

  1. Set your Hetzner Cloud token:

    export HCLOUD_TOKEN=123abc456efg
    
  2. Set up or decrypt your GCS credentials file:

    export CI_FILE_SECRET=123
    openssl aes-256-cbc -d \
        -in molecule/resources/clickhouse-backup-gcs-credentials.json.enc \
        -out molecule/resources/clickhouse-backup-gcs-credentials.json \
        -md sha256 \
        -k ${CI_FILE_SECRET}
    
  3. Use the following command to run tests:

    molecule test --all
    

Maintainers

License

Check the LICENSE.md file for more information.

Author Information

This role was created in 2020 by Newsletter2Go GmbH.

Informazioni sul progetto

An Ansible Role that manages installation and configuration of the ClickHouse backup tool clickhouse-backup

Installa
ansible-galaxy install nl2go.clickhouse_backup
Licenza
mit
Download
4.2k
Proprietario