Merge pull request #574 from joshuacox/zookeeper-storagedriver

Added storage driver selection and upgraded to version 2
This commit is contained in:
Raúl Sánchez 2017-08-01 12:41:50 +02:00 committed by GitHub
commit 035fbc0b7f
4 changed files with 171 additions and 1 deletions

View File

@ -0,0 +1,27 @@
# Apache Zookeeper (Experimental)
### Info:
This template creates, scale in and scale out a multinodes zk (zookeeper) cluster on top of Rancher. The configuration is generated with confd from Rancher metadata.
Cluster size are variable after deployment, and get reconfigured if refresh interval > 0.
### Usage:
Select Apache Zookeeper from catalog.
Enter the number of nodes, mem and refresh interval for the zk cluster. (set refresh data to 0 to disable dinamic config)
Change the following zookeeper default parameters, if you need:
- ZK_DATA_DIR="/opt/zk/data"
- ZK_INIT_LIMIT="10"
- ZK_MAX_CLIENT_CXNS="500"
- ZK_SYNC_LIMIT="5"
- ZK_TICK_TIME="2000"
Click deploy.
Zookeeper can now be accessed over the Rancher network.
Note: When you scale the cluster, zero downtime is expected...

View File

@ -0,0 +1,55 @@
version: '2'
services:
zk:
tty: true
image: rawmind/alpine-zk:3.4.9-3
volumes_from:
- zk-volume
- zk-conf
environment:
- JVMFLAGS=-Xmx${zk_mem}m -Xms${zk_mem}m
- ZK_DATA_DIR=${zk_data_dir}
- ZK_INIT_LIMIT=${zk_init_limit}
- ZK_MAX_CLIENT_CXNS=${zk_max_client_cxns}
- ZK_SYNC_LIMIT=${zk_sync_limit}
- ZK_TICK_TIME=${zk_tick_time}
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
{{- if ne .Values.host_label ""}}
io.rancher.scheduler.affinity:host_label: ${host_label}
{{- end}}
io.rancher.sidekicks: zk-volume, zk-conf
zk-conf:
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
{{- if ne .Values.host_label ""}}
io.rancher.scheduler.affinity:host_label: ${host_label}
{{- end}}
io.rancher.container.start_once: true
image: rawmind/rancher-zk:3.4.9
volumes:
- zkconfig:/opt/tools
zk-volume:
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
{{- if ne .Values.host_label ""}}
io.rancher.scheduler.affinity:host_label: ${host_label}
{{- end}}
io.rancher.container.start_once: true
environment:
- SERVICE_UID=10002
- SERVICE_GID=10002
- SERVICE_VOLUME=${zk_data_dir}
volumes:
- zkdata:${zk_data_dir}
image: rawmind/alpine-volume:0.0.2-1
volumes:
zkconfig:
driver: ${VOLUME_DRIVER}
per_container: true
zkdata:
driver: ${VOLUME_DRIVER}
per_container: true

View File

@ -0,0 +1,88 @@
version: '2'
catalog:
name: Zookeeper
version: 3.4.9-rancher2
description: |
(Experimental) Apache Zookeeper cluster.
minimum_rancher_version: v0.59.0
maintainer: "Raul Sanchez <rawmind@gmail.com>"
uuid: zk-0
questions:
- variable: "zk_scale"
description: "Number of zk nodes. Note: Recommended an odd number"
label: "Zk Nodes:"
required: true
default: 3
type: "int"
- variable: "zk_mem"
description: "Amount of memory to config zk."
label: "Zk Memory (mb):"
required: true
default: 512
type: "int"
- variable: "zk_init_limit"
description: "Time to allow followers to connect and sync with leader"
label: "Zk init limit (ticks):"
required: true
default: 10
type: "int"
- variable: "zk_data_dir"
description: "Directory where zookeeper store data"
label: "Zk data dir:"
required: true
default: "/opt/zk/data"
type: "string"
- variable: "zk_max_client_cxns"
description: "Max client concurrent connections"
label: "Zk max client cxns:"
required: true
default: 500
type: "int"
- variable: "zk_sync_limit"
description: "Time to allow followers to sync with leader"
label: "Zk sync limit (ticks):"
required: true
default: 5
type: "int"
- variable: "zk_tick_time"
description: "Tick time length"
label: "Zk tick time (ms):"
required: true
default: 2000
type: "int"
- variable: "zk_interval"
description: "Interval to poll/apply configuration changes. 0 to disable, reconfiguration will be done when you restart zk nodes"
label: "Zk Interval (s):"
required: true
default: 60
type: "int"
- variable: host_label
label: "Host with Label to put zookeeper on"
description: |
Host label to use as zookeeper 'value' tag.
Example: 'zookeeper=true'
required: false
default: ""
type: "string"
- variable: "VOLUME_DRIVER"
description: "The VOLUME driver to associate with this server"
label: "VOLUME Driver"
required: true
default: "local"
type: enum
options: # List of options if using type of `enum`
- local
- rancher-nfs
- rancher-efs
- rancher-ebs
services:
zk:
scale: ${zk_scale}
retain_ip: true
health_check:
port: 2181
interval: 5000
unhealthy_threshold: 3
request_line: ''
healthy_threshold: 2
response_timeout: 5000

View File

@ -1,7 +1,7 @@
name: Apache Zookeeper
description: |
(Experimental) Zookeeper cluster
version: 3.4.9-rancher1
version: 3.4.9-rancher2
category: Clustering
maintainer: "Raul Sanchez <rawmind@gmail.com>"
projectURL: https://github.com/rawmind0/alpine-zk