diff --git a/README.md b/README.md index fe1b42e..72cbe32 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Server configuration directory. Server log level. - clickhouse_profiles: + clickhouse_profiles: default: max_memory_usage: 10000000000 use_uncompressed_cache: 0 @@ -28,7 +28,7 @@ Server log level. A settings profile is a collection of [settings](https://clickhouse.tech/docs/en/operations/settings/settings-profiles/) grouped under the same name. - clickhouse_profiles: + clickhouse_profiles: default: password: "qwerty" profile: "default" @@ -36,7 +36,7 @@ A settings profile is a collection of [settings](https://clickhouse.tech/docs/en The `users` section of the `user.xml` configuration file contains user [settings](https://clickhouse.tech/docs/en/operations/settings/settings-users/). - clickhouse_profiles: + clickhouse_profiles: default: intervals: - duration: 3600 @@ -48,14 +48,14 @@ The `users` section of the `user.xml` configuration file contains user [setting Quota [settings](https://clickhouse.tech/docs/en/operations/settings/settings-profiles/) is for limiting resource usage over a period of time or track the use of resources. - clickhouse_databases: + clickhouse_databases: - these_metrics - other_metrics - imported_data **clickhouse_databases** is a list of the databases you want to create in ClickHouse. - clickhouse_zookeeper_hosts: + clickhouse_zookeeper_hosts: - 1.2.3.4 - 1.2.3.5 @@ -69,9 +69,37 @@ Quota [settings](https://clickhouse.tech/docs/en/operations/settings/settings-pr For debugging purposes it is better to start just with one host and then add more hosts. **clickhouse_zookeeper_credentials** in format ``username:password`` is used to authenticate against Zookeeper. + **clickhouse_path**: Path to the directory where ClickHouse will store data + **clickhouse_log_directory**: Path to the error and normal logs. +**clickhouse_clusters**: is the list of clusters and also contains the shards that are part of each cluster. + + clickhouse_clusters: + distributed_cluster_1: + shard1: + - { host: "host_1", port: 9000 } + - { host: "host_2", port: 9000 } + shard2: + - { host: "host_3", port: 9000 } + - { host: "host_4", port: 9000 } + distributed_cluster_2: + shard1: + - { host: "host_5", port: 9000 } + - { host: "host_6", port: 9000 } + shard2: + - { host: "host_7", port: 9000 } + - { host: "host_8", port: 9000 } + +For the file macros.xml, you need to fill the variables below: + +**clickhouse_cluster**: is the cluster name which is used for replication. + +**clickhouse_distributed_cluster**: is the distributed cluster name defined in **clickhouse_clusters**. + +**clickhouse_shard**: is the shard number (01, 02) that being part of the replication inside one shard. + ## Dependencies None. diff --git a/templates/macros.xml.j2 b/templates/macros.xml.j2 index c96360d..7f63850 100644 --- a/templates/macros.xml.j2 +++ b/templates/macros.xml.j2 @@ -2,9 +2,9 @@ - {{ cluster }} - {{ shard }} + {{ clickhouse_cluster }} + {{ clickhouse_shard }} {{ inventory_hostname }} - {{ distributed_cluster }} + {{ clickhouse_distributed_cluster }} diff --git a/vars/main.yml b/vars/main.yml index 7e06810..268122c 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,6 @@ --- clickhouse_group: clickhouse clickhouse_user: clickhouse +clickhouse_shard: 01 +clickhouse_cluster: clickhouse-cluster +clickhouse_distributed_cluster: distributed_cluster