Coder Social home page Coder Social logo

holmesjeon / mariadb-ansible-galera-cluster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adfinis/mariadb-ansible-galera-cluster

0.0 0.0 0.0 42 KB

Automated installation of MariaDB Galera Cluster using Ansible

License: GNU General Public License v2.0

mariadb-ansible-galera-cluster's Introduction

⚠️ This project is no longer being maintained ⚠️

The code in this repository was implemented as a PoC for the MariaDB roadshow and is not being maintained anymore.

Feel free to use the bootstrap logic implemtented in the Ansible tasks in your own project, but we're not going to implement any changes going forward.

If you find the code in this repository helpful, but want to use it under a different license please get in contact with us.

configuration management for MariaDB Galera cluster

These roles allow you to automatically setup a MariaDB Galera cluster with sane default settings.

These roles are currently only tested for RHEL/CentOS 7, but most tasks can be reused for Debian or SUSE based distributions.

Prerequisites

The machine from which the playbook is being run needs to have Ansible >= 2.5 installed. For detailed information how to obtain current packages for your distribution of choice have a look at the Ansible documentation.

As we're accessing information from a group of hosts within these playbooks we need to have fact caching enabled in Ansible. To, for example, cache using json files in you homedirectory you would add the following lines to /etc/ansible/ansible.cfg:

[defaults]
gathering = smart
fact_caching = jsonfile
fact_caching_connection = ~/.ansible/cache

For more information about other cache mechanisms have a look at the Ansible documentation regarding fact-caching.

Installing requirements

To install the required packages and configure SELinux and the firewall you can run only the tasks tagged with setup

ansible-playbook -i galera.hosts galera.yml --tags setup

Configure MariaDB Galera cluster

To run all further tasks to configure MariaDB Galera cluster and add the required user for the State Snapshot Transfer (SST) either skip the tasks tagged setup or run the tags config or auth directly.

ansible-playbook -i galera.hosts galera.yml --skip-tags setup

Bootstrapping MariaDB Galera cluster

Bootstrapping the cluster can be done using a playbook dedicated for bootstrapping the MariaDB Galera cluster called galera_bootstrap.yml

ansible-playbook -i galera.hosts galera_bootstrap.yml

It uses the first node in the group galera_cluster to bootstrap the cluster.

Rolling MariaDB Galera cluster updates

The role galera_conf is set up to allow rolling updates of the configuration of the Galera cluster. When the variable bootstrapped is set to yes the mariadb service is restarted after a change of the configuration. It is important to note that the playbook contains the keyword serial: 1, meaning that the configuration is applied one node at a time so that the will never lose quorum in the process of applying the new configuration.

ansible-playbook -i galera.hosts galera_rolling_update.yml

Vagrant support

For the live demo during the presentation I've been using Vagrant and with the following instructions you can use the Vagrantfile to perform those steps.

Prerequisites

As we need support for Vagrant private_network we need Guest Additions installed in the guest OS. The vagrant-vbguest plugins automatically takes care of this.

vagrant plugin install vagrant-vbguest

Vagrant setup

By running vagrant up all Ansible tasks in the galera.yml playbook will be run. To bootstrap the cluster afterwards a separate run of the galera_bootstrap.yml playbook is required.

PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --inventory-file=.vagrant/provisioners/ansible/inventory --sudo galera_bootstrap.yml

mariadb-ansible-galera-cluster's People

Contributors

eni23 avatar tongpu avatar keachi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.