Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

clickhouse (9) Versions 0.8.0

Installs/Configures chef-clickhouse

Policyfile
Berkshelf
Knife
cookbook 'clickhouse', '= 0.8.0', :supermarket
cookbook 'clickhouse', '= 0.8.0'
knife supermarket install clickhouse
knife supermarket download clickhouse
README
Dependencies
Quality 33%

chef-clickhouse

Build Status
Cookbook Version

Installs and manages ClickHouse server instances.

Requirements

  • Chef 12.5 or higher
  • Network accessible package repositories
  • Zookeeper (optional) only for distributed mode

Attributes

default['clickhouse']['user'] = 'clickhouse'
default['clickhouse']['group'] = 'clickhouse'

case node['platform']
when 'rhel', 'centos'
  default['clickhouse']['server']['version'] = '19.13.2.19'
when 'ubuntu', 'debian'
  default['clickhouse']['server']['version'] = '1.1.54343'
end

# Override config.xml Chef template resource `cookbook` location.
# Useful in wrapping cookbooks.
default['clickhouse']['server']['configuration']['cookbook'] = 'clickhouse'

# Override users.xml Chef template resource `cookbook` location.
# Useful in wrapping cookbooks.
default['clickhouse']['server']['users']['cookbook'] = 'clickhouse'

# Override zookeeper-servers.xml Chef template resource `cookbook` location.
# Useful in wrapping cookbooks.
default['clickhouse']['server']['zookeeper']['cookbook'] = 'clickhouse'

# Override macros.xml Chef template resource `cookbook` location.
# Useful in wrapping cookbooks.
default['clickhouse']['server']['macros']['cookbook'] = 'clickhouse'

# Override remote_servers.xml Chef template resource `cookbook` location.
# Useful in wrapping cookbooks.
default['clickhouse']['server']['remote_servers']['cookbook'] = 'clickhouse'

# Override compression.xml Chef template resource `cookbook` location.
# Useful in wrapping cookbooks.
default['clickhouse']['server']['compression']['cookbook'] = 'clickhouse'

Also:
- defaults/server.rb
- defaults/users.rb
- defaults/packages.rb

Usage

Place a dependency on the clickhouse cookbook in your cookbook's metadata.rb

depends 'clickhouse'

Don't forget to set password for default,readonly and chef users
or disable them completely.

To install ClickHouse.

Use Chef resources, note service_name here, it must be same
per configured ClickHouse service instance.
```ruby
clickhouse_server_service 'clickhouse server instance' do
service_name 'clickhouse-server-test'
# This attribute automatically generates Zookeeper config 'zookeeper-servers.xml'
# To disable automatic generation set zookeeper_config_install to false
zookeeper_config_nodes [{'host' => 'localhost', 'port' => 2181}]
end

clickhouse_macros_config 'clickhouse server macros config' do
service_name 'clickhouse-server-test'
config <<-CONF
<yandex>
<macros>
</macros>
</yandex>
CONF
end

clickhouse_compression_config 'clickhouse server compression config' do
service_name 'clickhouse-server-test'
config <<-CONF
<yandex>
<compression>
<case>
<min_part_size>10000000000</min_part_size>
<min_part_size_ratio>0.01</min_part_size_ratio>
<method>zstd</method>
</case>
</compression>
</yandex>
CONF
end

clickhouse_remote_servers_config 'clickhouse remote servers config' do
service_name 'clickhouse-server-test'
config <<-CONF
<yandex>
<remote_servers>
</remote_servers>
</yandex>
CONF
end
```

Resources Overview

clickhouse_server_service

The clickhouse_server_service resource manages ClickHouse server installation.

The :create action handles package installation, support directories and other operating system level concerns.
The internal configuration file contains just enough to get the service up and running.

Example
clickhouse_server_service 'custom instance' do
  version '1.1.54362'
end

Please note that when using notifies or subscribes, the resource to reference is clickhouse_server_service[custom instance], not service[custom instance].

