Skip to content

Latest commit

 

History

History
960 lines (550 loc) · 22.6 KB

REFERENCE.md

File metadata and controls

960 lines (550 loc) · 22.6 KB

Reference

Table of Contents

Classes

Public Classes

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

Resource types

Functions

Classes

clickhouse::client

Installs and configures Clickhouse client.

Examples

Install Clickhouse client
class { 'clickhouse::client':
  package_name   => 'clickhouse-client',
  package_ensure => 'present',
}

Parameters

The following parameters are available in the clickhouse::client class.

manage_repo

Data type: Boolean

Whether to install Clickhouse repository. Defaults to 'true'.

Default value: $clickhouse::params::manage_repo

package_name

Data type: String

Name of Clickhouse client package to install. Defaults to 'clickhouse-client'.

Default value: $clickhouse::params::client_package_name

package_ensure

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

manage_package

Data type: Boolean

Whether to manage Clickhouse client package. Defaults to 'true'.

Default value: $clickhouse::params::client_manage_package

package_install_options

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

clickhouse::repo

Installs repository for Clickhouse.

Examples

include clickhouse::repo

clickhouse::server

Installs and configures Clickhouse server.

Examples

Install Clickhouse Server.
class { 'clickhouse::server':
  package_name   => 'clickhouse-server',
  package_ensure => '19.1.6-1.el7',
}

Parameters

The following parameters are available in the clickhouse::server class.

manage_repo

Data type: Boolean

Whether to install Clickhouse repository. Defaults to 'true'.

Default value: $clickhouse::params::manage_repo

package_name

Data type: String

Name of Clickhouse Server package to install. Defaults to 'clickhouse-server'.

Default value: $clickhouse::params::package_name

package_ensure

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

manage_package

Data type: Boolean

Whether to manage Clickhouse Server package. Defaults to 'true'.

Default value: $clickhouse::params::manage_package

package_install_options

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

manage_config

Data type: Boolean

Whether the Clickhouse Server configurations files should be managd. Defaults to 'true'.

Default value: $clickhouse::params::manage_config

config_dir

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

users_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

dict_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

clickhouse_datadir

Data type: Stdlib::Unixpath

Directory where Clickhouse Server database files will be stored. Defaults to '/var/lib/clickhouse/'.

Default value: $clickhouse::params::clickhouse_datadir

clickhouse_tmpdir

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

clickhouse_user

Data type: String

Owner for Clickhouse Server configuration and data directories. Defaults to 'clickhouse'.

Default value: $clickhouse::params::clickhouse_user

clickhouse_group

Data type: String

Group for Clickhouse Server configuration and data directories. Defaults to 'clickhouse'.

Default value: $clickhouse::params::clickhouse_group

keep_default_users

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

override_options

Data type: Optional[Hash[String, Any]]

Hash[String, Any] of override options to pass to Clickhouse Server configuration file.

Default value: {}

config_file

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

profiles_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

quotas_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

macros_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

zookeeper_config_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

remote_servers_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

dict_source_folder

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

install_client

Data type: Boolean

Specifies whether to install Clickhouse Client package. Defaults to 'true'.

Default value: $clickhouse::params::install_client

service_name

Data type: String

Name of the Clickhouse Server service. Defaults to 'clickhouse-server'.

Default value: $clickhouse::params::service_name

service_ensure

Data type: Stdlib::Ensure::Service

Specifies whether Clickhouse Server service should be running. Defaults to 'running'.

Default value: $clickhouse::params::service_ensure

service_enabled

Data type: Boolean

Specifies whether Clickhouse Server service should be enabled. Defaults to 'true'.

Default value: $clickhouse::params::service_enabled

manage_service

Data type: Boolean

Specifies whether Clickhouse Server service should be managed. Defaults to 'true'.

Default value: $clickhouse::params::manage_service

restart

Data type: Boolean

Specifies whether Clickhouse Server service should be restated when configuration changes. Defaults to 'false'.

Default value: $clickhouse::params::restart

users

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

profiles

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

quotas

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

dictionaries

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

replication

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

remote_servers

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

Defined types

clickhouse::server::dictionary

Create and manage Clickhouse dictionary.

Examples

Create a basic Clickhouse dictionary:
clickhouse::server::dictionary { 'countries.xml':
  source => 'puppet:///modules/clickhouse/dictionaries',
}

Parameters

The following parameters are available in the clickhouse::server::dictionary defined type.

name

Name of the dictionary file in the $source and $dict_dir folders.

dict_dir

Data type: Stdlib::Unixpath

Path to folder with clickhouse dictionaries. Defaults to '/etc/clickhouse-server/dict'.

Default value: $clickhouse::server::dict_dir

dict_file_owner

Data type: String

Owner of the dictionary file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_user

dict_file_group

Data type: String

Group of the dictionary file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_group

ensure

Data type: Enum['present', 'absent']

Specifies whether to create dictionary. Valid values are 'present', 'absent'. Defaults to 'present'.

Default value: 'present'

source

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}"

clickhouse::server::macros

Create and manage Clickhouse macros file for replication.

Examples

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',
    },
}

