OpenContrail 4.x: Create a backup schedule for a Cassandra database

OpenContrail 4.x: Create a backup schedule for a Cassandra databaseΒΆ

This section describes how to create a backup schedule for a Cassandra database for your OpenContrail 4.x cluster.

To create a backup schedule for a Cassandra database:

  1. Log in to the Salt Master node.

  2. Configure the cassandra server role.

    By default, the Cassandra backup server keeps five full backups. You can change the default settings by specifying the following parameters in cluster/<cluster_name>/infra/backup/server.yml:

    parameters:
      _param:
      ...
      cassandra:
        backup:
          cron: true
          backup_dir: /srv/volumes/backup/cassandra
          server:
            enabled: true
            hours_before_full: 24
            full_backups_to_keep: 5
            key:
              cassandra_pub_key:
                enabled: true
                key: ${_param:cassandra_backup_public_key}
    
  3. Enable the scheduler backup process and configure the cassandra client role:

    1. Add the following parameters to cluster/<cluster_name>/opencontrail/control_init.yml:

      parameters:
        _param:
        ...
        cassandra:
          backup:
            cron: true
      

      By default, the Cassandra backup procedure keeps three complete backups on the cassandra client node. The rsync command moves the backup files to the Cassandra backup server.

    2. Optional. Change the default settings by specifying the following parameters in cluster/<cluster_name>/opencontrail/control_init.yml:

      parameters:
        _param:
        ...
        cassandra:
          backup:
            cron: true
            client:
              enabled: true
              cleanup_snaphots: true
              full_backups_to_keep: 5
              hours_before_full: 24
              ...
      

      Note

      Mirantis recommends setting true for the cleanup_snaphots parameter so that the backup script removes all previous database snapshots once the current database backup is done.

    3. Verify or add the specified host as the Cassandra backup server in cluster/<cluster_name>/infra/backup/client_cassandra.yml:

      parameters:
        _param:
          cassandra_remote_backup_server: ${_param:infra_kvm_node03_address}
      

      The cassandra_remote_backup_server parameter must contain the resolvable hostname of the host on which the cassandra server is running.

    4. Verify or add other options for the Cassandra client node in cluster/<cluster_name>/infra/backup/client_cassandra.yml:

      parameters:
        ...
        cassandra:
          backup:
            cron: true
            client:
              containers:
              - opencontrail_controller_1
              enabled: true
              full_backups_to_keep: 5
              hours_before_full: 24
              target:
                host: cfg01
                backup_dir: /srv/volumes/backup/cassandra/${linux:system:name}
              backup_times:
                hour: '2'
                minute: '0'
      
  4. If you customized the default parameters, verify that the hours_before_full parameter of the cassandra client in cluster/<cluster_name>/opencontrail/control_init.yml matches the same parameter of the cassandra server in cluster/<cluster_name>/infra/backup/server.yml.

  5. Refresh pillars on the target nodes:

    salt -C 'I@cassandra:backup' saltutil.refresh_pillar
    
  6. Apply the salt.minion state:

    salt -C 'I@cassandra:backup:client or I@cassandra:backup:server' state.sls salt.minion
    
  7. Refresh grains for the cassandra client node:

    salt -C 'I@cassandra:backup:client' saltutil.sync_grains
    
  8. Update the mine for the cassandra client node:

    salt -C 'I@cassandra:backup:client' mine.flush
    salt -C 'I@cassandra:backup:client' mine.update
    
  9. Apply the following state to add a Cassandra user:

    salt -C 'I@cassandra:backup:server' state.apply linux.system.user
    
  10. Apply the following state on the cassandra client nodes:

    salt -C 'I@cassandra:backup:client' state.apply openssh.client.private_key,cassandra.backup
    
  11. Apply the following state on the cassandra server nodes:

    salt -C 'I@cassandra:backup:server' state.sls cassandra