Parameters
  • user - operating system user to run ClickHouse
  • group - operating system group to run ClickHouse
  • config_dir - configuration namespace directory, default is /etc/clickhouse-server/{custom instance}
  • version - specifies ClickHouse package version
  • package_release - package release, usually relevant for RHEL, e.g.: el6, el7
  • bin_dir - where to look for ClickHouse server binary
  • generic_bin - ClickHouse generic bin, default is clickhouse used for config.xml template validation
  • server_bin - ClickHouse server binary name, default is clickhouse-server
  • config - given configuration of config.xml, default is node['clickhouse']['server']['config']
  • users - given configuration of config.xml, users.xml include, default is node['clickhouse']['server']['users']
  • zookeeper_config_install - whether to install Zookeeper config under conf.d
  • zookeeper_config_nodes - Zookeeper nodes in format of [{'host' => 'localhost', 'port' => 2181}]
  • service_name - defaults to clickhouse-server
  • service_unit_after - systemd start unit after, default is 'network.target'
  • service_timeout_sec - systemd timeout sec, default is 5
  • service_restart - systemd restart, default 'on-failure'
  • config_template_cookbook - template cookbook source, defaults to node['clickhouse']['server']['configuration']['cookbook']
  • users_template_cookbook - template cookbook source, defaults to node['clickhouse']['server']['users']['cookbook']
  • config_template_source - template cookbook source, defaults to config.xml.erb
  • users_template_source - template cookbook source, defaults to users.xml.erb
Actions
  • :create - Configures everything from repository, package to service.
  • :delete - Removes everything but the package and directories.

clickhouse_macros_config

The clickhouse_macros_config resource manages ClickHouse server macros for ClickHouse server.

The :create action macros file installation.

Example
clickhouse_macros_config 'custom instance' do
  service_name 'clickhouse-server-your-service'
  config '<macros></macros>'
end

Please note that when using notifies or subscribes, the resource to reference is clickhouse_macros_config[custom instance], not service[custom instance].

Parameters
  • user - operating system user to run ClickHouse
  • group - operating system group to run ClickHouse
  • config_dir - configuration namespace directory, default is /etc/clickhouse-server/{custom instance}
  • service_name - defaults to clickhouse-server
  • config_name - defaults to node['clickhouse']['server']['config']['macros']['incl']
  • config - whatever is passed here is reflected in 'macros.xml'
  • template_cookbook - template cookbook source, defaults to node['clickhouse']['server']['macros']['cookbook']
  • template_source - template cookbook source, defaults to macros.xml.erb
Actions
  • :create - Installs macros.xml configuration file
  • :delete - Removes macros.xml configuration file

clickhouse_zookeeper_config

The clickhouse_zookeeper_config resource manages ClickHouse server Zookeeper servers for ClickHouse server instance.

The :create action zookeeper file installation.

Example
clickhouse_zookeeper_config 'custom instance' do
  service_name 'clickhouse-server-custom'
  nodes [
    { 'host' => '127.0.0.1', 'port' => 2181 }
  ]
end

Please note that when using notifies or subscribes, the resource to reference is clickhouse_zookeeper_config[custom instance], not service[custom instance].

Parameters
  • user - operating system user to run ClickHouse
  • group - operating system group to run ClickHouse
  • config_dir - configuration namespace directory, default is /etc/clickhouse-server/{custom instance}
  • service_name - defaults to clickhouse-server
  • config_name - defaults to zookeeper
  • nodes - expects Array of Hash 'es, e.g.: [{index: 1, 'host' => 'localhost', 'port' => 2181}]
  • template_cookbook - template cookbook source, defaults to node['clickhouse']['server']['zookeeper']['cookbook']
  • template_source - template cookbook source, defaults to zookeeper.xml.erb
Actions
  • :create - Installs zookeeper-servers.xml configuration file
  • :delete - Removes zookeeper-servers.xml configuration file

clickhouse_remote_servers_config

The clickhouse_remote_servers_config resource manages ClickHouse server macros for ClickHouse server.

The :create action macros file installation.

Example
clickhouse_remote_servers_config 'custom instance' do
  service_name 'clickhouse-server-your-service'
  config '<remote_servers></remote_servers>'
end

Please note that when using notifies or subscribes, the resource to reference is clickhouse_remote_servers_config[custom instance], not service[custom instance].

Parameters
  • user - operating system user to run ClickHouse
  • group - operating system group to run ClickHouse
  • config_dir - configuration namespace directory, default is /etc/clickhouse-server/{custom instance}
  • service_name - defaults to clickhouse-server
  • config_name - defaults to node['clickhouse']['server']['config']['macros']['incl']
  • config - whatever is passed here is reflected in 'clickhouse_remote_servers.xml'
  • template_cookbook - template cookbook, defaults to node['clickhouse']['server']['remote_servers']['cookbook']
  • template_source - template cookbook source, defaults to remote_servers.xml.erb
Actions
  • :create - Installs clickhouse_remote_servers.xml configuration file
  • :delete - Removes clickhouse_remote_servers.xml configuration file

clickhouse_custom_config

The clickhouse_custom_config resource manages ClickHouse server custom xml or any other file configuration for ClickHouse server.

The :create action macros file installation.

Example
clickhouse_custom_config 'custom instance' do
  service_name 'clickhouse-server-your-service'
  config 'your value'
  config_name 'test-custom.xml'
end

