clickhouse
: this class allows you to install ClickHouse DB's repo, client and serverclickhouse::client
: ClickHouse client classclickhouse::repo
: installs repository with ClickHouse DBMSclickhouse::server
: ClickHouse server classclickhouse::server::config::default_localhost
: Restricts network access fordefault
clickhouse::server::config::memory
: Configure memory consumptionclickhouse::server::config::zookeeper
: Set proper zookeeper config
clickhouse::client::config
: generates xml config from hash via ruby xml-simpleclickhouse::error
: Implements error logging with continue of manifests applicationclickhouse::server::config
: generates xml config from hash via ruby xml-simpleclickhouse::server::config::profile
: Define ClickHouse profileclickhouse::server::config::user
: Define ClickHouse users
clickhouse_database
: Manages databases on ClickHouse server
Top level class for ClickHouse DBMS installation and management.
include clickhouse
class { 'clickhouse':
server => true,
}
class { 'clickhouse':
server => true,
client => true,
manage_repo => true,
}
The following parameters are available in the clickhouse
class.
Data type: Boolean
Is clickhouse-server should be installed or not. It won't be installed by default, because some time you need the client only.
Default value: false
Data type: Boolean
Is clickhouse-client should be installed or not.
Default value: true
Data type: Boolean
Is apt or yum repository should be managed. Set to false
by default to not affect your own repositories policy.
Default value: false
Data type: String[1]
User for configs owning. Strongly recommended staying default.
It's highly unrecommended to change default user, but feel free to shot in a knee. You have to adjust as well the data directory and the whole configs everywhere.
Default value: 'clickhouse'
Data type: String[1]
Group for configs, see user
parameter.
Default value: $user
The class installs clickhouse-client.
include clickhouse::client
class { 'clickhouse::client':
package_name => 'clickhouse-client-custom',
package_ensure => 'hold',
user => 'custom-user',
config_d_dir => '/some/path',
}
The following parameters are available in the clickhouse::client
class.
Data type: String[1]
Package to be installed.
Default value: 'clickhouse-client'
Data type: String[1]
Client package ensure
. See ensure
attribute for package
resource.
Default value: 'installed'
Data type: Optional[Stdlib::Unixpath]
Deprecated, use config_d_dir.
Default value: undef
Data type: Stdlib::Unixpath
Directory for custom configs. Unmanaged configs will be removed from the dirrectory during puppet running.
Default value: $conf_d_dir
Installs yum or apt repository for ClickHouse DBMS.
Uses Altinity repository for yum and yandex for apt.
include clickhouse::repo
The class installs ClickHouse server and manages service
include clickhouse::server
class { 'clickhouse::server':
package_name => 'clickhouse-server-custom',
package_ensure => 'latest',
service_name => 'clickhouse-server',
service_ensure => false,
service_enable => false,
}
The following parameters are available in the clickhouse::server
class.
Data type: String[1]
Server package to be installed.
Default value: 'clickhouse-server'
Data type: String[1]
Server package ensure. See ensure
attribute for package
resource.
Default value: 'installed'
Data type: String[1]
Name of the managed service for clickhouse-server.
Default value: $package_name
Data type: Variant[Boolean, Enum[ 'running', 'stopped' ]]
Desired state for $service_name
, see ensure
for service
resource.
Default value: 'running'
Data type: Variant[Boolean, Enum[ 'manual', 'mask' ]]
If $service_name
should be enabled, see enable
for service
resource.
Default value: true
Data type: Boolean
If true, every config managed by this module and requires for server restart will trigger service refresh.
Default value: true
Data type: Optional[Stdlib::Unixpath]
Deprecated, use config_dir
Default value: undef
Data type: Stdlib::Unixpath
Directory with clickhouse-server configuration.
Default value: $conf_dir
Data type: Optional[Stdlib::Unixpath]
Deprecated, use config_d_dir
Default value: undef
Data type: Stdlib::Unixpath
Directory with clickhouse-server included configuration. Unmanaged configs will be removed from the directory during puppet run.
Default value: $conf_d_dir
Data type: Stdlib::Unixpath
Directory with clickhouse-server users configuration. Unmanaged configs will be removed from the directory during puppet run.
Default value: "${config_dir}/users.d"
clickhouse::server::config::default_localhost
By default, ClickHouse listens only localhost and user default
is able to connect from anywhere.
This class, if included, restricts network access.
include clickhouse::server::config::default_localhost
clickhouse::server::config::memory This class provide basic memory adjustment for keep ClickHouse server in reasonable limits
- See also
include clickhouse::server::config::memory
The following parameters are available in the clickhouse::server::config::memory
class.
Data type: Integer[0]
Memory to leave for system usage and CH overheads like merges and mutations
Default value: 4294967296
Data type: Integer[0]
See CH documentation
Default value: 5368709120
Data type: Optional[Integer[0]]
See CH documentation
Default value: undef
Data type: Optional[Integer[0]]
See CH documentation
Default value: undef
Data type: Optional[Integer[0]]
See CH documentation
Default value: undef
Data type: Boolean
See CH documentation
Default value: true
Data type: Boolean
See CH documentation
Default value: true
Data type: Boolean
See CH documentation
Default value: true
Data type: Boolean
Check if class has proper parameters and raise errors otherwise
Default value: true
Data type: Boolean
If ClickHouse server should be restarted on the config update
Default value: $clickhouse::server::config_service_notify
clickhouse::server::config::zookeeper Set proper zookeeper config
class { 'clickhouse::server::config::zookeeper':
nodes => { 'server1' => 1},
user => 'user',
password => 'password',
}
The following parameters are available in the clickhouse::server::config::zookeeper
class.
Data type: Hash[String[1], Integer[1, 255]]
hash of zk_server
: id
to define nodes
Data type: Integer[1, 65536]
cilent port of zookeeper cluster
Default value: 2181
Data type: Integer[1]
maximum timeout for client session in milliseconds
Default value: 30000
Data type: Integer[1]
maximum timeout for operation in milliseconds
Default value: 10000
Data type: Optional[Stdlib::Unixpath]
ZNode, that is used as root for znodes used by ClickHouse server
Default value: undef
Data type: Optional[String[1]]
user if zookeeper uses authorization
Default value: undef
Data type: Optional[String[1]]
password if zookeeper uses authorization
Default value: undef
Data type: String[1]
zookeeper nodes, ports and optional user and password are confidential data and normally should not be readable
Default value: '0440'
Data type: Boolean
If ClickHouse server should be restarted on the config update
Default value: $clickhouse::server::config_service_notify
This type creates custom configuration files for clickhouse-client.
clickhouse::client::config { 'prompt':
data => {'prompt_by_server_display_name' => [{
'experimental' => ['{display_name} \x01\e[1;35m\x02:)\x01\e[0m\x02 '],
}]},
}
#
# Will create file `/etc/clickhouse-client/conf.d/prompt.xml`:
# <config>
# <prompt_by_server_display_name>
# <experimental>{display_name} \x01\e[1;35m\x02:)\x01\e[0m\x02 </experimental>
# </prompt_by_server_display_name>
# </config>
The following parameters are available in the clickhouse::client::config
defined type.
Data type: Hash
This hash will be converted into xml config placed in $clickhouse::client::config_d_dir
.
Root will be <config>
by default.
Data type: Enum[ 'present', 'file', 'absent' ]
Subset of attribute ensure
for file
resource.
Default value: 'present'
Data type: String[1]
Desired permissions mode for the config file, see mode
attribute for file
resource.
Default value: '0644'
clickhouse::error
Implements error which cause 6 exit code with --detailed-exitcodes
argument for puppet run
.
Work around notifying about severe problem
clickhouse::error { 'Error message':
}
This type creates custom configuration files for clickhouse-server.
clickhouse::server::config { 'macros':
data => {'macros' => [
{'hostname' => ['host.domain.TLD'],}
]},
section => 'config',
}
#
# Will create file `/etc/clickhouse-server/conf.d/macros.xml`:
# <yandex>
# <macros>
# <hostname>host.domain.TLD</hostname>
# </macros>
# </yandex>
The following parameters are available in the clickhouse::server::config
defined type.
Data type: Hash
This hash will be converted into xml config placed in $clickhouse::server::config_d_dir
.
Root will be <yandex>
by default.
Data type: Enum['config', 'users']
Should the file be created in configs or users include directory.
Data type: Enum[ 'present', 'file', 'absent' ]
Subset of attribute ensure
for file
type.
Default value: 'present'
Data type: String[1]
Desired permissions mode for the config file, see mode
attribute for file
resource.
Default value: '0644'
Data type: Boolean
If service should be restarted on the config changing.
Default value: false
This type defines the ClickHouse profile with specified options
clickhouse::server::config::profile { 'profile_name':
databases => {
'db_name' => {
'table_name' => ['filter'],
'another_table_name' => ['another filter'],
},
},
}
The following parameters are available in the clickhouse::server::config::profile
defined type.
Data type: String[1]
User profile
Default value: $title
Data type: Hash
Profile settings
This type defines the ClickHouse users with specified parameters
- See also
clickhouse::server::config::user { 'username':
network => {
'ip' => [
'::',
'0.0.0.0',
],
'host' => [
'host1.local',
'host2.local',
],
'host_regexp' => [
'[^.]*\.domain\.TLD',
],
},
profile => 'profile_name',
quota => 'quota_name',
password => 'password',
databases => {
'db_name' => {
'table_name' => ['filter'],
'another_table_name' => ['another filter'],
},
},
}
The following parameters are available in the clickhouse::server::config::user
defined type.
Data type: Struct[{ Optional[ip] => Array[String[1], 1], Optional[host] => Array[String[1], 1], Optional[host_regexp] => Array[String[1], 1], }]
Defines network nodes where from user could connect
Data type: String[1]
User profile
Default value: 'default'
Data type: String[1]
User quota
Default value: 'default'
Data type: String[1]
User name
Default value: $title
Data type: String[0]
Plaintext password. Will be hashed into sha256 format in xml file
Default value: ''
Data type: Optional[ Pattern[/\A[0-9a-fA-F]{64}\Z/] ]
Optional parameter. If defined, $password
must not be defined
Default value: undef
Data type: Optional[Hash]
Optional hash of allowed DBs, tables and filters to implement ACLs
Default value: undef
Data type: Optional[Array[String[1]]]
Optional parameter to restrict access to specified databases
Default value: undef
Data type: Optional[Array[String[1]]]
Optional parameter to restrict access to specified dictionaries
Default value: undef
Manages databases on ClickHouse server
The following properties are available in the clickhouse_database
type.
Valid values: Lazy
, MySQL
, Ordinary
Engine of the database
Default value: Ordinary
Valid values: present
, absent
CREATE or DROP DATABASE
Default value: present
The following parameters are available in the clickhouse_database
type.
This parameter depends on the engine
parameter:
Lazy: must be Integer[1]
MySQL: must be Array[String, 4, 4]
Ordinary: must be undefined
See: https://clickhouse.tech/docs/en/engines/database_engines/
Valid values: true
, false
, yes
, no
DROP database even if it contains tables
If ENGINE=MySQL for an existing database, it will be dropped anyway since it's just a connector
Default value: false
namevar
Name of the database
The specific backend to use for this clickhouse_database
resource. You will seldom need to specify this --- Puppet
will usually discover the appropriate provider for your platform.