OpenContrail 3.2: Create a backup schedule for a Cassandra database

OpenContrail 3.2: Create a backup schedule for a Cassandra databaseΒΆ

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

To create a backup schedule for a Cassandra database:

  1. Log in to the Salt Master node.

  2. Configure the cassandra server role:

    1. Add the following class to cluster/infra/config.yml:

      classes:
      - system.cassandra.backup.server.single
      parameters:
        _param:
           cassandra_backup_public_key: <generate_your_keypair>
      

      By default, adding this include statement results in the Cassandra backup server keeping five full backups. To change the default setting, include the following pillar to cluster/infra/config.yml.

      parameters:
        cassandra:
          backup:
            cron: True
            server:
              enabled: true
              hours_before_full: 24
              full_backups_to_keep: 5
      
    2. Add the following lines to cluster/infra/config.yml:

      reclass:
        storage:
          node:
            opencontrail_control_node01:
              classes:
              - cluster.${_param:cluster_name}.opencontrail.control_init
      
  3. Configure the cassandra client role by adding the following lines to cluster/opencontrail/control_init.yml and specifying the SSH key pair. Create this file, if not present.

    classes:
    - system.cassandra.backup.client.single
    parameters:
      _param:
        cassandra_remote_backup_server: cfg01
        root_private_key: |
          <generate_your_keypair>
    

    By default, adding this include statement results in Cassandra keeping three complete backups on the cassandra client node. The rsync command moves the backup files to the Salt Master node. To change the default setting, include the following pillar to cluster/opencontrail/control_init.yml:

    parameters:
      cassandra:
        backup:
          cron: True
          client:
            enabled: true
            cleanup_snaphots: true
            full_backups_to_keep: 3
            hours_before_full: 24
            target:
              host: cfg01
    

    Note

    • The target.host parameter must contain the resolvable hostname of the host where the cassandra server is running.
    • 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.
  4. If you customized the default parameters, verify that the hours_before_full parameter of the cassandra client in cluster/opencontrail/control_init.yml matches the same parameter of the cassandra server in cluster/infra/config.yml.

  5. Run the following command on the Salt Master node:

    salt '*' 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 on the cassandra client nodes:

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

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