cookbook 'clickhouse', '~> 1.1.0'
clickhouse (9) Versions 1.1.0 Follow0
Installs/Configures chef-clickhouse
cookbook 'clickhouse', '~> 1.1.0', :supermarket
knife supermarket install clickhouse
knife supermarket download clickhouse
chef-clickhouse
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' default['clickhouse']['server']['version'] = '22.3.8.40.altinitystable' # 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 isclickhouse
used for config.xml template validation -
server_bin
- ClickHouse server binary name, default isclickhouse-server
-
config
- given configuration ofconfig.xml
, default isnode['clickhouse']['server']['config']
-
users
- given configuration ofconfig.xml
,users.xml
include, default isnode['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 toclickhouse-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 tonode['clickhouse']['server']['configuration']['cookbook']
-
users_template_cookbook
- template cookbook source, defaults tonode['clickhouse']['server']['users']['cookbook']
-
config_template_source
- template cookbook source, defaults toconfig.xml.erb
-
users_template_source
- template cookbook source, defaults tousers.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 toclickhouse-server
-
config_name
- defaults tonode['clickhouse']['server']['config']['macros']['incl']
-
config
- whatever is passed here is reflected in 'macros.xml' -
template_cookbook
- template cookbook source, defaults tonode['clickhouse']['server']['macros']['cookbook']
-
template_source
- template cookbook source, defaults tomacros.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 toclickhouse-server
-
config_name
- defaults tozookeeper
-
nodes
- expects Array of Hash 'es, e.g.:[{index: 1, 'host' => 'localhost', 'port' => 2181}]
-
template_cookbook
- template cookbook source, defaults tonode['clickhouse']['server']['zookeeper']['cookbook']
-
template_source
- template cookbook source, defaults tozookeeper.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 toclickhouse-server
-
config_name
- defaults tonode['clickhouse']['server']['config']['macros']['incl']
-
config
- whatever is passed here is reflected in 'clickhouse_remote_servers.xml' -
template_cookbook
- template cookbook, defaults tonode['clickhouse']['server']['remote_servers']['cookbook']
-
template_source
- template cookbook source, defaults toremote_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 toclickhouse-server
-
config_name
- defaults tocustom.xml
-
config
- whatever is passed here is reflected in 'custom.xml' or whatever what is provided inconfig_name
-
template_cookbook
- template cookbook, defaults toclickhouse
-
template_source
- template cookbook source, defaults tocustom.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
1.1.0 passed this metric
Contributing File Metric
1.1.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
1.1.0 passed this metric
No Binaries Metric
1.1.0 passed this metric
Testing File Metric
1.1.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
1.1.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
1.1.0 passed this metric
1.1.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
1.1.0 passed this metric
No Binaries Metric
1.1.0 passed this metric
Testing File Metric
1.1.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
1.1.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
1.1.0 passed this metric
1.1.0 passed this metric
Testing File Metric
1.1.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
1.1.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
1.1.0 failed this metric
1.1.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