Classes
Public Classes
clickhouse::client
: Installs and configures Clickhouse client.clickhouse::repo
: Installs repository for Clickhouse.clickhouse::server
: Installs and configures Clickhouse server.
Private Classes
clickhouse::client::install
: Private class for managing Clickhouse client package.clickhouse::params
: Private class for setting default Clickhouse parameters.clickhouse::server::config
: Private class for Clickhouse server configuration.clickhouse::server::install
: Private class for managing Clickhouse server package.clickhouse::server::resources
: Private class for applying Clickhouse resources.clickhouse::server::service
: Private class for managing the Clickhouse service.
Defined types
clickhouse::server::dictionary
: Create and manage Clickhouse dictionary.clickhouse::server::macros
: Create and manage Clickhouse macros file for replication.clickhouse::server::profiles
: Create and manage Clickhouse profiles.clickhouse::server::quotas
: Create and manage Clickhouse quotas.clickhouse::server::remote_servers
: Create and manage Clickhouse remote servers for Distributed engine.clickhouse::server::user
: Create and manage Clickhouse user.
Resource types
clickhouse_database
: Manages a Clickhouse database.
Functions
clickhouse_config
: Convert hash to Clickhouse XML config.
Installs and configures Clickhouse client.
class { 'clickhouse::client':
package_name => 'clickhouse-client',
package_ensure => 'present',
}
The following parameters are available in the clickhouse::client
class.
Data type: Boolean
Whether to install Clickhouse repository. Defaults to 'true'.
Default value: $clickhouse::params::manage_repo
Data type: String
Name of Clickhouse client package to install. Defaults to 'clickhouse-client'.
Default value: $clickhouse::params::client_package_name
Data type: String
Whether the Clickhouse client package should be present, absent or specific version. Valid values are 'present', 'absent' or 'x.y.z'. Defaults to 'present'.
Default value: $clickhouse::params::client_package_ensure
Data type: Boolean
Whether to manage Clickhouse client package. Defaults to 'true'.
Default value: $clickhouse::params::client_manage_package
Data type: Array[String]
Array of install options for managed package resources. Appropriate options are passed to package manager.
Default value: $clickhouse::params::client_package_install_options
Installs repository for Clickhouse.
include clickhouse::repo
Installs and configures Clickhouse server.
class { 'clickhouse::server':
package_name => 'clickhouse-server',
package_ensure => '19.1.6-1.el7',
}
The following parameters are available in the clickhouse::server
class.
Data type: Boolean
Whether to install Clickhouse repository. Defaults to 'true'.
Default value: $clickhouse::params::manage_repo
Data type: String
Name of Clickhouse Server package to install. Defaults to 'clickhouse-server'.
Default value: $clickhouse::params::package_name
Data type: String
Whether the Clickhouse Server package should be present, absent or specific version. Valid values are 'present', 'absent' or 'x.y.z'. Defaults to 'present'.
Default value: $clickhouse::params::package_ensure
Data type: Boolean
Whether to manage Clickhouse Server package. Defaults to 'true'.
Default value: $clickhouse::params::manage_package
Data type: Array[String]
Array of install options for managed package resources. Appropriate options are passed to package manager.
Default value: $clickhouse::params::package_install_options
Data type: Boolean
Whether the Clickhouse Server configurations files should be managd. Defaults to 'true'.
Default value: $clickhouse::params::manage_config
Data type: Stdlib::Unixpath
Directory where Clickhouse Server configuration files will be stored. Defaults to '/etc/clickhouse-server/conf.d'.
Default value: $clickhouse::params::config_dir
Data type: Stdlib::Unixpath
Directory where Clickhouse Server user configuration files will be stored. Defaults to '/etc/clickhouse-server/users.d'.
Default value: $clickhouse::params::users_dir
Data type: Stdlib::Unixpath
Directory where Clickhouse Server dictionaries will be stored. Defaults to '/etc/clickhouse-server/dict'.
Default value: $clickhouse::params::dict_dir
Data type: Stdlib::Unixpath
Directory where Clickhouse Server database files will be stored. Defaults to '/var/lib/clickhouse/'.
Default value: $clickhouse::params::clickhouse_datadir
Data type: Stdlib::Unixpath
Directory where Clickhouse Server tmp files will be stored. Defaults to '/var/lib/clickhouse/tmp/'.
Default value: $clickhouse::params::clickhouse_tmpdir
Data type: String
Owner for Clickhouse Server configuration and data directories. Defaults to 'clickhouse'.
Default value: $clickhouse::params::clickhouse_user
Data type: String
Group for Clickhouse Server configuration and data directories. Defaults to 'clickhouse'.
Default value: $clickhouse::params::clickhouse_group
Data type: Boolean
Specifies whether to automatically remove default users, which are specified in users.xml file. Defaults to 'false'.
Default value: $clickhouse::params::keep_default_users
Data type: Optional[Hash[String, Any]]
Hash[String, Any] of override options to pass to Clickhouse Server configuration file.
Default value: {}
Data type: String
Name of the file, where Clickhouse Server configuration will be stored. See https://clickhouse.yandex/docs/en/operations/configuration_files/. Defaults to 'config.xml'
Default value: $clickhouse::params::config_file
Data type: String
Name of the file, where Clickhouse Server profiles configuration will be stored. See https://clickhouse.yandex/docs/en/operations/settings/settings_profiles/. Defaults to '$profiles.xml'.
Default value: $clickhouse::params::profiles_file
Data type: String
Name of the file, where Clickhouse Server quotas configuration will be stored. See https://clickhouse.yandex/docs/en/operations/quotas/. Defaults to 'quotas.xml'.
Default value: $clickhouse::params::quotas_file
Data type: String
Name of the file, where Clickhouse Server macros configuration for replication will be stored. See https://clickhouse.yandex/docs/en/operations/table_engines/replication/. Defaults to '$macros.xml'.
Default value: $clickhouse::params::macros_file
Data type: String
Name of the file, where Clickhouse Server zookeeper configuration will be stored. See https://clickhouse.yandex/docs/en/operations/table_engines/replication/. Defaults to 'zookeeper.xml'.
Default value: $clickhouse::params::zookeeper_config_file
Data type: String
Name of the file, where Clickhouse Server remote servers configuration for Distributed table engine will be stored. See https://clickhouse.yandex/docs/en/operations/table_engines/distributed/. Defaults to 'remote_servers.xml'.
Default value: $clickhouse::params::remote_servers_file
Data type: String
Path to a 'files' folder in puppet, where dictionary file are located. Defaults to 'puppet:///modules/${module_name}'.
Default value: $clickhouse::params::dict_source_folder
Data type: Boolean
Specifies whether to install Clickhouse Client package. Defaults to 'true'.
Default value: $clickhouse::params::install_client
Data type: String
Name of the Clickhouse Server service. Defaults to 'clickhouse-server'.
Default value: $clickhouse::params::service_name
Data type: Stdlib::Ensure::Service
Specifies whether Clickhouse Server service should be running. Defaults to 'running'.
Default value: $clickhouse::params::service_ensure
Data type: Boolean
Specifies whether Clickhouse Server service should be enabled. Defaults to 'true'.
Default value: $clickhouse::params::service_enabled
Data type: Boolean
Specifies whether Clickhouse Server service should be managed. Defaults to 'true'.
Default value: $clickhouse::params::manage_service
Data type: Boolean
Specifies whether Clickhouse Server service should be restated when configuration changes. Defaults to 'false'.
Default value: $clickhouse::params::restart
Data type: Optional[Clickhouse::Clickhouse_users]
Users, which are passed to clickhouse::server::user (see types/clickhouse_users.pp for data type description). See https://clickhouse.yandex/docs/en/operations/access_rights/.
Default value: undef
Data type: Optional[Hash[String, Hash[String, Any]]]
Profiles configuration, which are passed to clickhouse::server::profiles. See https://clickhouse.yandex/docs/en/operations/settings/settings_profiles/.
Default value: undef
Data type: Optional[Clickhouse::Clickhouse_quotas]
Quotas configuration, which are passed to clickhouse::server::quotas. See https://clickhouse.yandex/docs/en/operations/quotas/.
Default value: undef
Data type: Optional[Array[String]]
Dictionaries configuration, which are passed to clickhouse::server::dictionary. See https://clickhouse.yandex/docs/en/query_language/dicts/external_dicts/.
Default value: undef
Data type: Optional[Clickhouse::Clickhouse_replication]
Replication configuration parameters (see types/clickhouse_replication.pp for data type description). See https://clickhouse.yandex/docs/en/operations/table_engines/replication/.
Default value: undef
Data type: Optional[Clickhouse::Clickhouse_remote_servers]
Remote server configuration parameters for Distributed engine (see types/clickhouse_remote_servers.pp for data type description), which are passed to clickhouse::server::remote_servers. See https://clickhouse.yandex/docs/en/operations/table_engines/distributed/.
Default value: undef
Create and manage Clickhouse dictionary.
clickhouse::server::dictionary { 'countries.xml':
source => 'puppet:///modules/clickhouse/dictionaries',
}
The following parameters are available in the clickhouse::server::dictionary
defined type.
Name of the dictionary file in the $source and $dict_dir folders.
Data type: Stdlib::Unixpath
Path to folder with clickhouse dictionaries. Defaults to '/etc/clickhouse-server/dict'.
Default value: $clickhouse::server::dict_dir
Data type: String
Owner of the dictionary file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_user
Data type: String
Group of the dictionary file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_group
Data type: Enum['present', 'absent']
Specifies whether to create dictionary. Valid values are 'present', 'absent'. Defaults to 'present'.
Default value: 'present'
Data type: String
Path to a 'files' folder in puppet, where dictionary file are located. Defaults to 'puppet:///modules/${module_name}'.
Default value: "${clickhouse::server::dict_source_folder}/${title}"
Create and manage Clickhouse macros file for replication.
Create macros file /etc/clickhouse-server/conf.d/macros.xml with substitutions for cluster, replica and shard
clickhouse::server::macros { 'macros.xml':
config_folder => '/etc/clickhouse-server/conf.d',
macros => {
cluster => 'Clickhouse_cluster',
replica => 'myhost.local',
shard => '1',
},
}
The following parameters are available in the clickhouse::server::macros
defined type.
Name of the file with macros configurations.
Data type: Stdlib::Unixpath
Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/conf.d'.
Default value: $clickhouse::server::config_dir
Data type: String
Owner of the macros file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_user
Data type: String
Group of the macros file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_group
Data type: Enum['present', 'absent']
Specifies whether to create macros file. Valid values are 'present', 'absent'. Defaults to 'present'.
Default value: 'present'
Data type: Hash[String, Any]
Substitions in macros file.
Default value: {}
Create and manage Clickhouse profiles.
Create two profiles (web and readonly), which will be stored in /etc/clickhouse-server/users.d/profiles.xml file.
clickhouse::server::profiles { 'profiles.xml':
config_dir => '/etc/clickhouse-server/users.d',
profiles => {
web => {
max_threads => 8,
max_rows_to_read => 1000000000,
},
readonly => {
readonly => 1,
},
},
}
The following parameters are available in the clickhouse::server::profiles
defined type.
Name of the file with profiles configurations.
Data type: Stdlib::Unixpath
Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/users.d'.
Default value: $clickhouse::server::users_dir
Data type: String
Owner of the profiles file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_user
Data type: String
Group of the profiles file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_group
Data type: Enum['present', 'absent']
Specifies whether to create profiles file. Valid values are 'present', 'absent'. Defaults to 'present'.
Default value: 'present'
Data type: Hash[String, Hash[String, Any]]
Profiles configuration.
Default value: {}
Create and manage Clickhouse quotas.
clickhouse::server::quotas { 'quotas.xml':
config_dir => '/etc/clickhouse-server/users.d',
quotas => {
web => {
interval => [
{
duration => 3600,
queries => 2,
errors => 5,
result_rows => 1000,
read_rows => 1000,
execution_time => 5000,
},
{
duration => 86400,
queries => 2000,
errors => 50,
result_rows => 10000,
read_rows => 10000,
execution_time => 50000,
},
],
},
office => {
interval => [
{
duration => 3600,
queries => 256,
errors => 50,
result_rows => 3000,
read_rows => 3000,
execution_time => 5000,
}
],
},
},
}
The following parameters are available in the clickhouse::server::quotas
defined type.
Name of the file with quotas configurations.
Data type: Stdlib::Unixpath
Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/users.d'.
Default value: $clickhouse::server::users_dir
Data type: String
Owner of the quotas file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_user
Data type: String
Group of the quotas file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_group
Data type: Enum['present', 'absent']
Specifies whether to create quotas file. Valid values are 'present', 'absent'. Defaults to 'present'.
Default value: 'present'
Data type: Clickhouse::Clickhouse_quotas
Quotas configuraion.
Default value: {}
Create and manage Clickhouse remote servers for Distributed engine.
Create three Clickhouse clusters. Replicated - one shard with two replicas, segmented - two shards without replicas, segmented_replicated - two shards, each having two replicas.
clickhouse::server::remote_servers { 'remote_servers.xml':
remote_servers_file => '/etc/clickhouse-server/conf.d',
remote_servers => {
replicated => {
shard => {
weight => 1,
internal_replication => true,
replica => ['host1.local:9000', 'host2.local:9000'],
}
},
segmented => {
shard1 => {
internal_replication => true,
replica => ['host1.local:9000'],
},
shard2 => {
internal_replication => true,
replica => ['host2.local:9000'],
}
},
segmented_replicated => {
shard1 => {
internal_replication => true,
replica => ['host1.local:9000', 'host2.local:9000'],
},
shard2 => {
internal_replication => true,
replica => ['host3.local:9000', 'host4.local:9000'],
}
},
},
}
The following parameters are available in the clickhouse::server::remote_servers
defined type.
Name of the file with remote servers configurations.
Data type: Stdlib::Unixpath
Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/conf.d'.
Default value: $clickhouse::server::config_dir
Data type: String
Owner of the remote servers file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_user
Data type: String
Group of the remote servers file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_group
Data type: Enum['present', 'absent']
Specifies whether to create remote servers file. Valid values are 'present', 'absent'. Defaults to 'present'.
Default value: 'present'
Data type: Clickhouse::Clickhouse_remote_servers
Remote server configurations (see types/clickhouse_remote_servers.pp for data type description).
Default value: {}
Create and manage Clickhouse user.
clickhouse::server::user { 'alice':
password => 'HelloAlice',
quota => 'default',
profile => 'default',
allow_databases => ['web', 'data'],
networks => {
ip => ['::/0'],
},
}
The following parameters are available in the clickhouse::server::user
defined type.
Name of the Clickhouse user. Will be also used as a file name for user configuration file in $users_dir folder.
Data type: Optional[String]
Password for Clickhouse user. Can be specified in plaintext (and later hashed using sha256) or in sha256 format.
Default value: undef
Data type: String
Name of the quota for user.
Default value: 'default'
Data type: String
Name of the profile for user.
Default value: 'default'
Data type: Optional[Array[String]]
Array of databases, the user will have permissions to access.
Default value: undef
Data type: Optional[Clickhouse::Clickhouse_networks]
Clickhouse::Clickhouse_networks (see types/clickhouse_networks.pp) Restrictions for ip\hosts for user.
Default value: undef
Data type: Stdlib::Unixpath
Path to directory, where user configuration will be stored. Defaults to '/etc/clickhouse-server/users.d/'
Default value: $clickhouse::server::users_dir
Data type: String
Owner of the user file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_user
Data type: String
Group of the user file. Defaults to 'clickhouse'.
Default value: $clickhouse::server::clickhouse_group
Data type: Enum['present', 'absent']
Specifies whether to create user. Valid values are 'present', 'absent'. Defaults to 'present'.
Default value: 'present'
Manages a Clickhouse database.
The following properties are available in the clickhouse_database
type.
Valid values: present, absent
The basic property that the resource should be in.
Default value: present
The following parameters are available in the clickhouse_database
type.
namevar
The name of the Clickhouse database to manage.
Type: Ruby 3.x API
Convert hash to Clickhouse XML config.
The clickhouse_config function.
Returns: Xml
Сlickhouse XML configuration.
Data type: Hash
for Clickhouse Server.