Parameters

The following parameters are available in the clickhouse::server::macros defined type.

name

Name of the file with macros configurations.

config_dir

Data type: Stdlib::Unixpath

Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/conf.d'.

Default value: $clickhouse::server::config_dir

macros_file_owner

Data type: String

Owner of the macros file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_user

macros_file_group

Data type: String

Group of the macros file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_group

ensure

Data type: Enum['present', 'absent']

Specifies whether to create macros file. Valid values are 'present', 'absent'. Defaults to 'present'.

Default value: 'present'

macros

Data type: Hash[String, Any]

Substitions in macros file.

Default value: {}

clickhouse::server::profiles

Create and manage Clickhouse profiles.

Examples

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,
    },
  },
}

Parameters

The following parameters are available in the clickhouse::server::profiles defined type.

name

Name of the file with profiles configurations.

users_dir

Data type: Stdlib::Unixpath

Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/users.d'.

Default value: $clickhouse::server::users_dir

profiles_file_owner

Data type: String

Owner of the profiles file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_user

profiles_file_group

Data type: String

Group of the profiles file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_group

ensure

Data type: Enum['present', 'absent']

Specifies whether to create profiles file. Valid values are 'present', 'absent'. Defaults to 'present'.

Default value: 'present'

profiles

Data type: Hash[String, Hash[String, Any]]

Profiles configuration.

Default value: {}

clickhouse::server::quotas

Create and manage Clickhouse quotas.

Examples

Create two quotas (web with two intervals, office with one).
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,
        }
      ],
    },
  },
}

Parameters

The following parameters are available in the clickhouse::server::quotas defined type.

name

Name of the file with quotas configurations.

users_dir

Data type: Stdlib::Unixpath

Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/users.d'.

Default value: $clickhouse::server::users_dir

quotas_file_owner

Data type: String

Owner of the quotas file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_user

quotas_file_group

Data type: String

Group of the quotas file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_group

ensure

Data type: Enum['present', 'absent']

Specifies whether to create quotas file. Valid values are 'present', 'absent'. Defaults to 'present'.

Default value: 'present'

quotas

Data type: Clickhouse::Clickhouse_quotas

Quotas configuraion.

Default value: {}

clickhouse::server::remote_servers

Create and manage Clickhouse remote servers for Distributed engine.

Examples

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'],
      }
    },
  },
}

Parameters

The following parameters are available in the clickhouse::server::remote_servers defined type.

name

Name of the file with remote servers configurations.

config_dir

Data type: Stdlib::Unixpath

Path to Clickhouse configuration folder. Defaults to '/etc/clickhouse-server/conf.d'.

Default value: $clickhouse::server::config_dir

remote_servers_file_owner

Data type: String

Owner of the remote servers file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_user

remote_servers_file_group

Data type: String

Group of the remote servers file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_group

ensure

Data type: Enum['present', 'absent']

Specifies whether to create remote servers file. Valid values are 'present', 'absent'. Defaults to 'present'.

Default value: 'present'

remote_servers

Data type: Clickhouse::Clickhouse_remote_servers

Remote server configurations (see types/clickhouse_remote_servers.pp for data type description).

Default value: {}

clickhouse::server::user

Create and manage Clickhouse user.

Examples

Create Clickhouse user.
clickhouse::server::user { 'alice':
  password        => 'HelloAlice',
  quota           => 'default',
  profile         => 'default',
  allow_databases => ['web', 'data'],
  networks        => {
    ip => ['::/0'],
  },
}

Parameters

The following parameters are available in the clickhouse::server::user defined type.

name

Name of the Clickhouse user. Will be also used as a file name for user configuration file in $users_dir folder.

password

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

quota

Data type: String

Name of the quota for user.

Default value: 'default'

profile

Data type: String

Name of the profile for user.

Default value: 'default'

allow_databases

Data type: Optional[Array[String]]

Array of databases, the user will have permissions to access.

Default value: undef

networks

Data type: Optional[Clickhouse::Clickhouse_networks]

Clickhouse::Clickhouse_networks (see types/clickhouse_networks.pp) Restrictions for ip\hosts for user.

Default value: undef

users_dir

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

user_file_owner

Data type: String

Owner of the user file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_user

user_file_group

Data type: String

Group of the user file. Defaults to 'clickhouse'.

Default value: $clickhouse::server::clickhouse_group

ensure

Data type: Enum['present', 'absent']

Specifies whether to create user. Valid values are 'present', 'absent'. Defaults to 'present'.

Default value: 'present'

Resource types

clickhouse_database

Manages a Clickhouse database.

Properties

The following properties are available in the clickhouse_database type.

ensure

Valid values: present, absent

The basic property that the resource should be in.

Default value: present

Parameters

The following parameters are available in the clickhouse_database type.

name

namevar

The name of the Clickhouse database to manage.

Functions

clickhouse_config

Type: Ruby 3.x API

Convert hash to Clickhouse XML config.

clickhouse_config(Hash $Settings)

The clickhouse_config function.

Returns: Xml Сlickhouse XML configuration.

Settings

Data type: Hash

for Clickhouse Server.