basho-labs.riak-kv

Ansible Role for Riak KV & TS

Build Status Ansible Galaxy

Ansible Riak is a tool that helps you install and set up Riak KV & TS. You can use it to configure either one server or a whole cluster.

  1. Installation
  2. Documentation
  3. Examples
  4. Contributing
  5. Roadmap
  6. License and Authors

Installation

Requirements

  • Ansible version 2.1 or higher

Using Ansible Galaxy

Run the following command to install it:

$ ansible-galaxy install basho-labs.riak-kv

Then you can use the role in your playbooks with the key basho-labs.riak-kv.

Manual Installation

To install it manually, clone the repository or extract the package to your roles directory.

For example, if you keep your roles in a folder next to your playbook.yml, it would be roles/. After cloning the repository there, you could refer to the role with the key ansible-riak.

Documentation

This README section contains all the information you need about this role.

Variables

You can find all the customizable variables in the variable defaults file. To change any default variable, simply set it in the vars: section of your playbook.yml or create your own role that uses the same variable names.

Templates

There are four templates included. The most important one is riak.conf.j2, as it sets the operating parameters for Riak KV. If you have special requirements, you can replace this template with your own.

You can do this in two ways:

  • Change the riak_conf_template variable to point to your own template location.
  • Create a new role that uses this one as a dependency and name your template file the same as the original, which is riak.conf.j2.

Examples

Changing Default Variables in a Playbook

---
- hosts: riak
  sudo: true
  roles:
    - { role: ansible-riak }
  vars:
    riak_pb_bind_ip: 10.29.7.192
    riak_pb_port:    10017

Changing Default Variables via Role Dependency

We use a vagrant-ansible package to test our client libraries and set up an environment for testing which includes this role.

Installing Riak TS

---
- hosts: riakts
  sudo: true
  roles:
    - { role: ansible-riak }
  vars:
    riak_package: 'riak-ts'
    riak_backend: leveldb
    riak_node_name: "riak@{{ ansible_default_ipv4['address'] }}"
    riak_shell_group: 'riak-ts'
    riak_anti_entropy: off
  tasks:
    - name: Set object size warning limit
      lineinfile: 'dest=/etc/riak/riak.conf line="object.size.warning_threshold = 50K" regexp: "^object.size.warning_threshold ="'

    - name: Set object size maximum limit
      lineinfile: 'dest=/etc/riak/riak.conf line="object.size.maximum = 500K" regexp: "^object.size.maximum ="'

Creating a Cluster

To create a cluster, you need to tell your Riak node to join the cluster using the leader's address. This can be done in two ways: with the command module and the riak-admin tool, or with the Ansible Riak module.

Command Module

---
- hosts: riak
  sudo: true
  roles:
    - { role: ansible-riak }
  vars:
    ring_leader: [email protected]
  tasks:
    - name: Join the cluster
      command: '{{ riak_admin }} cluster join {{ ring_leader }}'

    - name: Check Riak Ring
      command: '{{ riak_admin }} cluster status'
      register: riak_ring_status

    - name: Plan the cluster
      command: '{{ riak_admin }} cluster plan'
      when: riak_ring_status.stdout.find('joining') > 0

    - name: Commit the cluster
      command: '{{ riak_admin }} cluster commit'
      when: riak_ring_status.stdout.find('joining') > 0

Riak Module

The Riak module offers additional features like waiting for the ring and handoffs.

---
- hosts: riak
  sudo: true
  roles:
    - { role: ansible-riak }
  vars:
    ring_leader: [email protected]
  tasks:
    - name: Join the cluster
      riak: command=join target_node={{ ring_leader }}

    - name: Check Riak Ring
      command: 'riak-admin cluster status'
      register: riak_ring_status

    - name: Plan the cluster
      riak: command=plan wait_for_ring=300
      when: riak_ring_status.stdout.find('joining') > 0

    - name: Commit the cluster
      riak: command=commit wait_for_handoffs=300
      when: riak_ring_status.stdout.find('joining') > 0

Contributing

Our team at Basho appreciates contributions to this project! Please check CONTRIBUTING.md for details on how to contribute.

Roadmap

  • No plans at this moment.

License and Authors

Copyright (c) 2016 Basho Technologies, Inc. This project is licensed under the Apache License, Version 2.0. For more details, see License.

Informazioni sul progetto

Installs and configures Riak KV and TS, a distributed, highly available NoSQL and TimeSeries database.

Installa
ansible-galaxy install basho-labs.riak-kv
Licenza
other
Download
500
Proprietario
The part of Basho Technologies that is 100% community contribution. Share code freely and regularly.