aerospike_migrations – Check or wait for migrations between nodes — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# aerospike_migrations – Check or wait for migrations between nodes

New in version 2.8.

- Synopsis
- Parameters
- Examples
- Status

## Synopsis

- This can be used to check for migrations in a cluster. This makes it easy to do a rolling upgrade/update on Aerospike nodes.
- If waiting for migrations is not desired, simply just poll until port 3000 if available or asinfo -v status returns ok

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
connect_timeout integer | Default: 1000 | How long to try to connect before giving up (milliseconds)
consecutive_good_checks integer | Default: 3 | How many times should the cluster report "no migrations" consecutively before returning OK back to ansible?
fail_on_cluster_change boolean | Choices: no yes ← | Fail if the cluster key changes if something else is changing the cluster, we may want to fail
host string | Default: "localhost" | Which host do we use as seed for info connection
local_only boolean / required | Choices: no yes | Do you wish to only check for migrations on the local node before returning, or do you want all nodes in the cluster to finish before returning?
migrate_rx_key string | Default: "migrate_rx_partitions_remaining" | The metric key used to determine if we have rx migrations remaining. Changeable due to backwards compatibility.
migrate_tx_key string | Default: "migrate_tx_partitions_remaining" | The metric key used to determine if we have tx migrations remaining. Changeable due to backwards compatibility.
min_cluster_size integer | Default: 1 | Check will return bad until cluster size is met or until tries is exhausted
port integer | Default: 3000 | Which port to connect to Aerospike on (service port)
sleep_between_checks integer | Default: 60 | How long to sleep between each check (seconds).
target_cluster_size integer |  | When all aerospike builds in the cluster are greater than version 4.3, then the `cluster-stable` info command will be used. Inside this command, you can optionally specify what the target cluster size is - but it is not necessary. You can still rely on min_cluster_size if you don't want to use this option. If this option is specified on a cluster that has at least 1 host <4.3 then it will be ignored until the min version reaches 4.3.
tries_limit integer | Default: 300 | How many times do we poll before giving up and failing?

## Examples

    # check for migrations on local node
    - name: wait for migrations on local node before proceeding
      aerospike_migrations:
        host: "localhost"
        connect_timeout: 2000
        consecutive_good_checks: 5
        sleep_between_checks: 15
        tries_limit: 600
        local_only: False

    # example playbook:
    ---
    - name: upgrade aerospike
      hosts: all
      become: true
      serial: 1
      tasks:
        - name: Install dependencies
          apt:
            name:
                - python
                - python-pip
                - python-setuptools
            state: latest
        - name: setup aerospike
          pip:
              name: aerospike
    # check for migrations every (sleep_between_checks)
    # If at least (consecutive_good_checks) checks come back OK in a row, then return OK.
    # Will exit if any exception, which can be caused by bad nodes,
    # nodes not returning data, or other reasons.
    # Maximum runtime before giving up in this case will be:
    # Tries Limit * Sleep Between Checks * delay * retries
        - name: wait for aerospike migrations
          aerospike_migrations:
              local_only: True
              sleep_between_checks: 1
              tries_limit: 5
              consecutive_good_checks: 3
              fail_on_cluster_change: true
              min_cluster_size: 3
              target_cluster_size: 4
          register: migrations_check
          until: migrations_check is succeeded
          changed_when: false
          delay: 60
          retries: 120
        - name: another thing
          shell: |
              echo foo
        - name: reboot
          reboot:

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Albert Autin (@Alb0t)

Hint

If you notice any issues in this documentation you can edit this document to improve it.