W3cubDocs

/Ansible

community.general.aerospike_migrations – Check or wait for migrations between nodes

Note

This plugin is part of the community.general collection (version 3.8.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.aerospike_migrations.

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
  community.general.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
      ansible.builtin.apt:
        name:
            - python
            - python-pip
            - python-setuptools
        state: latest
    - name: Setup aerospike
      ansible.builtin.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
      community.general.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
      ansible.builtin.shell: |
          echo foo
    - name: Reboot
      ansible.builtin.reboot:

Authors

  • Albert Autin (@Alb0t)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/aerospike_migrations_module.html