Please note that when using notifies or subscribes, the resource to reference is clickhouse_custom_config[custom instance], not service[custom instance].

Parameters
  • user - operating system user to run ClickHouse
  • group - operating system group to run ClickHouse
  • config_dir - configuration namespace directory, default is /etc/clickhouse-server/{custom instance}
  • service_name - defaults to clickhouse-server
  • config_name - defaults to custom.xml
  • config - whatever is passed here is reflected in 'custom.xml' or whatever what is provided in config_name
  • template_cookbook - template cookbook, defaults to clickhouse
  • template_source - template cookbook source, defaults to custom.xml.erb
Actions
  • :create - Installs custom.xml configuration file
  • :delete - Removes custom.xml configuration file

Manual tuning

CPU frequency tunning

sudo echo 'performance' | tee /sys/devices/system/cpu/cpu\*/cpufreq/scaling_governor

Disable huge pages

echo 'never' | sudo tee /sys/kernel/mm/transparent_hugepage/enabled

Production architecture

https://github.com/yandex/ClickHouse/issues/1272

License

MIT License

Copyright (c) 2019-present Vinted

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Dependent cookbooks

poise ~> 2.8.2
ulimit ~> 1.0.0
systemd ~> 3.2.4

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

0.8.0 passed this metric

Contributing File Metric
            

0.8.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Cookstyle Metric
            

0.8.0 failed this metric

Chef/Correctness/InvalidPlatformInCase: Use valid platform values in case statements. (https://docs.chef.io/workstation/cookstyle/chef_correctness_invalidplatformincase): clickhouse/attributes/default.rb: 5
Chef/Correctness/InvalidPlatformInCase: Use valid platform values in case statements. (https://docs.chef.io/workstation/cookstyle/chef_correctness_invalidplatformincase): clickhouse/attributes/packages.rb: 2
Chef/Correctness/InvalidPlatformInCase: Use valid platform values in case statements. (https://docs.chef.io/workstation/cookstyle/chef_correctness_invalidplatformincase): clickhouse/libraries/clickhouse_base.rb: 126
Chef/Correctness/InvalidPlatformInCase: Use valid platform values in case statements. (https://docs.chef.io/workstation/cookstyle/chef_correctness_invalidplatformincase): clickhouse/test/integration/cookbooks/test-clickhouse/recipes/install_zookeeper.rb: 2
Chef/Correctness/PropertyWithoutType: Resource properties or attributes should always define a type to help users understand the correct allowed values. (https://docs.chef.io/workstation/cookstyle/chef_correctness_propertywithouttype): clickhouse/libraries/clickhouse_custom_config.rb: 13
Chef/Deprecations/FoodcriticTesting: The Foodcritic cookbook linter has been deprecated and should no longer be used for validating cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_foodcritictesting): clickhouse/Gemfile: 9
Chef/Modernize/ExecuteAptUpdate: Use the apt_update resource instead of the execute resource to run an apt-get update package cache update (https://docs.chef.io/workstation/cookstyle/chef_modernize_executeaptupdate): clickhouse/libraries/clickhouse_base.rb: 132
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): clickhouse/metadata.rb: 10
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): clickhouse/test/integration/cookbooks/test-clickhouse/metadata.rb: 8
Chef/RedundantCode/LongDescriptionMetadata: The long_description metadata.rb method is not used and is unnecessary in cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_longdescriptionmetadata): clickhouse/metadata.rb: 6
Chef/RedundantCode/LongDescriptionMetadata: The long_description metadata.rb method is not used and is unnecessary in cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_longdescriptionmetadata): clickhouse/test/integration/cookbooks/test-clickhouse/metadata.rb: 6
Chef/Sharing/DefaultMetadataMaintainer: Metadata contains default maintainer information from the cookbook generator. Add actual cookbook maintainer information to the metadata.rb. (https://docs.chef.io/workstation/cookstyle/chef_sharing_defaultmetadatamaintainer): clickhouse/test/integration/cookbooks/test-clickhouse/metadata.rb: 2
Chef/Sharing/DefaultMetadataMaintainer: Metadata contains default maintainer information from the cookbook generator. Add actual cookbook maintainer information to the metadata.rb. (https://docs.chef.io/workstation/cookstyle/chef_sharing_defaultmetadatamaintainer): clickhouse/test/integration/cookbooks/test-clickhouse/metadata.rb: 3

Run with Cookstyle Version 7.32.1 with cops Chef/Deprecations,Chef/Correctness,Chef/Sharing,Chef/RedundantCode,Chef/Modernize,Chef/Security,InSpec/Deprecations

No Binaries Metric
            

0.8.0 passed this metric

Testing File Metric
            

0.8.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.8.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number