Code Monkey home page Code Monkey logo

clickhouse-ansible's Introduction

Ansible for ClickHouse

Ansible role for provisioning ClickHouse server.

Known Caveats

This is mainly to address the known state of the repo that:

  • it contains minimal templating which will be worked upon.
  • it lacks features like provisioning ClickHouse user, dictionary, etc.
  • zookeeper roles lack the creation of replicated clusters.

I use this repo to mainly provision my own ClickHouse clusters. While the features and tasks will be worked based upon my own requirements, please feel free to send PRs if needed and thanks in advance for that :)!

Roles

This contains roles to provision:

  • Single ClickHouse Node
  • ClickHouse Cluster (upto N nodes)
  • Provision Zookeeper nodes (standalone upto N nodes)

ClickHouse config

  • add, remove or config files found under /roles/clickhouse/templates
  • add templating variables to /roles/clickhouse/vars

Zookeeper config

  • add, remove or config files found under /roles/zookeeper/templates
  • add templating variables to /roles/zookeeper/vars

Sample inventory

  • Refer to hack/inventory
  • Mainly used for local testing (refer to next section)

Local dev and testing

Provides a setup to locally test the ClickHouse server ansible roles.

Requirements

  • Vagrant
  • Virtualbox
  • Note: This setup is verified to work with:
# dev machine 
➜  clickhouse-ansible git:(master) ✗ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04 LTS
Release:	20.04
Codename:	focal

# vagrant
➜  clickhouse-ansible git:(master) ✗ vagrant --version
Vagrant 2.2.9

# virtualbox
➜  clickhouse-ansible git:(master) ✗ vboxmanage --version
6.1.10_Ubuntur138449

How to spin up machines

  1. Spin up vagrant box to provision
Single ClickHouse node
# Vagrantfile located in /dev/vagrant/clickhouse-node
➜  clickhouse-ansible git:(master) ✗ make vagrant-up-ch-node                            
ClickHouse Cluster (upto N nodes)
# Vagrantfile located in /dev/vagrant/clickhouse-cluster
# set N_CH_NODES suitably
➜  clickhouse-ansible git:(master) ✗ N_CH_NODES=3 make vagrant-up-ch-cluster                            
N number of Zookeeper nodes (standalone mode)
# Vagrantfile located in /dev/vagrant/zookeeper-nodes
# set N_ZK_NODES suitably
➜  clickhouse-ansible git:(master) ✗ N_ZK_NODES=1 make vagrant-up-zk-nodes                            

How to provision machines

  • Run Make commands to provision. The Makefile uses ansible inventory information found under hack folder.
# note might need to install sshpass [on ubuntu]: sudo apt install sshpass
# SSH password & BECOME password: vagrant
Provision a single ClickHouse node
# Vagrantfile located in /dev/vagrant/clickhouse-node
➜  clickhouse-ansible git:(master) ✗ make provision-ch-node                            
Provision ClickHouse cluster nodes
# Vagrantfile located in /dev/vagrant/clickhouse-cluster
# set N_CH_NODES suitably
➜  clickhouse-ansible git:(master) ✗ N_CH_NODES=3 make provision-ch-cluster   
Provision N Number of Zookeeper nodes
# Vagrantfile located in /dev/vagrant/zookeeper-nodes
# set N_ZK_NODES suitably
➜  clickhouse-ansible git:(master) ✗ N_ZK_NODES=1 make provision-zk-nodes                            
Other actions - Reload
# restart nodes
clickhouse-ansible git:(master) ✗ make vagrant-reload-ch-node  
clickhouse-ansible git:(master) ✗ N_CH_NODES=3 make vagrant-reload-ch-cluster  
clickhouse-ansible git:(master) ✗ N_ZK_NODES=3 make vagrant-reload-zk-nodes  
Other actions - Tear down
# tear down nodes
clickhouse-ansible git:(master) ✗ make vagrant-down-ch-node  
clickhouse-ansible git:(master) ✗ N_CH_NODES=3 make vagrant-down-ch-cluster  
clickhouse-ansible git:(master) ✗ N_ZK_NODES=3 make vagrant-down-zk-nodes  

clickhouse-ansible's People

Contributors

bharatnc 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.