Ansible role for provisioning ClickHouse server.
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 :)!
This contains roles to provision:
- Single ClickHouse Node
- ClickHouse Cluster (upto N nodes)
- Provision Zookeeper nodes (standalone upto N nodes)
- add, remove or config files found under
/roles/clickhouse/templates
- add templating variables to
/roles/clickhouse/vars
- add, remove or config files found under
/roles/zookeeper/templates
- add templating variables to
/roles/zookeeper/vars
- Refer to
hack/inventory
- Mainly used for local testing (refer to next section)
Provides a setup to locally test the ClickHouse server ansible roles.
- 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
- Spin up vagrant box to provision
# Vagrantfile located in /dev/vagrant/clickhouse-node
➜ clickhouse-ansible git:(master) ✗ make vagrant-up-ch-node
# 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
# 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
- 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
# Vagrantfile located in /dev/vagrant/clickhouse-node
➜ clickhouse-ansible git:(master) ✗ make provision-ch-node
# Vagrantfile located in /dev/vagrant/clickhouse-cluster
# set N_CH_NODES suitably
➜ clickhouse-ansible git:(master) ✗ N_CH_NODES=3 make provision-ch-cluster
# Vagrantfile located in /dev/vagrant/zookeeper-nodes
# set N_ZK_NODES suitably
➜ clickhouse-ansible git:(master) ✗ N_ZK_NODES=1 make provision-zk-nodes
# 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
# 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