サーバー設定
このセクションでは、サーバー設定について説明します。これらはセッションやクエリ単位では変更できない設定です。
ClickHouse における設定ファイルの詳細については、「Configuration Files」 を参照してください。
その他の設定については、「Settings」セクションで説明しています。
設定について理解する前に、Configuration files セクションを読み、置換(incl および optional 属性)の使い方に注意することを推奨します。
abort_on_logical_error
access_control_improvements
アクセス制御システムに対する任意の改善用設定です。
| Setting | Description | Default |
|---|---|---|
users_without_row_policies_can_read_rows | 行ポリシーを持たないユーザーでも、SELECT クエリを使用して行を読み取れるかどうかを設定します。たとえば、ユーザー A と B がいて、行ポリシーが A に対してのみ定義されている場合、この設定が true であれば、ユーザー B はすべての行を閲覧できます。この設定が false の場合、ユーザー B はいずれの行も閲覧できません。 | true |
on_cluster_queries_require_cluster_grant | ON CLUSTER クエリに CLUSTER 権限が必要かどうかを設定します。 | true |
select_from_system_db_requires_grant | SELECT * FROM system.<table> を実行する際に、権限が必要かどうか、また任意のユーザーが実行できるかどうかを設定します。true に設定した場合、このクエリには system 以外のテーブルと同様に GRANT SELECT ON system.<table> が必要です。例外として、いくつかの system テーブル(tables、columns、databases、および one、contributors のような一部の定数テーブル)は引き続き全ユーザーが参照可能です。また、SHOW 権限(例: SHOW USERS)が付与されている場合、対応する system テーブル(つまり system.users)にはアクセスできます。 | true |
select_from_information_schema_requires_grant | SELECT * FROM information_schema.<table> を実行する際に、権限が必要かどうか、また任意のユーザーが実行できるかどうかを設定します。true に設定した場合、このクエリには通常のテーブルと同様に GRANT SELECT ON information_schema.<table> が必要です。 | true |
settings_constraints_replace_previous | ある設定に対する設定プロファイル内の制約が、その設定に対して以前に定義された制約(他のプロファイル内で定義されたもの)の動作を、新しい制約で値が設定されていないフィールドも含めて打ち消すかどうかを設定します。また、changeable_in_readonly 制約タイプを有効にします。 | true |
table_engines_require_grant | 特定のテーブルエンジンを用いてテーブルを作成する際に、権限が必要かどうかを設定します。 | false |
role_cache_expiration_time_seconds | 最終アクセスからの経過秒数として、ロールが Role Cache に保持される時間を設定します。 | 600 |
Example:
access_control_path
ClickHouse サーバーが、SQL コマンドで作成されたユーザーおよびロールの設定を格納するディレクトリへのパス。
関連項目
aggregate_function_group_array_action_when_limit_is_reached
throw するか、超過した値を discard するかを指定します
aggregate_function_group_array_max_element_size
allow_feature_tier
異なる機能ティアごとの設定をユーザーが変更できるかどうかを制御します。
0- すべての設定の変更が許可されます(experimental、beta、production)。1- beta および production の機能設定のみ変更が許可されます。experimental 設定の変更は拒否されます。2- production の設定のみ変更が許可されます。experimental および beta の設定の変更は拒否されます。
これは、すべての EXPERIMENTAL / BETA 機能に読み取り専用の制約を設定するのと同等です。
値が 0 の場合、すべての設定を変更できます。
allow_impersonate_user
IMPERSONATE 機能(EXECUTE AS target_user)を有効または無効にします。
allow_implicit_no_password
'IDENTIFIED WITH no_password' が明示的に指定されていない限り、ユーザーをパスワードなしで作成することを禁止します。
allow_no_password
安全ではないパスワード種別である no_password を許可するかどうかを設定します。
allow_plaintext_password
プレーンテキストのパスワード方式(安全ではない)を許可するかどうかを設定します。
allow_use_jemalloc_memory
allowed_disks_for_table_engines
Iceberg で使用が許可されているディスクの一覧
async_insert_queue_flush_on_shutdown
true の場合、グレースフルシャットダウン時に非同期挿入キューがフラッシュされます
async_insert_threads
async_load_databases
データベースおよびテーブルの非同期ロード。
trueの場合、すべての非システムデータベースのうち、エンジンがOrdinary、Atomic、Replicatedのものは、ClickHouse サーバーの起動後に非同期でロードされます。system.asynchronous_loaderテーブルおよびtables_loader_background_pool_size、tables_loader_foreground_pool_sizeサーバー設定を参照してください。まだロードされていないテーブルへアクセスしようとするクエリは、そのテーブルが起動して利用可能になるまで待機します。ロードジョブが失敗した場合、クエリは(async_load_databases = falseの場合のようにサーバー全体をシャットダウンするのではなく)エラーを再スローします。少なくとも 1 つのクエリが待機しているテーブルは、より高い優先度でロードされます。データベースに対する DDL クエリは、そのデータベースが起動して利用可能になるまで待機します。また、待機中のクエリ総数に対する制限としてmax_waiting_queriesの設定も検討してください。falseの場合、すべてのデータベースはサーバー起動時にロードされます。
例
async_load_system_database
system データベース内に多数のログテーブルやパーツがある場合に有用な、システムテーブルの非同期読み込みを有効にします。async_load_databases 設定とは独立しています。
trueに設定した場合、ClickHouse サーバー起動後に、Ordinary、Atomic、Replicatedエンジンを持つすべてのsystemデータベースが非同期に読み込まれます。system.asynchronous_loaderテーブル、およびサーバー設定tables_loader_background_pool_sizeとtables_loader_foreground_pool_sizeを参照してください。まだ読み込まれていないシステムテーブルへアクセスしようとするクエリは、そのテーブルの読み込みが完了するまで待機します。少なくとも 1 件のクエリから待機されているテーブルは、より高い優先度で読み込まれます。また、待機中のクエリ総数を制限するためにmax_waiting_queries設定の利用も検討してください。falseに設定した場合、システムデータベースはサーバー起動前に読み込まれます。
例
asynchronous_heavy_metrics_update_period_s
asynchronous_insert_log
非同期インサートのログを記録するための asynchronous_insert_log システムテーブルの設定。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
例
asynchronous_metric_log
ClickHouse Cloud のデプロイメントでは、デフォルトで有効になっています。
お使いの環境でこの設定がデフォルトで有効になっていない場合は、ClickHouse のインストール方法に応じて、以下の手順に従って設定を有効化または無効化できます。
有効化
非同期メトリックログ履歴の収集 system.asynchronous_metric_log を手動で有効にするには、次の内容で /etc/clickhouse-server/config.d/asynchronous_metric_log.xml を作成します。
無効化
asynchronous_metric_log 設定を無効にするには、次の内容のファイル /etc/clickhouse-server/config.d/disable_asynchronous_metric_log.xml を作成します:
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
asynchronous_metrics_enable_heavy_metrics
asynchronous_metrics_update_period_s
auth_use_forwarded_address
プロキシ経由で接続されたクライアントに対して、認証時に元の発信元アドレスを使用します。
転送されたアドレスは容易に偽装できるため、この設定は細心の注意を払って使用する必要があります。そのような認証を受け入れるサーバーには、直接アクセスせず、必ず信頼できるプロキシ経由でのみアクセスするようにしてください。
background_buffer_flush_schedule_pool_size
background_common_pool_size
background_distributed_schedule_pool_size
background_fetches_pool_size
background_merges_mutations_concurrency_ratio
スレッド数に対する、同時に実行できるバックグラウンドのマージおよびミューテーション処理数の比率を設定します。
たとえば、この比率が 2 で、background_pool_size が 16 に設定されている場合、ClickHouse は 32 個のバックグラウンドマージを同時に実行できます。これは、バックグラウンド処理を一時停止および延期できるためです。これは、小さいマージにより高い実行優先度を与えるために必要です。
この比率は実行時には増やすことしかできません。値を下げるにはサーバーを再起動する必要があります。
background_pool_size 設定と同様に、background_merges_mutations_concurrency_ratio も後方互換性のために default プロファイルから適用できます。
background_merges_mutations_scheduling_policy
バックグラウンドマージおよびミューテーションのスケジューリング方法を決定するポリシーです。指定可能な値は round_robin と shortest_task_first です。
バックグラウンドスレッドプールが、次に実行するマージまたはミューテーションを選択する際に用いるアルゴリズムです。ポリシーはサーバーの再起動なしに、実行時に変更できます。
後方互換性のために default プロファイルから適用することができます。
設定可能な値:
round_robin— すべての同時マージおよびミューテーションは、ラウンドロビン順に実行され、飢餓状態が発生しないようにします。小さいマージはマージ対象のブロック数が少ないため、大きいマージよりも速く完了します。shortest_task_first— 常にサイズの小さいマージまたはミューテーションを実行します。マージおよびミューテーションには、結果のサイズに基づいて優先度が割り当てられます。サイズの小さいマージは大きいマージよりも厳密に優先されます。このポリシーは小さいパーツを可能な限り速くマージすることを保証しますが、INSERTが大量に発生しているパーティションでは、大きなマージが無期限に実行されないまま飢餓状態になる可能性があります。
background_message_broker_schedule_pool_size
background_move_pool_size
background_pool_size
MergeTree エンジンを使用するテーブルに対して、バックグラウンドでマージおよびミューテーションを実行するスレッド数を設定します。
- この設定は、後方互換性のために、ClickHouse サーバー起動時に
defaultプロファイルの設定から適用することもできます。 - 実行中に変更できるのは、スレッド数を増やす場合のみです。
- スレッド数を減らすにはサーバーを再起動する必要があります。
- この設定を調整することで、CPU とディスクの負荷を制御できます。
プールサイズを小さくすると CPU とディスクのリソース消費は減りますが、バックグラウンド処理の進行が遅くなり、最終的にはクエリ性能に影響を与える可能性があります。
この値を変更する前に、次のような関連する MergeTree 設定も確認してください。
number_of_free_entries_in_pool_to_lower_max_size_of_merge.number_of_free_entries_in_pool_to_execute_mutation.number_of_free_entries_in_pool_to_execute_optimize_entire_partition
例
background_schedule_pool_max_parallel_tasks_per_type_ratio
background_schedule_pool_size
backup_log
BACKUP および RESTORE 操作を記録するための backup_log システムテーブル用の設定。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
例
backup_threads
BACKUP リクエストを実行するスレッド数の上限。
backups
BACKUP および RESTORE ステートメントを実行する際に使用されるバックアップ設定です。
次の設定はサブタグごとに構成できます。
| 設定 | 型 | 概要 | デフォルト |
|---|---|---|---|
allow_concurrent_backups | Bool | 同一ホスト上で複数のバックアップ処理を同時に実行できるかどうかを制御します。 | true |
allow_concurrent_restores | Bool(ブール) | 同一ホストで複数の復元処理を並行実行できるかどうかを指定します。 | true |
allowed_disk | 文字列 | File() を使用する際にバックアップ先として利用するディスク。この設定を行わないと File() は使用できません。 | `` |
allowed_path | String | File() 使用時のバックアップ先パス。この設定を指定しないと File は使用できません。 | `` |
attempts_to_collect_metadata_before_sleep | UInt | 収集したメタデータを比較して不整合があった場合に、スリープに入る前にメタデータの収集を再試行する回数。 | 2 |
collect_metadata_timeout | UInt64 | バックアップ時のメタデータ収集のタイムアウト(ミリ秒単位)。 | 600000 |
compare_collected_metadata | Bool | true の場合、収集したメタデータを既存のメタデータと比較し、バックアップ中に変更されていないことを検証します。 | true |
create_table_timeout | UInt64 | 復元中のテーブル作成タイムアウト(ミリ秒)。 | 300000 |
max_attempts_after_bad_version | UInt64 | 協調バックアップ/リストア処理中に「bad version」エラーが発生した場合に行う再試行の最大回数。 | 3 |
max_sleep_before_next_attempt_to_collect_metadata | UInt64 | 次回のメタデータ収集試行までの最大スリープ時間(ミリ秒)。 | 100 |
min_sleep_before_next_attempt_to_collect_metadata | UInt64 | 次のメタデータ収集を試行するまでの最小スリープ時間(ミリ秒)。 | 5000 |
remove_backup_files_after_failure | Bool | BACKUP コマンドが失敗した場合、ClickHouse は失敗が発生する前にバックアップにコピーされたファイルを削除しようとしますが、削除できなかったファイルについてはコピーされたまま残します。 | true |
sync_period_ms | UInt64 | バックアップ/リストアを連携して実行するための同期間隔(ミリ秒単位)。 | 5000 |
test_inject_sleep | Bool | テスト用スリープ処理 | false |
test_randomize_order | Bool | true に設定すると、テスト目的で一部の操作の実行順序をランダム化します。 | false |
zookeeper_path | String | ON CLUSTER 句使用時に、バックアップおよびリストアのメタデータが保存される ZooKeeper 内のパス。 | /clickhouse/backups |
この設定はデフォルトで次のように構成されています:
backups_io_thread_pool_queue_size
Backups IO Thread プールにスケジュールできるジョブの最大数です。現在の S3 バックアップのロジック上、このキューは無制限のままにしておくことが推奨されます。
0(デフォルト)の値は無制限を意味します。
bcrypt_workfactor
bcrypt_password 認証タイプで使用される Bcrypt アルゴリズム のワークファクタです。
ワークファクタは、ハッシュの計算およびパスワード検証に必要な計算量と時間を定義します。
認証処理を頻繁に行うアプリケーションでは、 高いワークファクター設定時の bcrypt の計算コストを考慮し、 別の認証方式の利用を検討してください。
blob_storage_log
blob_storage_log システムテーブルに関する設定です。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
例:
builtin_dictionaries_reload_interval
組み込みディクショナリを再読み込みするまでの間隔を秒単位で指定します。
ClickHouse は、組み込みディクショナリを x 秒ごとに再読み込みします。これにより、サーバーを再起動することなくディクショナリを即時に編集できます。
例
cache_size_to_ram_max_ratio
cannot_allocate_thread_fault_injection_probability
cgroups_memory_usage_observer_wait_time
サーバーの最大許容メモリ使用量を、cgroups 内の対応するしきい値に基づいて調整する際の、秒単位の間隔。
cgroup オブザーバーを無効にするには、この値を 0 に設定します。
compiled_expression_cache_elements_size
compiled_expression_cache_size
compression
MergeTree エンジンのテーブルに対するデータ圧縮設定です。
ClickHouse を使い始めたばかりの場合は、この設定は変更しないことをお勧めします。
設定テンプレート:
<case> フィールド:
min_part_size– データパートの最小サイズ。min_part_size_ratio– データパートサイズとテーブルサイズの比率。method– 圧縮方式。指定可能な値:lz4,lz4hc,zstd,deflate_qpl。level– 圧縮レベル。Codecs を参照。
複数の <case> セクションを設定できます。
条件が満たされたときの動作:
- データパートがいずれかの条件セットに一致した場合、ClickHouse は指定された圧縮方式を使用します。
- データパートが複数の条件セットに一致した場合、ClickHouse は最初に一致した条件セットを使用します。
データパートに対していずれの条件も満たされない場合、ClickHouse は lz4 圧縮を使用します。
例
concurrent_threads_scheduler
concurrent_threads_soft_limit_num と concurrent_threads_soft_limit_ratio_to_cores で指定された CPU スロットをどのようにスケジューリングするかを決定するポリシーです。制限された数の CPU スロットを同時実行クエリ間でどのように分配するかを制御するアルゴリズムでもあります。スケジューラは、サーバーを再起動することなく実行時に変更できます。
設定可能な値:
round_robin—use_concurrency_control= 1 に設定された各クエリは、最大でmax_threads個の CPU スロットを確保します。スレッドごとに 1 スロットです。競合が発生した場合、CPU スロットはクエリ間でラウンドロビン方式で割り当てられます。最初のスロットは無条件に付与される点に注意してください。このため、多数のmax_threads= 1 のクエリが存在する状況では、max_threadsが大きいクエリが不公平に扱われ、レイテンシーが増加する可能性があります。fair_round_robin—use_concurrency_control= 1 に設定された各クエリは、最大でmax_threads - 1個の CPU スロットを確保します。各クエリの最初のスレッドには CPU スロットを必要としないという点で、round_robinのバリエーションです。これにより、max_threads= 1 のクエリはスロットを一切必要とせず、不公平に全スロットを占有してしまうことがなくなります。無条件に付与されるスロットは存在しません。
concurrent_threads_soft_limit_num
リモートサーバーからデータを取得するスレッドを除き、すべてのクエリで使用できるクエリ処理スレッドの最大数です。これはハードリミットではありません。制限に達した場合でも、そのクエリには少なくとも 1 つのスレッドが割り当てられて実行されます。より多くのスレッドが利用可能になった場合、実行中のクエリは必要なスレッド数までスケールアップできます。
0(デフォルト)の場合は無制限を意味します。
concurrent_threads_soft_limit_ratio_to_cores
concurrent_threads_soft_limit_num と同様ですが、コア数に対する比率として指定します。
config_reload_interval_ms
ClickHouse が設定を再読み込みし、新しい変更の有無を確認する間隔
core_dump
コアダンプファイルサイズのソフトリミットを設定します。
ハードリミットはシステムツールで構成します
例
cpu_slot_preemption
CPU リソース(MASTER THREAD と WORKER THREAD)のワークロードスケジューリング方法を定義します。
true(推奨)の場合、実際に消費された CPU 時間に基づいて使用状況の計測が行われます。競合するワークロードに対して、公平な量の CPU 時間が割り当てられます。スロットは一定時間のみ割り当てられ、有効期限後に再度要求されます。CPU リソースが過負荷の場合、スロット要求がスレッド実行をブロックすることがあり、つまりプリエンプションが発生する可能性があります。これにより CPU 時間の公平性が確保されます。false(デフォルト)の場合、計測は割り当てられた CPU スロット数に基づいて行われます。競合するワークロードに対して、公平な数の CPU スロットが割り当てられます。スレッド開始時にスロットが割り当てられ、スレッドの実行が終了するまで継続的に保持され、その後解放されます。クエリ実行に割り当てられるスレッド数は 1 からmax_threadsまでしか増加せず、減少することはありません。これは長時間実行されるクエリに有利に働き、短時間クエリが CPU リソースの飢餓状態に陥る可能性があります。
例
関連項目
cpu_slot_preemption_timeout_ms
プリエンプション中、つまり別の CPU スロットが付与されるのを待つ間に、ワーカースレッドが待機できる時間(ミリ秒)を定義します。このタイムアウト後も新しい CPU スロットを取得できなかった場合、そのスレッドは終了し、クエリは同時実行スレッド数がより少ない状態へ動的にスケールダウンされます。マスタースレッド自体がスケールダウンされることはありませんが、無期限にプリエンプトされる可能性がある点に注意してください。cpu_slot_preemption が有効であり、かつ WORKER THREAD に対して CPU リソースが定義されている場合にのみ意味を持ちます。
例
関連項目
cpu_slot_quantum_ns
これは、スレッドが CPU スロットを取得してから、別の CPU スロットを再度要求するまでに消費できる CPU ナノ秒数を定義します。cpu_slot_preemption が有効であり、かつ MASTER THREAD または WORKER THREAD に CPU リソースが定義されている場合にのみ有効です。
例
関連項目
crash_log
crash_log システムテーブルの動作に関する設定です。
以下の設定はサブタグで構成できます。
| Setting | Description | Default | Note |
|---|---|---|---|
database | データベース名。 | ||
table | システムテーブル名。 | ||
engine | システムテーブル用の MergeTree エンジン定義。 | partition_by または order_by が定義されている場合は使用できません。指定しない場合、デフォルトで MergeTree が選択されます | |
partition_by | システムテーブル用の カスタムパーティショニングキー。 | システムテーブルに対して engine を指定する場合、partition_by パラメータは直接 engine 内で指定する必要があります | |
ttl | テーブルの TTL を指定します。 | システムテーブルに対して engine を指定する場合、ttl パラメータは直接 engine 内で指定する必要があります | |
order_by | システムテーブル用の カスタムソートキー。engine が定義されている場合は使用できません。 | システムテーブルに対して engine を指定する場合、order_by パラメータは直接 engine 内で指定する必要があります | |
storage_policy | テーブルに使用するストレージポリシー名(任意)。 | システムテーブルに対して engine を指定する場合、storage_policy パラメータは直接 engine 内で指定する必要があります | |
settings | MergeTree の動作を制御する 追加パラメータ(任意)。 | システムテーブルに対して engine を指定する場合、settings パラメータは直接 engine 内で指定する必要があります | |
flush_interval_milliseconds | メモリ上のバッファからテーブルへデータをフラッシュする間隔。 | 7500 | |
max_size_rows | ログの最大行数。未フラッシュのログ数が max_size_rows に達すると、ログがディスクにダンプされます。 | 1024 | |
reserved_size_rows | ログ用に事前に確保しておくメモリサイズ(行数)。 | 1024 | |
buffer_size_rows_flush_threshold | 行数に対するしきい値。このしきい値に達すると、バックグラウンドでログのディスクへのフラッシュが実行されます。 | max_size_rows / 2 | |
flush_on_crash | クラッシュ時にログをディスクへダンプするかどうかを設定します。 | false |
デフォルトのサーバー設定ファイル config.xml には、次の設定セクションが含まれています。
custom_cached_disks_base_directory
この設定は、カスタム(SQL から作成された)キャッシュディスクのキャッシュパスを指定します。
custom_cached_disks_base_directory はカスタムディスクに対して filesystem_caches_path(filesystem_caches_path.xml 内にあります)よりも高い優先度を持ち、
前者が存在しない場合に後者が使用されます。
ファイルシステムキャッシュのパスは必ずこのディレクトリ配下でなければなりません。
そうでない場合は、ディスクの作成を防ぐために例外がスローされます。
これは、サーバーのアップグレード前に古いバージョンで作成されたディスクには影響しません。 この場合、サーバーが正常に起動できるように、例外はスローされません。
例:
custom_settings_prefixes
カスタム設定用のプレフィックスの一覧です。複数指定する場合はカンマ区切りで指定します。
例
関連項目
database_atomic_delay_before_drop_table_sec
UNDROP ステートメントを使用して削除されたテーブルを復元できる猶予時間です。DROP TABLE が SYNC 修飾子付きで実行された場合、この設定は無視されます。
この設定のデフォルト値は 480(8 分)です。
database_catalog_drop_error_cooldown_sec
database_catalog_drop_table_concurrency
database_catalog_unused_dir_cleanup_period_sec
store/ ディレクトリから不要なデータをクリーンアップするタスクのパラメータです。
このタスクの実行間隔(スケジューリング周期)を設定します。
0 を指定するとタスクは実行されません。デフォルト値は 1 日に相当します。
database_catalog_unused_dir_hide_timeout_sec
store/ ディレクトリから不要なデータをクリーンアップするタスクのパラメータです。
あるサブディレクトリが clickhouse-server によって使用されておらず、かつ直近
database_catalog_unused_dir_hide_timeout_sec 秒の間に更新されていない場合、このタスクはそのディレクトリの
すべてのアクセス権を削除することで、そのディレクトリを「非表示」にします。これは、clickhouse-server が
store/ 内に存在することを想定していないディレクトリにも適用されます。
0 の値は「即時」を意味します。
database_catalog_unused_dir_rm_timeout_sec
store/ ディレクトリから不要なディレクトリをクリーンアップするタスクのパラメータです。
サブディレクトリが clickhouse-server によって使用されておらず、以前に「非表示」
(database_catalog_unused_dir_hide_timeout_sec を参照)
にされていて、そのディレクトリが直近
database_catalog_unused_dir_rm_timeout_sec 秒間変更されていない場合、このタスクはそのディレクトリを削除します。
また、clickhouse-server が
store/ 内に存在することを想定していないディレクトリに対しても動作します。
値が 0 の場合は「削除しない(無期限に保持する)」ことを意味します。デフォルト値は 30 日に相当します。
database_replicated_allow_detach_permanently
database_replicated_drop_broken_tables
dead_letter_queue
「dead_letter_queue」システムテーブルの設定です。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
デフォルトの設定は次のとおりです。
default_database
default_password_type
CREATE USER u IDENTIFIED BY 'p' のようなクエリで、自動的に使用されるパスワードの種類を指定します。
指定可能な値は次のとおりです:
plaintext_passwordsha256_passworddouble_sha1_passwordbcrypt_password
default_profile
既定の設定プロファイルです。設定プロファイルは、設定 user_config で指定されたファイルに定義されています。
例
default_replica_name
ZooKeeper 上のレプリカ名。
例
default_replica_path
ZooKeeper 上のテーブルへのパス。
例
default_session_timeout
セッションのデフォルトタイムアウト時間(秒単位)。
dictionaries_config
ディクショナリ設定ファイルへのパス。
パス:
- 絶対パス、またはサーバー設定ファイルからの相対パスを指定します。
- パスにはワイルドカードの * や ? を含めることができます。
関連項目:
- "Dictionaries"。
例
dictionaries_lazy_load
ディクショナリを遅延ロードします。
trueの場合、各ディクショナリは最初に使用されたときに読み込まれます。読み込みに失敗した場合、そのディクショナリを使用していた関数は例外をスローします。falseの場合、サーバーは起動時にすべてのディクショナリを読み込みます。
サーバーは、すべてのディクショナリの読み込みが完了するまで起動時に待機し、それまでは接続を受け付けません
(例外: wait_dictionaries_load_at_startup が false に設定されている場合)。
例
dictionary_background_reconnect_interval
background_reconnect が有効になっている、接続に失敗した MySQL および Postgres 辞書に対して行う再接続試行の間隔(ミリ秒単位)。
disable_insertion_and_mutation
INSERT/ALTER/DELETE クエリを無効化します。読み取り専用ノードが必要で、挿入やミューテーションが読み取りパフォーマンスに影響するのを防ぎたい場合に、この設定を有効化します。この設定が有効な場合でも、外部エンジン(S3、DataLake、MySQL、PostgreSQL、Kafka など)への INSERT は許可されます。
disable_internal_dns_cache
disable_tunneling_for_https_requests_over_http_proxy
デフォルトでは、HTTP プロキシ経由で HTTPS リクエストを送信する際、トンネリング(つまり HTTP CONNECT)が使用されます。この設定でトンネリングを無効化できます。
no_proxy
デフォルトでは、すべてのリクエストがプロキシを経由します。特定のホストに対してプロキシ経由を無効化するには、no_proxy 変数を設定する必要があります。
これは、list resolver と remote resolver では <proxy> 句の中で、environment resolver では環境変数として設定できます。
IP アドレス、ドメイン、サブドメインに加え、完全にバイパスするためのワイルドカード '*' をサポートします。curl と同様に、先頭のドットは取り除かれます。
Example
次の設定では、clickhouse.cloud およびそのすべてのサブドメイン(例: auth.clickhouse.cloud)へのリクエストはプロキシを経由しません。
GitLab に対しても同様で、先頭にドットが付いていても同じ挙動になります。gitlab.com と about.gitlab.com の両方がプロキシをバイパスします。
disk_connections_soft_limit
disk_connections_store_limit
disk_connections_warn_limit
display_secrets_in_show_and_select
テーブル、データベース、テーブル関数、およびディクショナリに対する SHOW および SELECT クエリでシークレットを表示するかどうかを切り替えます。
シークレットを表示したいユーザーは、
format_display_secrets_in_show_and_select フォーマット設定
を有効にし、
displaySecretsInShowAndSelect 権限
を付与されている必要があります。
設定可能な値:
0— 無効。1— 有効。
distributed_cache_apply_throttling_settings_from_client
distributed_cache_keep_up_free_connections_ratio
distributed_ddl
クラスタ上で 分散 DDL クエリ(CREATE、DROP、ALTER、RENAME)の実行を管理します。
ZooKeeper が有効化されている場合にのみ機能します。
<distributed_ddl> 内で設定可能な項目は次のとおりです。
| Setting | Description | Default Value |
|---|---|---|
path | DDL クエリ用の task_queue に対応する Keeper 上のパス | |
profile | DDL クエリの実行に使用されるプロファイル | |
pool_size | 同時に実行できる ON CLUSTER クエリの数 | |
max_tasks_in_queue | キュー内に保持できるタスクの最大数 | 1,000 |
task_max_lifetime | ノードの存続時間がこの値を超えた場合に、そのノードを削除します。 | 7 * 24 * 60 * 60(秒換算で 1 週間) |
cleanup_delay_period | 直近のクリーンアップが cleanup_delay_period 秒よりも前に実行されている場合に、新しいノードイベントを受信した後でクリーンアップを開始します。 | 60 秒 |
例
distributed_ddl_use_initial_user_and_roles
dns_allow_resolve_names_to_ipv4
dns_allow_resolve_names_to_ipv6
dns_cache_max_entries
dns_cache_update_period
dns_max_consecutive_failures
drop_distributed_cache_pool_size
drop_distributed_cache_queue_size
enable_azure_sdk_logging
encryption
encryption codecs で使用するキーを取得するためのコマンドを構成します。キー(複数可)は環境変数で指定するか、設定ファイルで設定する必要があります。
キーは長さ 16 バイトの 16 進数値または文字列でなければなりません。
例
設定ファイルから読み込む場合:
キーを設定ファイルに保存することは推奨されません。安全ではないためです。キーは安全なディスク上の別の設定ファイルに移動し、その設定ファイルへのシンボリックリンクを config.d/ フォルダに配置できます。
キーが16進数表現である場合の、設定ファイルからの読み込み:
環境変数からキーを読み込む:
ここでは current_key_id で暗号化に使用する現在のキーを指定し、指定したすべてのキーを復号に使用できます。
これらの各手法は、複数のキーに対して適用できます。
ここで current_key_id は、暗号化に使用されている現在のキーを示します。
また、ユーザーは長さ 12 バイトの nonce を追加できます(デフォルトでは、暗号化および復号処理では、すべてゼロバイトの nonce が使用されます):
または 16進数で指定できます:
上記で説明した内容は、aes_256_gcm_siv にもすべて適用できます(ただしキーは 32 バイトである必要があります)。
error_log
デフォルトでは無効になっています。
有効化
エラー履歴の収集 system.error_log を手動で有効にするには、次の内容で /etc/clickhouse-server/config.d/error_log.xml を作成します。
無効化
error_log 設定を無効化するには、次の内容で /etc/clickhouse-server/config.d/disable_error_log.xml ファイルを作成します。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
format_parsing_thread_pool_queue_size
入力のパース用スレッドプールにスケジュールできるジョブの最大数。
0 の値は無制限を意味します。
format_schema_path
CapnProto フォーマットなどの入力データ用スキーマファイルを含むディレクトリへのパスです。
例
global_profiler_cpu_time_period_ns
global_profiler_real_time_period_ns
google_protos_path
Protobuf 型の proto ファイルを含むディレクトリを指定します。
例:
graphite
Graphite へデータを送信します。
設定:
host– Graphite サーバー。port– Graphite サーバーのポート。interval– 送信間隔(秒)。timeout– データ送信のタイムアウト(秒)。root_path– キーのプレフィックス。metrics– system.metrics テーブルからデータを送信。events– system.events テーブルから、指定期間に蓄積された差分データを送信。events_cumulative– system.events テーブルから累積データを送信。asynchronous_metrics– system.asynchronous_metrics テーブルからデータを送信。
複数の <graphite> 句を設定できます。たとえば、異なるデータを異なる間隔で送信する用途に利用できます。
例
graphite_rollup
Graphite のデータを間引くための設定です。
詳細については、GraphiteMergeTree を参照してください。
例
hsts_max_age
HSTS の有効期限を秒単位で指定します。
0 を指定すると、ClickHouse は HSTS を無効化します。正の数値を設定すると HSTS が有効化され、max-age は設定した数値になります。
例
http_connections_soft_limit
http_connections_store_limit
http_connections_warn_limit
http_handlers
カスタム HTTP ハンドラーを使用できるようにします。
新しい HTTP ハンドラーを追加するには、新しい <rule> を追加するだけです。
ルールは定義された順に上からチェックされ、
最初にマッチしたもののハンドラーが実行されます。
以下の設定はサブタグによって構成できます:
| Sub-tags | Definition |
|---|---|
url | リクエスト URL にマッチさせます。正規表現マッチを使用するには、プレフィックスとして 'regex:' を付与します(任意) |
methods | リクエストメソッドにマッチさせます。複数のメソッドを指定する場合はカンマ区切りで指定します(任意) |
headers | リクエストヘッダーにマッチさせます。各子要素(子要素名がヘッダー名)ごとにマッチさせ、正規表現マッチを使用するにはプレフィックスとして 'regex:' を付与します(任意) |
handler | リクエストハンドラー |
empty_query_string | URL にクエリ文字列が存在しないことをチェックします |
handler には以下の設定が含まれており、サブタグによって構成できます:
| Sub-tags | Definition |
|---|---|
url | リダイレクト先の場所 |
type | サポートされるタイプ: static, dynamic_query_handler, predefined_query_handler, redirect |
status | static タイプと併用し、レスポンスのステータスコードを指定します |
query_param_name | dynamic_query_handler タイプと併用し、HTTP リクエストパラメータから <query_param_name> に対応する値を抽出して実行します |
query | predefined_query_handler タイプと併用し、ハンドラーが呼び出されたときにクエリを実行します |
content_type | static タイプと併用し、レスポンスの Content-Type を指定します |
response_content | static タイプと併用し、クライアントに送信するレスポンスコンテンツを指定します。プレフィックスに 'file://' または 'config://' を使用すると、ファイルまたは設定からコンテンツを取得してクライアントに送信します |
ルールの一覧に加えて、すべてのデフォルトハンドラーを有効にする <defaults/> を指定できます。
例:
http_options_response
OPTIONS HTTP リクエストのレスポンスにヘッダーを追加するために使用します。
OPTIONS メソッドは、CORS プリフライト リクエストを行う際に使用されます。
詳細については、OPTIONS を参照してください。
例:
http_server_default_response
ClickHouse の HTTP(S) サーバーにアクセスしたときに、デフォルトで表示されるページです。 デフォルト値は "Ok."(末尾に改行(LF)付き)です。
例
http://localhost: http_port にアクセスしたときに https://tabix.io/ が開きます。
iceberg_catalog_threadpool_pool_size
iceberg_catalog_threadpool_queue_size
iceberg_metadata_files_cache_max_entries
iceberg_metadata_files_cache_policy
iceberg_metadata_files_cache_size
iceberg_metadata_files_cache_size_ratio
ignore_empty_sql_security_in_create_view_query
true の場合、ClickHouse は CREATE VIEW クエリ内で空の SQL security ステートメントに対するデフォルト値を記録しません。
この設定は移行期間中にのみ必要であり、24.4 で廃止される予定です。
include_from
置換定義を含むファイルへのパスです。XML 形式と YAML 形式の両方がサポートされています。
詳細については、「設定ファイル」セクションを参照してください。
例
index_mark_cache_policy
index_mark_cache_size
インデックスマーク用キャッシュの最大サイズ。
0 を指定すると無効になります。
この設定は実行時に変更でき、即座に反映されます。
index_mark_cache_size_ratio
セカンダリインデックス非圧縮キャッシュポリシー
index_uncompressed_cache_size
圧縮されていない MergeTree インデックスブロック用キャッシュの最大サイズです。
値が 0 の場合は無効になります。
この設定は実行時に変更でき、変更は直ちに反映されます。
index_uncompressed_cache_size_ratio
interserver_http_credentials
レプリケーション時に他のサーバーへ接続する際に使用されるユーザー名とパスワードです。加えて、サーバーはこれらの認証情報を用いて他のレプリカを認証します。
そのため、interserver_http_credentials はクラスター内のすべてのレプリカで同一である必要があります。
- 既定では、
interserver_http_credentialsセクションを省略した場合、レプリケーション時に認証は使用されません。 interserver_http_credentialsの設定は、ClickHouse クライアント認証情報の設定とは関係ありません。- これらの認証情報は、
HTTPおよびHTTPSによるレプリケーションで共通です。
次の設定はサブタグで指定できます。
user— ユーザー名。password— パスワード。allow_empty—trueの場合、認証情報が設定されていても、他のレプリカが認証なしで接続することを許可します。falseの場合、認証なしの接続は拒否されます。既定値:false。old— 認証情報ローテーション時に使用されていた古いuserとpasswordを含みます。複数のoldセクションを指定できます。
認証情報のローテーション
ClickHouse は、すべてのレプリカを同時に停止して設定を更新することなく、インターサーバー認証情報の動的なローテーションをサポートします。認証情報は複数のステップで変更できます。
認証を有効にするには、interserver_http_credentials.allow_empty を true に設定し、認証情報を追加します。これにより、認証ありおよび認証なしの両方の接続が許可されます。
すべてのレプリカの設定が完了したら、allow_empty を false に設定するか、この設定を削除してください。これにより、新しい認証情報での認証が必須になります。
既存の認証情報を変更するには、ユーザー名とパスワードを interserver_http_credentials.old セクションに移動し、user と password を新しい値に更新します。この時点で、サーバーは他のレプリカへの接続には新しい認証情報を使用し、接続の受け入れ時には新旧どちらの認証情報も受け付けます。
新しい資格情報がすべてのレプリカに適用されたら、古い資格情報は削除できます。
interserver_http_host
他のサーバーがこのサーバーへアクセスする際に使用するホスト名です。
省略した場合は、hostname -f コマンドと同様に決定されます。
特定のネットワークインターフェイスに依存しないようにする場合に便利です。
例
interserver_http_port
ClickHouse サーバー間でデータを交換するためのポート。
例
interserver_https_host
interserver_http_host と同様ですが、このホスト名は、他のサーバーが HTTPS 経由でこのサーバーにアクセスするために使用されます。
例
interserver_https_port
HTTPS 経由で ClickHouse サーバー間のデータを交換するためのポート。
例
interserver_listen_host
ClickHouse サーバー間でデータを交換できるホストを制限します。 Keeper を使用している場合は、異なる Keeper インスタンス間の通信にも同じ制限が適用されます。
デフォルトでは、この値は listen_host 設定と同じです。
例
型:
デフォルト:
io_thread_pool_queue_size
IO スレッドプールにスケジュールできるジョブ数の最大値。
値が 0 の場合は無制限を意味します。
jemalloc_collect_global_profile_samples_in_trace_log
jemalloc_enable_background_threads
jemalloc_enable_global_profiler
SYSTEM JEMALLOC FLUSH PROFILE を用いてフラッシュできます。
サンプルは、設定 jemalloc_collect_global_profile_samples_in_trace_log またはクエリ設定 jemalloc_collect_profile_samples_in_trace_log を使用して system.trace_log に保存することもできます。
Allocation Profiling を参照してください。
jemalloc_flush_profile_interval_bytes
jemalloc_flush_profile_on_memory_exceeded
jemalloc_max_background_threads_num
keep_alive_timeout
HTTP プロトコルで、ClickHouse が接続を閉じる前に受信リクエストを待機する秒数です。
例
keeper_hosts
動的な設定です。ClickHouse が接続候補とする [Zoo]Keeper ホストの集合を含みます。<auxiliary_zookeepers> の情報は含まれません。
keeper_multiread_batch_size
バッチ処理をサポートしている [Zoo]Keeper への MultiRead リクエストにおけるバッチの最大サイズ。0 に設定した場合、バッチ処理は無効になります。ClickHouse Cloud でのみ利用可能です。
ldap_servers
接続パラメータ付きで LDAP サーバーをここに列挙します。これにより、次のことが可能になります:
passwordの代わりにldap認証メカニズムが指定された専用のローカルユーザーの認証手段として使用する- リモートユーザーディレクトリとして使用する
次の設定はサブタグで構成できます:
| Setting | Description |
|---|---|
host | LDAP サーバーのホスト名または IP。必須パラメータであり、空にはできません。 |
port | LDAP サーバーポート。enable_tls が true の場合のデフォルトは 636、それ以外の場合は 389 です。 |
bind_dn | バインドする DN を構築するために使用されるテンプレート。最終的な DN は、各認証試行時にテンプレート中のすべての \{user_name\} 部分文字列を実際のユーザー名で置き換えることによって構築されます。 |
user_dn_detection | バインドされたユーザーの実際のユーザー DN を検出するための LDAP 検索パラメータを含むセクション。これは主に、サーバーが Active Directory の場合のロールマッピングに用いる検索フィルターで使用されます。結果として得られるユーザー DN は、許可されている場所で \{user_dn\} 部分文字列を置き換える際に使用されます。デフォルトではユーザー DN は bind DN と同一に設定されますが、一度検索が実行されると、検出された実際のユーザー DN の値に更新されます。 |
verification_cooldown | 正常にバインドが行われた後、その後のすべてのリクエストに対して LDAP サーバーへ接続することなく、ユーザーが認証済みであるとみなされる秒数。キャッシュを無効にし、各認証リクエストごとに LDAP サーバーへの接続を強制するには、0(デフォルト)を指定します。 |
enable_tls | LDAP サーバーへの安全な接続の使用を有効にするフラグ。プレーンテキストの (ldap://) プロトコル(非推奨)を使用するには no を指定します。SSL/TLS 上の LDAP (ldaps://) プロトコル(推奨、デフォルト)を使用するには yes を指定します。レガシーな StartTLS プロトコル(プレーンテキスト (ldap://) プロトコルから TLS へアップグレード)を使用するには starttls を指定します。 |
tls_minimum_protocol_version | SSL/TLS の最小プロトコルバージョン。指定可能な値は: ssl2, ssl3, tls1.0, tls1.1, tls1.2(デフォルト)。 |
tls_require_cert | SSL/TLS ピア証明書の検証動作。指定可能な値は: never, allow, try, demand(デフォルト)。 |
tls_cert_file | 証明書ファイルへのパス。 |
tls_key_file | 証明書鍵ファイルへのパス。 |
tls_ca_cert_file | CA 証明書ファイルへのパス。 |
tls_ca_cert_dir | CA 証明書を含むディレクトリへのパス。 |
tls_cipher_suite | 許可される暗号スイート(OpenSSL 表記)。 |
user_dn_detection 設定はサブタグで構成できます:
| Setting | Description |
|---|---|
base_dn | LDAP 検索用のベース DN を構築するために使用されるテンプレート。最終的な DN は、LDAP 検索中にテンプレート中のすべての \{user_name\} および \{bind_dn\} 部分文字列を、実際のユーザー名および bind DN で置き換えることによって構築されます。 |
scope | LDAP 検索のスコープ。指定可能な値は: base, one_level, children, subtree(デフォルト)。 |
search_filter | LDAP 検索用の検索フィルターを構築するために使用されるテンプレート。最終的なフィルターは、LDAP 検索中にテンプレート中のすべての \{user_name\}, \{bind_dn\}, \{base_dn\} 部分文字列を、実際のユーザー名、bind DN、および base DN で置き換えることによって構築されます。特別な文字は XML 内で適切にエスケープされている必要がある点に注意してください。 |
Example:
例(以降のロールマッピングのためにユーザー DN 検出を設定した典型的な Active Directory):
license_key
ClickHouse Enterprise Edition のライセンスキー
listen_backlog
listen ソケットのバックログ(保留中接続のキューサイズ)。デフォルト値の 4096 は Linux 5.4+) と同じです。
通常、この値を変更する必要はありません。理由は次のとおりです。
- デフォルト値が十分に大きいこと、
- クライアントからの接続を受け付ける処理はサーバーの別スレッドで行われること。
そのため、nstat の TcpExtListenOverflows が 0 以外で、このカウンタが ClickHouse サーバーに対して増加していたとしても、必ずしもこの値を増やす必要があることを意味しません。理由は次のとおりです。
- 通常、
4096で足りない場合は ClickHouse の内部スケーリングの問題を示しているため、issue として報告した方がよいです。 - それはサーバーが後からより多くの接続を処理できることを意味しません(仮に処理できたとしても、その時点ではクライアントがすでにいない、あるいは切断されている可能性があります)。
例
listen_host
リクエストを受け付けるホストを制限する設定です。すべてのホストからのリクエストにサーバーで応答させたい場合は、:: を指定します。
例:
listen_reuse_port
同一のアドレスとポート番号で複数のサーバーが待ち受けできるようにします。リクエストはオペレーティングシステムによってランダムに選ばれたサーバーへルーティングされます。この設定を有効化することは推奨されません。
例
型:
デフォルト:
listen_try
サーバーは、リッスンを試みている際に IPv6 または IPv4 ネットワークが利用できなくても終了しません。
例
load_marks_threadpool_pool_size
load_marks_threadpool_queue_size
logger
ログメッセージの出力場所とフォーマットを設定します。
キー:
| Key | Description |
|---|---|
level | ログレベル。指定可能な値: none (ログ出力を無効化)、fatal, critical, error, warning, notice, information,debug, trace, test |
log | ログファイルへのパス。 |
errorlog | エラーログファイルへのパス。 |
size | ローテーションポリシー: ログファイルの最大サイズ (バイト単位)。ログファイルサイズがこのしきい値を超えると、名前が変更されてアーカイブされ、新しいログファイルが作成されます。 |
count | ローテーションポリシー: ClickHouse で保持される履歴ログファイルの最大数。 |
stream_compress | LZ4 を使用してログメッセージを圧縮します。有効にするには 1 または true を設定します。 |
console | コンソールへのログ出力を有効にします。有効にするには 1 または true を設定します。ClickHouse がデーモンモードで動作していない場合のデフォルトは 1、それ以外は 0 です。 |
console_log_level | コンソール出力用のログレベル。デフォルトは level の値です。 |
formatting.type | コンソール出力のログフォーマット。現在は json のみサポートされています。 |
use_syslog | ログ出力を syslog にも転送します。 |
syslog_level | syslog へのログ出力時のログレベル。 |
async | true (デフォルト) の場合、ログは非同期に出力されます (出力チャネルごとに 1 本のバックグラウンドスレッド)。それ以外の場合は、LOG を呼び出したスレッド内でログを出力します。 |
async_queue_max_size | 非同期ログ出力を使用する場合、書き出し待ちキューに保持されるメッセージ数の最大値。超過したメッセージは破棄されます。 |
startup_level | サーバー起動時にルートロガーのレベルを設定するために使用される起動レベル。起動後はログレベルが level 設定値に戻されます。 |
shutdown_level | サーバーのシャットダウン時にルートロガーのレベルを設定するために使用されるシャットダウンレベル。 |
ログフォーマット指定子
log および errorLog パス内のファイル名では、生成されるファイル名に対して以下の書式指定子を使用できます (ディレクトリ部分では使用できません)。
「Example」列は、2023-07-06 18:32:07 時点での出力例を示します。
| 指定子 | 概要 | 例 |
|---|---|---|
%% | リテラルの % 文字 | % |
%n | 改行文字 | |
%t | 水平タブ文字 | |
%Y | 年を10進数で表した値(例: 2017) | 2023 |
%y | 年の下2桁を10進数で表した値(範囲 [00,99]) | 23 |
%C | 年を10進数で表したときの先頭2桁(範囲 [00,99]) | 20 |
%G | 4桁のISO 8601 週番号ベースの年、つまり指定された週を含む年。通常は %V と組み合わせて使用する場合にのみ意味がある | 2023 |
%g | ISO 8601 週基準年の末尾2桁(指定された週を含む年)。 | 23 |
%b | 省略された月名。例: Oct(ロケールに依存) | Jul |
%h | %b の同義語 | 7月 |
%B | 月名をフルスペルで表示(例: October。ロケールに依存) | 7月 |
%m | 月を 10 進数で表した値(範囲 [01,12]) | 07 |
%U | 年内の週番号(10進数)(週の始まりは日曜日)(範囲 [00,53]) | 27 |
%W | 年内の週番号を10進数で表したもの(週の始まりは月曜日)(範囲 [00,53]) | 27 |
%V | ISO 8601 の週番号(範囲 [01,53]) | 27 |
%j | 年内通算日を 10 進数の 3 桁で表した値(範囲 [001,366]) | 187 |
%d | 月の日付をゼロ埋めした 10 進数で表したもの(範囲 [01,31])。1 桁の値は先頭にゼロを付けます。 | 06 |
%e | 月内の日を、先頭にスペースを入れた10進数で表します(範囲 [1,31])。1桁の場合は先頭にスペースが付きます。 | 6 |
%a | 省略形の曜日名。例: Fri(ロケールに依存) | 木 |
%A | 曜日名のフルスペル。例: Friday(ロケール依存) | 木曜日 |
%w | 曜日を表す整数値。日曜日を0とする(範囲 [0-6]) | 4 |
%u | 曜日を表す10進数。月曜日を1とする(ISO 8601 形式)(範囲 [1-7]) | 4 |
%H | 24 時間制における時を 10 進数で表現(範囲 [00-23]) | 18 |
%I | 12 時間制における 10 進数表記の時(範囲 [01,12]) | 06 |
%M | 分(10 進数、範囲 [00,59]) | 32 |
%S | 秒を表す10進数(範囲 [00,60]) | 07 |
%c | 標準的な日付と時刻の文字列表現。例: Sun Oct 17 04:41:13 2010(ロケールに依存) | 2023年7月6日(木) 18:32:07 |
%x | ロケールに応じた日付表現(ロケール依存) | 2023/07/06 |
%X | ローカライズされた時刻表記(例:18:40:20 や 6:40:20 PM、ロケールに依存) | 18:32:07 |
%D | 短い MM/DD/YY 形式の日付(%m/%d/%y と同等)。 | 2023/07/06 |
%F | 短い YYYY-MM-DD 形式の日付。%Y-%m-%d と同等です。 | 2023-07-06 |
%r | ロケールに応じた12時間制の時刻表記 | 06:32:07 PM |
%R | 「%H:%M」と同等です | 18:32 |
%T | "%H:%M:%S"(ISO 8601 の時刻形式)と同等 | 18:32:07 |
%p | ローカライズされた午前/午後(a.m./p.m.)の表記(ロケール依存) | PM |
%z | UTC からのオフセットを ISO 8601 形式で表したもの(例: -0430)、タイムゾーン情報が利用できない場合は空文字 | +0800 |
%Z | ロケール依存のタイムゾーン名または略称。タイムゾーン情報が利用できない場合は何も出力されません | Z AWST |
例
ログメッセージをコンソールのみに出力するには:
レベルごとのオーバーライド
個々のログ名ごとにログレベルをオーバーライドできます。たとえば、ロガー「Backup」と「RBAC」のすべてのメッセージを出力しないようにするには、次のようにします。
syslog
ログメッセージを syslog にも出力するには、次のように設定します。
<syslog> のキー:
| Key | Description |
|---|---|
address | host\[:port\] 形式の syslog アドレス。省略した場合はローカルデーモンが使用されます。 |
hostname | ログを送信するホストの名前(任意)。 |
facility | syslog の facility キーワード。すべて大文字で、先頭に "LOG_" プレフィックスを付けて指定する必要があります(例: LOG_USER、LOG_DAEMON、LOG_LOCAL3 など)。デフォルト: address が指定されている場合は LOG_USER、それ以外は LOG_DAEMON。 |
format | ログメッセージの形式。指定可能な値: bsd および syslog。 |
ログ形式
コンソールログに出力されるログ形式を指定できます。現在は JSON のみがサポートされています。
例
出力される JSON ログの例を次に示します。
JSON ログのサポートを有効にするには、次のスニペットを使用してください。
JSON ログのキー名の変更
キー名は、<names> タグ内のタグの値を変更することで変更できます。たとえば、DATE_TIME を MY_DATE_TIME に変更するには、<date_time>MY_DATE_TIME</date_time> と指定します。
JSON ログのキーの省略
ログプロパティは、そのプロパティをコメントアウトすることで省略できます。たとえば、ログに query_id を出力したくない場合は、<query_id> タグをコメントアウトします。
macros
レプリケートテーブル用のパラメータマクロです。
レプリケートテーブルを使用しない場合は省略可能です。
詳細については、レプリケートテーブルの作成を参照してください。
例
mark_cache_policy
mark_cache_prewarm_ratio
mark_cache_size
MergeTree ファミリーのテーブルにおけるマーク(インデックス)キャッシュの最大サイズ。
この設定は実行時に変更でき、すぐに有効になります。
mark_cache_size_ratio
max_active_parts_loading_thread_pool_size
max_authentication_methods_per_user
1 人のユーザーについて、作成または変更時に設定できる認証方式の最大数です。 この設定を変更しても、既存のユーザーには影響しません。認証に関連する create/alter クエリがこの設定で指定された上限を超えると、クエリは失敗します。 認証に関係しない create/alter クエリは成功します。
値を 0 にすると無制限になります。
max_backup_bandwidth_for_server
max_backups_io_thread_pool_free_size
max_backup_io_thread_pool_free_size を超える場合、ClickHouse はアイドル状態のスレッドによって占有されているリソースを解放し、プールサイズを縮小します。必要に応じてスレッドは再作成されます。
max_backups_io_thread_pool_size
max_backups_io_thread_pool_size は、このプール内のスレッド数の上限を設定します。
max_build_vector_similarity_index_thread_pool_size
ベクトルインデックスを構築する際に使用するスレッド数の上限。
値が 0 の場合は、すべてのコアを使用します。
max_concurrent_insert_queries
同時に実行できる INSERT クエリの総数の上限。
0(デフォルト)の場合は無制限を意味します。
この設定は実行時に変更でき、即座に反映されます。すでに実行中のクエリには影響しません。
max_concurrent_queries
同時に実行できるクエリの総数の上限です。INSERT および SELECT クエリの上限や、ユーザーごとの最大クエリ数の上限も合わせて考慮する必要があります。
あわせて参照:
0(デフォルト)の場合は無制限を意味します。
この設定は実行時に変更可能で、直ちに反映されます。すでに実行中のクエリには影響しません。
max_concurrent_select_queries
同時に実行できる SELECT クエリの総数の上限。
0(デフォルト)の場合は無制限を意味します。
この設定は実行時に変更でき、直ちに反映されます。すでに実行中のクエリには影響しません。
max_connections
max_database_num_to_throw
max_database_num_to_warn
アタッチされているデータベースの数が指定した値を超えると、ClickHouseサーバーが警告メッセージを system.warnings テーブルに追加します。
例
max_database_replicated_create_table_thread_pool_size
max_dictionary_num_to_throw
辞書の数がこの値より大きい場合、サーバーは例外を発生させます。
次のデータベースエンジンのテーブルのみを数えます:
- Atomic
- Ordinary
- Replicated
- Lazy
値を 0 に設定すると、制限がなくなります。
例
max_dictionary_num_to_warn
アタッチされているディクショナリの数が指定値を超えると、ClickHouse サーバーは system.warnings テーブルに警告メッセージを追加します。
例
max_distributed_cache_read_bandwidth_for_server
max_distributed_cache_write_bandwidth_for_server
max_entries_for_hash_table_stats
max_fetch_partition_thread_pool_size
max_format_parsing_thread_pool_free_size
入力のパースに使用するスレッドプールに保持しておく、アイドル状態の待機スレッドの最大数。
max_format_parsing_thread_pool_size
入力データのパースに使用するスレッドの合計最大数。
max_io_thread_pool_free_size
IO スレッドプール内のアイドル状態のスレッド数が max_io_thread_pool_free_size を超えた場合、ClickHouse はアイドル状態のスレッドによって占有されているリソースを解放し、プールサイズを縮小します。必要に応じてスレッドは再作成されます。
max_io_thread_pool_size
ClickHouse は I/O スレッドプール内のスレッドを使用して、一部の I/O 処理(例:S3 とのやり取り)を実行します。max_io_thread_pool_size は、このプール内のスレッド数の上限を設定します。
max_keep_alive_requests
1 つの keep-alive 接続で、ClickHouse サーバーによって接続がクローズされるまでに処理されるリクエストの最大数。
例
max_local_read_bandwidth_for_server
ローカルでの読み取りの最大速度を、1 秒あたりのバイト数で指定します。
0 を指定すると無制限になります。
max_local_write_bandwidth_for_server
ローカル書き込みの最大速度(1 秒あたりのバイト数)。
値が 0 の場合は無制限を意味します。
max_materialized_views_count_for_table
1つのテーブルに関連付けられるマテリアライズドビューの数の上限。
この設定ではテーブルに直接依存するビューのみが対象であり、あるビューを基に別のビューを作成する場合は考慮されません。
max_merges_bandwidth_for_server
max_mutations_bandwidth_for_server
max_named_collection_num_to_throw
名前付きコレクションの数がこの値を超えると、サーバーは例外を送出します。
0 の値は制限なしを意味します。
例
max_named_collection_num_to_warn
名前付きコレクションの数が指定された値を超えた場合、ClickHouse サーバーは警告メッセージを system.warnings テーブルに追加します。
例
max_open_files
同時に開くことができるファイル数の上限。
getrlimit() 関数が誤った値を返すため、macOS ではこのオプションを使用することを推奨します。
例
max_os_cpu_wait_time_ratio_to_drop_connection
接続を切断するかどうかを判断するための、OS の CPU 待機時間(OSCPUWaitMicroseconds メトリクス)とビジー時間(OSCPUVirtualTimeMicroseconds メトリクス)の最大比率です。確率を計算するために、最小値と最大値の間で線形補間が行われ、この値では確率が 1 になります。
詳細は サーバー CPU 過負荷時の動作制御 を参照してください。
max_outdated_parts_loading_thread_pool_size
max_part_num_to_warn
アクティブなパーツの数が指定された値を超えた場合、ClickHouse サーバーは警告メッセージを system.warnings テーブルに追加します。
例
max_partition_size_to_drop
パーティション削除に関する制限。
MergeTree テーブルのサイズが max_partition_size_to_drop(バイト単位)を超える場合、DROP PARTITION クエリを使用してパーティションを削除することはできません。
この設定は ClickHouse サーバーの再起動なしで反映されます。この制限を無効にする別の方法として、<clickhouse-path>/flags/force_drop_table ファイルを作成する方法があります。
値 0 は、パーティションを制限なく削除できることを意味します。
この制限は DROP TABLE および TRUNCATE TABLE には適用されません。max_table_size_to_drop を参照してください。
例
max_parts_cleaning_thread_pool_size
max_pending_mutations_execution_time_to_warn
保留中の mutation のいずれかが設定値(秒)を超えた場合、ClickHouse サーバーは system.warnings テーブルに警告メッセージを追加します。
例
max_pending_mutations_to_warn
保留中のミューテーションの数が指定された値を超えると、ClickHouse サーバーは system.warnings テーブルに警告メッセージを追加します。
例
max_prefixes_deserialization_thread_pool_free_size
prefixes のデシリアライズ用スレッドプール内のアイドルスレッド数が max_prefixes_deserialization_thread_pool_free_size を超えた場合、ClickHouse はそれらのスレッドが占有しているリソースを解放し、プールのサイズを縮小します。必要に応じてスレッドは再び作成されます。
max_prefixes_deserialization_thread_pool_size
ClickHouse は、MergeTree の Wide 形式パーツ内のファイルプレフィックスから列およびサブ列のメタデータを並列に読み取るために、prefixes のデシリアライズ用スレッドプールのスレッドを使用します。max_prefixes_deserialization_thread_pool_size は、このプール内のスレッド数の最大値を設定します。
max_remote_read_network_bandwidth_for_server
読み取り時にネットワーク経由でデータを送受信する際の最大速度(1 秒あたりのバイト数)です。
値が 0(デフォルト)の場合は、無制限を意味します。
max_remote_write_network_bandwidth_for_server
書き込み時におけるネットワーク経由のデータ交換の最大速度(1 秒あたりのバイト数)。
0(デフォルト)の場合は無制限を意味します。
max_replicated_fetches_network_bandwidth_for_server
max_replicated_sends_network_bandwidth_for_server
max_replicated_table_num_to_throw
レプリケートテーブルの数がこの値を超えると、サーバーは例外をスローします。
次のデータベースエンジンのテーブルのみをカウントします:
- Atomic
- Ordinary
- Replicated
- Lazy
0 の場合は制限なしを意味します。
例
max_server_memory_usage
サーバーが使用することを許可されるメモリの最大量です。バイト単位で指定されます。
サーバーの最大メモリ消費量は、max_server_memory_usage_to_ram_ratio の設定によってさらに制限されます。
特例として、値が 0(デフォルト)の場合、サーバーは(max_server_memory_usage_to_ram_ratio によって課される追加の制限を除き)利用可能なメモリをすべて使用できます。
max_server_memory_usage_to_ram_ratio
サーバーが使用することを許可されているメモリの最大量を、利用可能なメモリ全体に対する比率で指定します。
たとえば、値が 0.9(デフォルト)の場合、サーバーは利用可能なメモリの 90% までを消費することができます。
メモリの少ないシステムでのメモリ使用量を抑えることができます。
RAM とスワップが少ないホストでは、max_server_memory_usage_to_ram_ratio を 1 より大きい値に設定する必要が生じる場合があります。
サーバーの最大メモリ使用量は、max_server_memory_usage の設定によってさらに制限されます。
max_session_timeout
セッションの最大タイムアウト時間(秒単位)。
例:
max_table_num_to_throw
テーブル数がこの値を超える場合、サーバーは例外をスローします。
次の種類のテーブルはカウントされません:
- view
- remote
- dictionary
- system
次のデータベースエンジンのテーブルのみがカウントされます:
- Atomic
- Ordinary
- Replicated
- Lazy
値が 0 の場合、制限がないことを意味します。
例
max_table_num_to_warn
アタッチされているテーブル数が指定された値を超えると、ClickHouse サーバーは警告メッセージを system.warnings テーブルに追加します。
例
max_table_size_to_drop
テーブルの削除に関する制限です。
MergeTree テーブルのサイズが max_table_size_to_drop(バイト単位)を超える場合、DROP クエリや TRUNCATE クエリを使用して削除することはできません。
0 を設定すると、制限なしで任意のテーブルを削除できます。
この設定を適用するために ClickHouse サーバーの再起動は不要です。制限を無効にする別の方法として、<clickhouse-path>/flags/force_drop_table ファイルを作成することもできます。
例
max_temporary_data_on_disk_size
外部集計、結合、ソートに使用できる一時データの最大ディスク使用量。 この制限を超えたクエリは、例外を送出して失敗します。
0 の値は無制限を意味します。
関連項目:
max_thread_pool_free_size
グローバルスレッドプール内のアイドルスレッド数がmax_thread_pool_free_sizeより大きい場合、ClickHouse は一部のスレッドによって占有されているリソースを解放し、プールサイズを縮小します。必要に応じて、スレッドは再作成されます。
例
max_thread_pool_size
ClickHouse はクエリを処理するために、グローバルスレッドプール内のスレッドを使用します。クエリを処理するための空きスレッドがない場合、プールに新しいスレッドが作成されます。max_thread_pool_size はプール内のスレッド数の上限を設定します。
例
max_unexpected_parts_loading_thread_pool_size
max_view_num_to_throw
ビュー数がこの値を超えると、サーバーは例外をスローします。
次のデータベースエンジンのテーブルのみをカウント対象とします:
- Atomic
- Ordinary
- Replicated
- Lazy
値が 0 の場合は制限がありません。
例
max_view_num_to_warn
アタッチされているビューの数が指定値を超えると、ClickHouseサーバーは system.warnings テーブルに警告メッセージを追加します。
例
max_waiting_queries
同時に待機状態となるクエリの総数に対する上限。
待機中のクエリの実行は、必要なテーブルが非同期で読み込まれている間ブロックされます(async_load_databases を参照)。
待機中のクエリは、次の設定で制御される制限をチェックする際のカウントには含まれません。
max_concurrent_queriesmax_concurrent_insert_queriesmax_concurrent_select_queriesmax_concurrent_queries_for_usermax_concurrent_queries_for_all_users
この調整は、サーバー起動直後にこれらの制限にすぐ達してしまうことを避けるために行われます。
0(デフォルト)の値は無制限を意味します。
この設定は実行時に変更でき、即座に反映されます。すでに実行中のクエリには影響しません。
memory_worker_correct_memory_tracker
バックグラウンドのメモリワーカーが、jemalloc や cgroups などの外部ソースからの情報に基づいて内部メモリトラッカーを補正するかどうかを制御します。
memory_worker_period_ms
メモリ使用量が高くなった場合に、メモリトラッカーによるメモリ使用量を補正し、未使用ページをクリーンアップするバックグラウンド メモリワーカーのティック周期(ミリ秒)。0 に設定した場合、メモリ使用元の種類に応じてデフォルト値が使用されます。
memory_worker_use_cgroup
merge_tree
MergeTree テーブルのための詳細な設定項目です。
詳細については、MergeTreeSettings.h ヘッダーファイルを参照してください。
例
merge_workload
マージ処理とその他のワークロード間でのリソースの使用および共有方法を制御するために使用します。指定した値は、すべてのバックグラウンドマージに対して workload 設定の値として使用されます。マージツリーの設定で上書きできます。
関連項目
merges_mutations_memory_usage_soft_limit
マージおよびミューテーション操作を実行する際に使用が許可される RAM の上限(ソフトリミット)を設定します。 ClickHouse が設定された上限に達すると、新しいバックグラウンドのマージまたはミューテーション操作はスケジュールされなくなりますが、すでにスケジュール済みのタスクの実行は継続されます。
値が 0 の場合は無制限を意味します。
例
merges_mutations_memory_usage_to_ram_ratio
merges_mutations_memory_usage_soft_limit のデフォルト値は、memory_amount * merges_mutations_memory_usage_to_ram_ratio によって算出されます。
関連項目:
metric_log
既定では無効です。
有効化
メトリクスの履歴収集機能 system.metric_log を手動で有効にするには、次の内容で /etc/clickhouse-server/config.d/metric_log.xml を作成します。
無効化
metric_log 設定を無効化するには、以下の内容で /etc/clickhouse-server/config.d/disable_metric_log.xml ファイルを作成します。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
min_os_cpu_wait_time_ratio_to_drop_connection
接続の切断を検討する際の、OS の CPU 待機時間(OSCPUWaitMicroseconds メトリクス)とビジー時間(OSCPUVirtualTimeMicroseconds メトリクス)の比率における最小値です。切断確率の計算には、最小比率と最大比率の間で線形補間が使用され、この最小比率では確率は 0 になります。
詳細については、サーバー CPU 過負荷時の動作制御 を参照してください。
mlock_executable
起動後に mlockall を実行し、最初のクエリのレイテンシを低減し、高い I/O 負荷時に ClickHouse の実行ファイルがページアウトされるのを防ぎます。
このオプションの有効化を推奨しますが、起動時間が最大で数秒ほど長くなります。 また、この設定は "CAP_IPC_LOCK" ケーパビリティがない場合は機能しないことに注意してください。
例
mmap_cache_size
この設定は、頻繁な open/close 呼び出し(後続のページフォールトにより非常にコストが高い)を回避し、複数のスレッドおよびクエリ間でマッピングを再利用できるようにします。設定値はマッピングされた領域の数(通常はマッピングされたファイル数と等しい)です。
マッピングされたファイル内のデータ量は、次のシステムテーブルにおいて、以下のメトリクスで監視できます。
MMappedFiles/MMappedFileBytes/MMapCacheCells—system.metrics、system.metric_logCreatedReadBufferMMap/CreatedReadBufferMMapFailed/MMappedFileCacheHits/MMappedFileCacheMisses—system.events、system.processes、system.query_log、system.query_thread_log、system.query_views_log
マッピングされたファイル内のデータ量はメモリを直接消費せず、クエリまたはサーバーのメモリ使用量にも計上されません。これは、このメモリが OS のページキャッシュと同様に破棄可能であるためです。キャッシュは、MergeTree ファミリーのテーブルで古いパーツが削除されるタイミングで(ファイルがクローズされることで)自動的に破棄されます。また、SYSTEM DROP MMAP CACHE クエリを使用して手動で破棄することもできます。
この設定は実行時に変更可能であり、変更は即座に有効になります。
mutation_workload
ミューテーションと他のワークロード間で、リソースの利用・共有を制御するために使用します。指定した値は、すべてのバックグラウンドミューテーションに対して workload 設定値として使用されます。MergeTree の設定で上書きできます。
関連項目
mysql_port
MySQL プロトコルでクライアントと通信するためのポート。
- 正の整数を指定すると、そのポート番号で待ち受けます。
- 空の値を指定すると、MySQL プロトコルによるクライアントとの通信が無効になります。
例
mysql_require_secure_transport
true に設定すると、mysql_port 経由でクライアントとのセキュアな通信が必須となります。--ssl-mode=none オプションでの接続は拒否されます。OpenSSL の設定と併せて使用してください。
openSSL
SSL クライアント/サーバーの構成。
SSL のサポートは libpoco ライブラリによって提供されます。利用可能な構成オプションについては SSLManager.h を参照してください。デフォルト値は SSLManager.cpp で確認できます。
サーバー/クライアント構成用のキー:
| オプション | 概要 | デフォルト値 |
|---|---|---|
privateKeyFile | PEM 証明書の秘密鍵を格納したファイルへのパスです。ファイルには鍵と証明書を同一ファイル内に含めることができます。 | |
certificateFile | PEM 形式のクライアント/サーバー証明書ファイルへのパス。privateKeyFile に証明書が含まれている場合は指定を省略できます。 | |
caConfig | 信頼された CA 証明書を含むファイルまたはディレクトリへのパスです。ファイルを参照している場合、そのファイルは PEM 形式である必要があり、複数の CA 証明書を含めることができます。ディレクトリを参照している場合、そのディレクトリには CA 証明書ごとに 1 つの .pem ファイルが含まれている必要があります。ファイル名は CA のサブジェクト名のハッシュ値で検索されます。詳細は SSL_CTX_load_verify_locations の man ページを参照してください。 | |
verificationMode | ノードの証明書の検証方法。詳細は Context クラスの説明を参照してください。設定可能な値: none, relaxed, strict, once。 | relaxed |
verificationDepth | 検証チェーンの最大長です。証明書チェーンの長さがこの値を超えると、検証は失敗します。 | 9 |
loadDefaultCAFile | OpenSSL 用の組み込み CA 証明書を使用するかどうかを指定します。ClickHouse は、組み込み CA 証明書がファイル /etc/ssl/cert.pem(またはディレクトリ /etc/ssl/certs)にあるか、環境変数 SSL_CERT_FILE(または SSL_CERT_DIR)で指定されたファイル(またはディレクトリ)内にあると想定します。 | true |
cipherList | サポートされている OpenSSL の暗号スイート | ALL:!ADH:!LOW:!EXP:!MD5:!3DES:@STRENGTH |
cacheSessions | セッションキャッシュを有効または無効にします。sessionIdContext と組み合わせて使用する必要があります。設定可能な値:true、false。 | false |
sessionIdContext | サーバーが生成する各識別子に付加される、サーバー固有のランダムな文字列です。文字列の長さは SSL_MAX_SSL_SESSION_ID_LENGTH を超えてはなりません。サーバー側でセッションをキャッシュする場合とクライアントがキャッシュを要求した場合の両方で問題を回避するのに役立つため、このパラメータを設定することを常に推奨します。 | $\{application.name\} |
sessionCacheSize | サーバーがキャッシュするセッションの最大数。値を 0 にすると、セッション数は無制限になります。 | 1024*20 |
sessionTimeout | サーバー上でのセッションキャッシュの保持時間(時間単位)。 | 2 |
extendedVerification | 有効化されている場合は、証明書の CN または SAN がピアのホスト名と一致していることを確認します。 | false |
requireTLSv1 | TLSv1 接続を要求します。指定可能な値は true または false です。 | false |
requireTLSv1_1 | TLSv1.1 接続を必須とします。指定可能な値:true、false。 | false |
requireTLSv1_2 | TLSv1.2 接続を必須とします。有効な値: true, false。 | false |
fips | OpenSSL の FIPS モードを有効化します。ライブラリで使用している OpenSSL のバージョンが FIPS をサポートしている場合にのみ有効です。 | false |
privateKeyPassphraseHandler | 秘密鍵にアクセスするためのパスフレーズを要求するクラス(PrivateKeyPassphraseHandler のサブクラス)。例えば: <privateKeyPassphraseHandler>, <name>KeyFileHandler</name>, <options><password>test</password></options>, </privateKeyPassphraseHandler>。 | KeyConsoleHandler |
invalidCertificateHandler | 無効な証明書を検証するためのクラス(CertificateHandler のサブクラス)。例えば、<invalidCertificateHandler> <name>RejectCertificateHandler</name> </invalidCertificateHandler> のように指定します。 | RejectCertificateHandler |
disableProtocols | 使用が禁止されているプロトコル。 | |
preferServerCiphers | クライアント優先のサーバー側暗号スイート。 | false |
設定例:
opentelemetry_span_log
opentelemetry_span_log システムテーブルの設定。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
例:
os_cpu_busy_time_threshold
OSCPUVirtualTimeMicroseconds メトリクス)の閾値(マイクロ秒単位)。ビジー時間がこの値未満の場合は、CPU 過負荷状態とは見なされません。
os_threads_nice_value_distributed_cache_tcp_handler
分散キャッシュ TCP ハンドラーのスレッドに対する Linux の nice 値です。値が小さいほど CPU の優先度は高くなります。
CAP_SYS_NICE ケーパビリティが必要で、ない場合は効果がありません(no-op)。
取りうる値: -20 ~ 19。
os_threads_nice_value_merge_mutate
マージおよびミューテーション処理用スレッドに対する Linux の nice 値。値が小さいほど CPU 優先度は高くなります。
CAP_SYS_NICE ケーパビリティが必要です。付与されていない場合は無効です。
取りうる値: -20 〜 19。
os_threads_nice_value_zookeeper_client_send_receive
ZooKeeper クライアントの送信スレッドおよび受信スレッド用の、Linux における nice 値。値が小さいほど CPU 優先度は高くなります。
CAP_SYS_NICE ケーパビリティが必要で、付与されていない場合は何も行われません。
取りうる値: -20 ~ 19。
page_cache_free_memory_ratio
min_free_kbytes 設定に相当します。
page_cache_history_window_ms
page_cache_max_size
page_cache_min_size より大きい場合、キャッシュサイズはこの範囲内で継続的に調整され、利用可能なメモリを最大限活用しつつ、合計メモリ使用量が上限(max_server_memory_usage[_to_ram_ratio])を下回るように保たれます。
page_cache_min_size
page_cache_policy
page_cache_shards
page_cache_size_ratio
part_log
MergeTree に関連するログイベントを記録します。例えば、データの追加やマージなどです。ログを使用してマージアルゴリズムの動作をシミュレートし、その特性を比較できます。マージ処理を可視化することもできます。
クエリは別ファイルではなく、system.part_log テーブルに記録されます。このテーブル名は table パラメータで設定できます(以下を参照)。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
例
parts_kill_delay_period
SharedMergeTree のパーツを完全に削除するまでの猶予期間。ClickHouse Cloud でのみ利用可能です
parts_kill_delay_period_random_add
極めて多くのテーブルが存在する場合に、kill_delay_period に 0 から x 秒までの一様分布に従う値を加算して、thundering herd 問題およびその結果として発生しうる ZooKeeper への DoS を回避します。ClickHouse Cloud でのみ利用可能です。
parts_killer_pool_size
共有 MergeTree テーブルの古くなったパーツをクリーンアップするためのスレッド数です。ClickHouse Cloud でのみ利用可能です。
path
データが格納されているディレクトリへのパス。
末尾のスラッシュは必須です。
例
postgresql_port
PostgreSQL プロトコル経由でクライアントと通信するためのポート。
- 正の整数はリッスンするポート番号を指定します。
- 空の値は、PostgreSQL プロトコル経由でのクライアントとの通信を無効にするために使用します。
例
postgresql_require_secure_transport
true に設定すると、postgresql_port を介したクライアントとの通信にはセキュアな経路が必須になります。sslmode=disable オプションによる接続は拒否されます。OpenSSL の設定と併用してください。
prefetch_threadpool_pool_size
prefetch_threadpool_queue_size
prefixes_deserialization_thread_pool_thread_pool_queue_size
prefixes deserialization スレッドプールにスケジュールできるジョブの最大数です。
0 の場合は無制限を意味します。
prepare_system_log_tables_on_startup
true の場合、ClickHouse は起動前にあらかじめ、設定されているすべての system.*_log テーブルを作成します。起動時に実行されるスクリプトがこれらのテーブルに依存している場合に役立ちます。
primary_index_cache_policy
primary_index_cache_prewarm_ratio
primary_index_cache_size
primary_index_cache_size_ratio
process_query_plan_packet
この設定を有効にすると、QueryPlan パケットを読み取れるようになります。これは、serialize_query_plan が有効な場合に、分散クエリに対して送信されるパケットです。
クエリプランのバイナリデシリアライズ処理におけるバグによって発生しうるセキュリティ上の問題を回避するため、デフォルトでは無効になっています。
例
processors_profile_log
processors_profile_log システムテーブルの設定です。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
デフォルトの設定は次のとおりです。
prometheus
Prometheus によるスクレイプ向けにメトリクスデータを公開します。
設定項目:
endpoint– Prometheus サーバーがメトリクスをスクレイプするための HTTP エンドポイント。先頭は '/' から開始します。port–endpoint用のポート。metrics– system.metrics テーブルからメトリクスを公開します。events– system.events テーブルからメトリクスを公開します。asynchronous_metrics– system.asynchronous_metrics テーブルから現在のメトリクス値を公開します。errors- サーバーの最後の再起動以降に発生したエラーコードごとのエラー数を公開します。この情報は system.errors からも取得できます。
例
確認します(127.0.0.1 を ClickHouse サーバーの IP アドレスまたはホスト名に置き換えてください):
proxy
HTTP および HTTPS リクエスト向けのプロキシサーバーを定義します。現在は S3 ストレージ、S3 テーブル関数、および URL 関数でサポートされています。
プロキシサーバーを定義する方法は 3 通りあります。
- 環境変数
- プロキシリスト
- リモートプロキシリゾルバ
特定のホストについては、no_proxy を使用してプロキシサーバーをバイパスすることもできます。
Environment variables
http_proxy と https_proxy 環境変数を使用すると、
特定のプロトコルに対してプロキシサーバーを指定できます。システム上でこれらが設定されていれば、そのまま問題なく動作します。
この方法は、特定のプロトコルに対して プロキシサーバーが 1 つだけであり、そのプロキシサーバーが変更されない場合に最も簡単です。
Proxy lists
この方法では、あるプロトコル向けのプロキシサーバーを 1 つ以上指定できます。複数のプロキシサーバーが定義されている場合、 ClickHouse は各プロキシをラウンドロビン方式で使用し、サーバー間で負荷を分散します。これは、1 つのプロトコルに対して複数の プロキシサーバーが存在し、そのプロキシサーバーのリストが変更されない場合に最も簡単な方法です。
Configuration template
下のタブから親フィールドを選択すると、その子フィールドが表示されます:
- <proxy>
- <http> and <https>
| Field | Description |
|---|---|
<http> | 1 つ以上の HTTP プロキシのリスト |
<https> | 1 つ以上の HTTPS プロキシのリスト |
| Field | Description |
|---|---|
<uri> | プロキシの URI |
リモートプロキシリゾルバ
プロキシサーバーが動的に変更される可能性があります。
その場合、リゾルバのエンドポイントを定義できます。ClickHouse は
そのエンドポイントに空の GET リクエストを送信し、リモートリゾルバはプロキシホストを返す必要があります。
ClickHouse は、次のテンプレートを使用してプロキシ URI を組み立てる際にこれを利用します: \{proxy_scheme\}://\{proxy_host\}:{proxy_port}
設定テンプレート
下のタブから親フィールドを選択して、その子要素を表示します:
- <proxy>
- <http> and <https>
- <resolver>
| Field | Description |
|---|---|
<http> | 1 つ以上の resolver のリスト* |
<https> | 1 つ以上の resolver のリスト* |
| Field | Description |
|---|---|
<resolver> | resolver のエンドポイントおよびその他の詳細 |
複数の <resolver> 要素を定義できますが、特定のプロトコルごとに使用されるのは
最初の <resolver> だけです。そのプロトコルに対するその他の <resolver>
要素は無視されます。つまり、必要に応じたロードバランシングはリモート側の resolver で実装する必要があります。
| Field | Description |
|---|---|
<endpoint> | プロキシ resolver の URI |
<proxy_scheme> | 最終的なプロキシ URI のプロトコル。http または https のいずれかを指定できます。 |
<proxy_port> | プロキシ resolver のポート番号 |
<proxy_cache_time> | resolver から取得した値を ClickHouse がキャッシュする秒数。この値を 0 に設定すると、ClickHouse はすべての HTTP および HTTPS リクエストごとに resolver に問い合わせます。 |
優先順位
プロキシ設定は、次の順序で決定されます:
| 順序 | 設定 |
|---|---|
| 1. | リモートプロキシリゾルバ |
| 2. | プロキシリスト |
| 3. | 環境変数 |
ClickHouse は、リクエストプロトコルに対して最も優先度の高いリゾルバタイプを参照します。定義されていない場合は、 環境変数リゾルバに到達するまで、次に優先度の高いリゾルバタイプを順に参照します。 これにより、複数種類のリゾルバタイプを組み合わせて使用することも可能です。
query_cache
Query cache の設定です。
利用可能な設定は次のとおりです。
| Setting | Description | Default Value |
|---|---|---|
max_size_in_bytes | キャッシュの最大サイズ(バイト数)。0 の場合、クエリキャッシュは無効になります。 | 1073741824 |
max_entries | キャッシュに保存される SELECT クエリ結果の最大件数。 | 1024 |
max_entry_size_in_bytes | キャッシュに保存される SELECT クエリ結果 1 件あたりの最大サイズ(バイト数)。 | 1048576 |
max_entry_size_in_rows | キャッシュに保存される SELECT クエリ結果 1 件あたりの最大行数。 | 30000000 |
- 設定を変更すると即座に反映されます。
- クエリキャッシュ用のデータは DRAM に割り当てられます。メモリが逼迫している場合は、
max_size_in_bytesを小さい値に設定するか、クエリキャッシュを無効化することを検討してください。
例
query_condition_cache_policy
query_condition_cache_size
クエリ条件キャッシュの最大サイズです。
この設定は実行時に変更でき、即座に反映されます。
query_condition_cache_size_ratio
query_log
log_queries=1 設定で受信したクエリのログ出力に関する設定です。
クエリは個別のファイルではなく、system.query_log テーブルに記録されます。テーブル名は table パラメーターで変更できます(下記参照)。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
テーブルが存在しない場合は、ClickHouse によって作成されます。ClickHouse サーバーのアップデートによって query log の構造が変更された場合、古い構造のテーブルは名前が変更され、新しいテーブルが自動的に作成されます。
例
query_masking_rules
正規表現ベースのルールで、サーバーログに保存される前のクエリおよびすべてのログメッセージに適用されます。
system.query_log、system.text_log、system.processes テーブル、ならびにクライアントに送信されるログに適用されます。これにより、氏名、メールアドレス、個人識別子、クレジットカード番号など、SQL クエリに含まれる機密データがログに漏洩するのを防ぐことができます。
例
設定フィールド:
| Setting | Description |
|---|---|
name | ルール名(省略可) |
regexp | RE2 互換正規表現(必須) |
replace | 機微データを置き換えるための文字列(省略可。指定しない場合はアスタリスク 6 文字) |
マスキングルールはクエリ全体に適用されます(不正な/パース不能なクエリから機微データが漏洩するのを防ぐため)。
system.events テーブルには QueryMaskingRulesMatch というカウンタがあり、クエリマスキングルールにマッチした回数の総計を保持します。
分散クエリの場合は、各サーバーを個別に設定する必要があります。そうしないと、他のノードに渡されるサブクエリはマスキングされずに保存されます。
query_metric_log
デフォルトでは無効になっています。
有効化
メトリクス履歴の収集 system.query_metric_log を手動で有効にするには、次の内容で /etc/clickhouse-server/config.d/query_metric_log.xml を作成します。
無効化
query_metric_log 設定を無効化するには、以下の内容で /etc/clickhouse-server/config.d/disable_query_metric_log.xml ファイルを作成します。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
query_thread_log
log_query_threads=1 設定で受信したクエリのスレッドをログに記録するための設定です。
クエリは個別のファイルではなく、system.query_thread_log テーブルに記録されます。テーブル名は table パラメータで変更できます(後述)。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
テーブルが存在しない場合、ClickHouse はテーブルを作成します。ClickHouse サーバーを更新した際にクエリスレッドログの構造が変更されていた場合は、旧構造を持つテーブルの名前が変更され、新しいテーブルが自動的に作成されます。
例
query_views_log
log_query_views=1 設定付きで受信したクエリに応じて、ビュー(ライブビュー、マテリアライズドビューなど)をログに記録するための設定です。
クエリは別ファイルではなく、system.query_views_log テーブルに記録されます。table パラメータ(後述)でテーブル名を変更できます。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
テーブルが存在しない場合、ClickHouse が作成します。ClickHouse サーバーのアップデート時に query views log の構造が変更されている場合は、古い構造のテーブルの名前が変更され、新しいテーブルが自動的に作成されます。
例
remap_executable
ヒュージページを使用して機械コード(「text」セクション)用のメモリを再割り当てするための設定です。
この機能は非常に実験的です。
例:
remote_servers
Distributed テーブルエンジンおよび cluster テーブル関数で使用されるクラスターを設定します。
例
incl 属性の値については、「設定ファイル」セクションを参照してください。
関連項目
remote_url_allow_hosts
URL 関連のストレージエンジンおよびテーブル関数で使用することが許可されているホストのリストです。
\<host\> XML タグでホストを追加する場合:
- DNS 解決の前に名前がチェックされるため、URL に記載されているものと完全に同一の形式で指定する必要があります。例:
<host>clickhouse.com</host> - URL でポートが明示的に指定されている場合は、host:port 全体としてチェックされます。例:
<host>clickhouse.com:80</host> - ホストがポートなしで指定されている場合、そのホストの任意のポートが許可されます。例えば
<host>clickhouse.com</host>が指定されている場合、clickhouse.com:20(FTP)、clickhouse.com:80(HTTP)、clickhouse.com:443(HTTPS) などが許可されます。 - ホストが IP アドレスとして指定されている場合、URL に記載されたとおりにチェックされます。例:
[2a02:6b8:a::a]。 - リダイレクトが存在し、リダイレクトのサポートが有効な場合は、すべてのリダイレクト (
Locationフィールド) がチェックされます。
例:
replica_group_name
Replicated データベースで使用するレプリカグループ名。
Replicated データベースによって作成されるクラスターは、同じグループに属するレプリカのみで構成されます。 DDL クエリは、同じグループに属するレプリカのみに対して待機します。
デフォルトでは空です。
例
replicated_fetches_http_connection_timeout
http_connection_timeout を継承します。
replicated_fetches_http_receive_timeout
http_receive_timeout の値が使用されます。
replicated_fetches_http_send_timeout
http_send_timeout を継承します。
replicated_merge_tree
ReplicatedMergeTree のテーブル用の微調整設定です。この設定の優先順位が高くなります。
詳細は MergeTreeSettings.h ヘッダーファイルを参照してください。
例
restore_threads
s3_credentials_provider_max_cache_size
s3_max_redirects
s3_retry_attempts
s3queue_disable_streaming
s3queue_log
s3queue_log システムテーブルに関する設定です。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
デフォルト設定は次のとおりです。
send_crash_reports
ClickHouse コア開発チームにクラッシュレポートを送信するための設定です。
特に本番前環境では、有効化していただけると非常に助かります。
キー:
| Key | Description |
|---|---|
enabled | 機能を有効にするかどうかを指定するブール値フラグ。デフォルトは true。クラッシュレポートを送信したくない場合は false に設定します。 |
send_logical_errors | LOGICAL_ERROR は assert のようなもので、ClickHouse におけるバグを示します。このブール値フラグを有効にすると、これらの例外も送信されます(デフォルト: true)。 |
endpoint | クラッシュレポート送信先のエンドポイント URL を上書きできます。 |
推奨される使い方
series_keeper_path
Keeper 内のパスであり、generateSerialID 関数によって自動インクリメントされる番号が割り当てられます。各シリーズはこのパス直下のノードとして作成されます。
show_addresses_in_stack_traces
shutdown_wait_backups_and_restores
shutdown_wait_unfinished
shutdown_wait_unfinished_queries
skip_binary_checksum_checks
ssh_server
ホストキーの公開鍵部分は、初回接続時に SSH クライアント側の known_hosts ファイルに書き込まれます。
ホストキー設定はデフォルトでは無効です。 ホストキー設定のコメントアウトを解除し、対応する SSH キーへのパスを指定して有効化してください。
例:
startup_mv_delay_ms
storage_configuration
ストレージのマルチディスク構成を行うための設定です。
ストレージ構成は次の構造に従います。
ディスクの設定
disks の設定は、以下のような構成になります。
上記のサブタグは、disks に対して次の設定を指定します:
| Setting | Description |
|---|---|
<disk_name_N> | 一意である必要があるディスクの名前。 |
path | サーバーデータ(data および shadow カタログ)が保存されるパス。/ で終わる必要があります。 |
keep_free_space_bytes | ディスク上で確保しておく空き領域のサイズ。 |
ディスクの順序は関係ありません。
ポリシーの設定
上記のサブタグは、policies に対して次の設定を指定します:
| Setting | Description |
|---|---|
policy_name_N | ポリシー名。ポリシー名は一意である必要があります。 |
volume_name_N | ボリューム名。ボリューム名は一意である必要があります。 |
disk | ボリューム内に配置されているディスク。 |
max_data_part_size_bytes | このボリューム内の任意のディスク上に存在できるデータチャンクの最大サイズ。この値より大きくなると予想されるチャンクサイズでマージが行われる場合、そのチャンクは次のボリュームに書き込まれます。基本的に、この機能により、新規/小さいチャンクをホット(SSD)ボリュームに保存し、サイズが大きくなったらコールド(HDD)ボリュームに移動できます。ポリシー内にボリュームが 1 つしかない場合は、このオプションを使用しないでください。 |
move_factor | ボリューム上で利用可能な空き容量の割合。この割合を下回ると、(存在する場合は)データの次のボリュームへの転送が開始されます。転送時には、チャンクはサイズの大きい順(降順)に並べ替えられ、合計サイズが move_factor の条件を満たすのに十分なチャンクが選択されます。すべてのチャンクの合計サイズが不十分な場合は、すべてのチャンクが移動されます。 |
perform_ttl_move_on_insert | 挿入時に、TTL が期限切れのデータを移動する動作を無効にします。デフォルト(有効)の場合、TTL ベースの移動ルールに従ってすでに期限切れとなっているデータを挿入すると、即座に移動ルールで指定されたボリューム/ディスクに移動されます。ターゲットのボリューム/ディスクが遅い場合(例: S3)、これにより挿入が大幅に低速化する可能性があります。無効にした場合、期限切れのデータ部分はいったんデフォルトボリュームに書き込まれ、その後すぐに、期限切れ TTL 用のルールで指定されたボリュームに移動されます。 |
load_balancing | ディスクの負荷分散ポリシー。round_robin または least_used を指定します。 |
least_used_ttl_ms | すべてのディスク上の空き容量を更新するタイムアウト(ミリ秒)を設定します(0 - 常に更新、-1 - 更新しない、デフォルト値は 60000)。ディスクが ClickHouse だけに使用され、オンラインでファイルシステムをリサイズしない場合は、-1 の値を使用できます。それ以外の場合、この値は推奨されません。最終的に不正確な空き容量の割り当てにつながるためです。 |
prefer_not_to_merge | このボリューム上でのデータパーツのマージを無効にします。注意: これは潜在的に有害であり、パフォーマンス低下の原因となる可能性があります。この設定を有効にすると(推奨しません)、このボリューム上でのデータのマージは禁止されます(望ましくありません)。これにより、ClickHouse が低速ディスクとどのようにやり取りするかを制御できますが、基本的には使用しないことを推奨します。 |
volume_priority | ボリュームがどの順序で埋められるかの優先度(順序)を定義します。値が小さいほど優先度は高くなります。パラメータの値は自然数であり、1 から N(N は指定されたパラメータ値の最大値)までの範囲を欠番なく網羅している必要があります。 |
volume_priority について:
- すべてのボリュームにこのパラメータが設定されている場合、指定された順序で優先されます。
- 一部の ボリュームにだけ設定されている場合、設定されていないボリュームは最も低い優先度になります。設定されているボリュームはタグ値に従って優先され、残りのボリュームの優先度は、設定ファイル内での記述順によって決まります。
- いずれの ボリュームにもこのパラメータが設定されていない場合、優先度は設定ファイル内での記述順によって決まります。
- ボリュームの優先度が同一である必要はありません。
storage_connections_soft_limit
storage_connections_store_limit
storage_connections_warn_limit
storage_metadata_write_full_object_key
storage_shared_set_join_use_inner_uuid
table_engines_require_grant
true に設定した場合、ユーザーは特定のテーブルエンジンを使用してテーブルを作成するための GRANT 権限が必要になります(例: GRANT TABLE ENGINE ON TinyLog TO user)。
既定では後方互換性のため、特定のテーブルエンジンを指定してテーブルを作成する際に GRANT 権限は無視されますが、この設定を true にすることでこの動作を変更できます。
tables_loader_background_pool_size
バックグラウンドプールで非同期ロードジョブを実行するスレッド数を設定します。バックグラウンドプールは、そのテーブルを待っているクエリがない場合に、サーバー起動後にテーブルを非同期でロードするために使用されます。テーブル数が多い場合は、バックグラウンドプール内のスレッド数を少なく保つことで有利になる場合があります。これにより、同時クエリ実行のための CPU リソースを確保できます。
値が 0 の場合、利用可能なすべての CPU が使用されます。
tables_loader_foreground_pool_size
フォアグラウンドプールでロードジョブを実行するスレッド数を設定します。フォアグラウンドプールは、サーバーがポートでのリッスンを開始する前にテーブルを同期的にロードする場合や、ロード完了を待機しているテーブルをロードする場合に使用されます。フォアグラウンドプールはバックグラウンドプールよりも優先度が高く、フォアグラウンドプールでジョブが実行中の間は、バックグラウンドプールでジョブは開始されません。
値が 0 の場合、利用可能なすべての CPU が使用されます。
tcp_close_connection_after_queries_num
tcp_close_connection_after_queries_seconds
tcp_port
クライアントとの TCP 通信に使用するポート。
例
tcp_port_secure
クライアントとのセキュアな通信に使用する TCP ポートです。OpenSSL の設定と組み合わせて使用します。
デフォルト値
tcp_ssh_port
ユーザーが PTY 経由で組み込みクライアントを使用して対話的に接続し、クエリを実行するための SSH サーバーのポート。
例:
temporary_data_in_cache
このオプションを使用すると、特定のディスクについて、一時データがそのディスクのキャッシュに保存されます。
このセクションでは、タイプが cache のディスク名を指定する必要があります。
この場合、キャッシュと一時データは同じ領域を共有し、一時データを作成するためにディスクキャッシュが破棄される(追い出される)可能性があります。
一時データの保存先を設定するには、tmp_path、tmp_policy、temporary_data_in_cache のいずれか 1 つのみを使用できます。
例
local_disk 用のキャッシュと一時データの両方が、ファイルシステム上の /tiny_local_cache に保存され、tiny_local_cache によって管理されます。
temporary_data_in_distributed_cache
text_index_dictionary_block_cache_max_entries
text_index_dictionary_block_cache_policy
text_index_dictionary_block_cache_size
この設定は実行時に変更でき、即座に反映されます。
text_index_dictionary_block_cache_size_ratio
text_index_header_cache_max_entries
text_index_header_cache_policy
text_index_header_cache_size
この設定は実行時に変更でき、変更は直ちに反映されます。
text_index_header_cache_size_ratio
text_index_postings_cache_max_entries
text_index_postings_cache_policy
text_index_postings_cache_size
この設定は実行時に変更でき、即座に反映されます。
text_index_postings_cache_size_ratio
text_log
テキストメッセージをログ出力するための text_log システムテーブルの設定です。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
加えて、次の設定があります。
| Setting | Description | Default Value |
|---|---|---|
level | テーブルに保存されるメッセージの最大レベル(既定値は Trace)。 | Trace |
例
thread_pool_queue_size
グローバルスレッドプールにスケジュールできるジョブの最大数です。キューサイズを大きくするとメモリ使用量が増加します。この値は max_thread_pool_size と同じ値にすることを推奨します。
0 は無制限を意味します。
例
threadpool_local_fs_reader_pool_size
local_filesystem_read_method = 'pread_threadpool' の場合に、ローカルファイルシステムからの読み込みを行うスレッドプールのスレッド数。
threadpool_local_fs_reader_queue_size
threadpool_remote_fs_reader_pool_size
remote_filesystem_read_method = 'threadpool' の場合に、リモートファイルシステムからの読み取りに使用されるスレッドプールのスレッド数。
threadpool_remote_fs_reader_queue_size
threadpool_writer_pool_size
threadpool_writer_queue_size
throw_on_unknown_workload
クエリ設定 'workload' を使用して未知の WORKLOAD にアクセスした際の動作を定義します。
trueの場合、未知の WORKLOAD へアクセスしようとするクエリから RESOURCE_ACCESS_DENIED 例外がスローされます。これは、WORKLOAD 階層が確立され、WORKLOAD defaultを含むようになった後に、すべてのクエリに対してリソーススケジューリングを強制するのに有用です。false(デフォルト)の場合、'workload' 設定が未知の WORKLOAD を指していても、そのクエリはリソーススケジューリングなしで無制限にアクセスできます。これは、WORKLOAD defaultが追加される前の WORKLOAD 階層の設定中に重要となります。
例
関連項目
timezone
サーバーのタイムゾーンです。
UTC タイムゾーンまたは地理的位置を表す IANA 識別子で指定します(例: Africa/Abidjan)。
タイムゾーンは、DateTime フィールドをテキスト形式で出力する際(画面表示やファイル出力)、および文字列から DateTime を取得する際に、String と DateTime の形式を相互に変換するために必要です。さらに、入力パラメータとしてタイムゾーンを受け取らない時間・日付関連の関数においても、内部で使用されます。
例
関連項目
tmp_path
大規模なクエリを処理するための一時データを保存するローカルファイルシステム上のパス。
- 一時データの保存先を設定するオプションとして使用できるのは、
tmp_path、tmp_policy、temporary_data_in_cacheのいずれか 1 つだけです。 - 末尾のスラッシュは必須です。
例
tmp_policy
一時データを格納するストレージ用のポリシーです。tmp プレフィックスを持つすべてのファイルは起動時に削除されます。
tmp_policy としてオブジェクトストレージを使用する際の推奨事項:
- 各サーバーで個別の
bucket:pathを使用する metadata_type=plainを使用する- このバケットに対して TTL を設定することも検討してください
- 一時データストレージの設定には、
tmp_path、tmp_policy、temporary_data_in_cacheのいずれか一つしか使用できません。 move_factor、keep_free_space_bytes、max_data_part_size_bytesは無視されます。- ポリシーは 1 つのボリューム のみを持つ必要があります
詳細については MergeTree Table Engine のドキュメントを参照してください。
例
/disk1 がいっぱいになった場合、一時データは /disk2 に保存されます。
top_level_domains_list
追加するカスタムトップレベルドメインのリストを定義します。各エントリは <name>/path/to/file</name> という形式です。
例えば次のようになります。
関連項目:
- 関数
cutToFirstSignificantSubdomainCustomおよびそのバリエーション。 これらはカスタムの TLD リスト名を受け取り、トップレベルドメイン直下から最初の意味のあるサブドメインまでを含むドメイン部分を返します。
total_memory_profiler_sample_max_allocation_size
total_memory_profiler_sample_probability と同じ確率で、指定した値以下のサイズのランダムなメモリ割り当てを収集します。0 は無効を意味します。このしきい値が意図したとおりに動作するようにするには、max_untracked_memory を 0 に設定することを推奨します。
total_memory_profiler_sample_min_allocation_size
total_memory_profiler_sample_probability の確率でランダムに収集します。0 の場合は無効です。このしきい値が想定どおりに動作するように、max_untracked_memory を 0 に設定することを検討してください。
total_memory_profiler_step
total_memory_tracker_sample_probability
ランダムなメモリの割り当ておよび解放を収集し、指定した確率で trace_type が MemorySample の行として system.trace_log システムテーブルに書き込みます。この確率は、割り当てサイズに関係なく、各割り当ておよび解放ごとに適用されます。サンプリングは、未追跡メモリ量が未追跡メモリ制限(デフォルト値は 4 MiB)を超えた場合にのみ行われる点に注意してください。total_memory_profiler_step を小さくすると、この制限を下げることができます。より細かい粒度でサンプリングするには、total_memory_profiler_step を 1 に設定できます。
設定可能な値:
- 正の倍精度実数。
0—system.trace_logシステムテーブルへのランダムな割り当ておよび解放の書き込みを無効にします。
trace_log
trace_log システムテーブルの動作を制御するための設定です。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
デフォルトのサーバー設定ファイル config.xml には、次の設定セクションが含まれています。
uncompressed_cache_policy
uncompressed_cache_size
MergeTree ファミリーのテーブルエンジンが使用する非圧縮データ用キャッシュの最大サイズ(バイト単位)。
サーバー全体で共有されるキャッシュが 1 つだけ存在します。メモリはオンデマンドで割り当てられます。オプション use_uncompressed_cache が有効な場合にキャッシュが使用されます。
非圧縮キャッシュは、一部のケースでの非常に短いクエリに対して有利に働きます。
値が 0 の場合は無効を意味します。
この設定は実行時に変更でき、即座に反映されます。
uncompressed_cache_size_ratio
url_scheme_mappers
短縮された、またはシンボリックな URL プレフィックスをフル URL に変換するための設定。
例:
use_minimalistic_part_header_in_zookeeper
ZooKeeper 内でのデータパートヘッダーの保存方法を指定します。この設定は MergeTree ファミリーにのみ適用されます。次のいずれかの方法で指定できます。
config.xml ファイルの merge_tree セクションでグローバルに指定
ClickHouse はサーバー上のすべてのテーブルに対してこの設定を適用します。この設定はいつでも変更できます。既存のテーブルも、設定が変更されるとその動作が変わります。
テーブルごとに指定
テーブルを作成するときに、対応する エンジン設定 を指定します。この設定を持つ既存のテーブルの動作は、グローバル設定が変わっても変化しません。
設定可能な値
0— 機能を無効にします。1— 機能を有効にします。
use_minimalistic_part_header_in_zookeeper = 1 の場合、replicated テーブルは、1 つの znode を使ってデータパートヘッダーをコンパクトに保存します。テーブルに多くのカラムが含まれている場合、この保存方法により ZooKeeper に保存されるデータ量を大幅に削減できます。
use_minimalistic_part_header_in_zookeeper = 1 を適用した後は、この設定をサポートしていないバージョンの ClickHouse サーバーにダウングレードすることはできません。クラスタ内のサーバーで ClickHouse をアップグレードする際は注意してください。すべてのサーバーを一度にアップグレードしないでください。ClickHouse の新バージョンは、テスト環境やクラスタ内の一部のサーバーで事前に検証しておく方が安全です。
この設定を有効にした状態で既に保存されたデータパートヘッダーは、以前の(非コンパクトな)形式に復元することはできません。
user_defined_executable_functions_config
実行可能なユーザー定義関数の設定ファイルへのパスです。
パス:
- 絶対パスまたはサーバー設定ファイルからの相対パスを指定します。
- パスにはワイルドカードの * と ? を含めることができます。
参照:
例
user_defined_path
ユーザー定義ファイルを配置するディレクトリです。SQL User Defined Functions による SQL ユーザー定義関数で使用されます。
例
user_directories
各種設定を含む設定ファイル内のセクションです。
- 事前定義されたユーザーが記述されている設定ファイルへのパス。
- SQL コマンドで作成されたユーザーが保存されるフォルダーへのパス。
- SQL コマンドで作成されたユーザーが保存およびレプリケートされる ZooKeeper ノードのパス。
このセクションが指定されている場合、users_config と access_control_path のパスは使用されません。
user_directories セクションには任意の数の項目を含めることができ、項目の並び順が優先順位を表します(上にある項目ほど優先順位が高くなります)。
例
ユーザー、ロール、行ポリシー、クオータおよびプロファイルは、ZooKeeperに保存することもできます。
セクションとして memory を定義することもできます。これは情報をディスクに書き込まずメモリ上のみに保持することを意味します。また、ldap は LDAP サーバー上に情報を保存することを意味します。
ローカルに定義されていないユーザーのリモートユーザーディレクトリとして LDAP サーバーを追加するには、次の設定を持つ 1 つの ldap セクションを定義します。
| Setting | Description |
|---|---|
server | ldap_servers 設定セクションで定義された LDAP サーバー名のいずれか。このパラメータは必須で、空にはできません。 |
roles | LDAP サーバーから取得された各ユーザーに割り当てられる、ローカルで定義されたロールの一覧を持つセクション。ロールが指定されていない場合、ユーザーは認証後に一切の操作を実行できません。列挙されたロールのいずれかが認証時点でローカルに定義されていない場合、認証試行は与えられたパスワードが誤っている場合と同様に失敗します。 |
例
user_files_path
ユーザーファイルが格納されているディレクトリです。テーブル関数 file()、fileCluster() で使用されます。
例
user_scripts_path
ユーザースクリプトファイルを配置するディレクトリです。実行可能なユーザー定義関数で使用されます。詳しくはExecutable User Defined Functionsを参照してください。
例
型:
デフォルト値:
users_config
次の内容を含むファイルへのパスです:
- ユーザー設定
- アクセス権
- 設定プロファイル
- クォータ設定
例
validate_tcp_client_information
デフォルトでは false です。
vector_similarity_index_cache_max_entries
vector_similarity_index_cache_policy
vector_similarity_index_cache_size
この設定は実行時に変更でき、直ちに反映されます。
vector_similarity_index_cache_size_ratio
wait_dictionaries_load_at_startup
この設定は、dictionaries_lazy_load が false の場合の動作を指定します。
(dictionaries_lazy_load が true の場合、この設定は何の影響も与えません。)
wait_dictionaries_load_at_startup が false の場合、サーバーは起動時に
すべてのディクショナリのロードを開始し、そのロードと並行して接続を受け付けます。
あるディクショナリがクエリ内で初めて使用されるとき、そのディクショナリがまだロードされていなければ、
クエリはそのディクショナリのロードが完了するまで待機します。
wait_dictionaries_load_at_startup を false に設定すると、ClickHouse の起動を高速化できますが、
一部のクエリの実行が遅くなる場合があります(特定のディクショナリのロード完了を待つ必要があるため)。
wait_dictionaries_load_at_startup が true の場合、サーバーは起動時に
すべてのディクショナリのロード(成功/失敗を問わず)が完了するまで待機し、それが完了してから接続を受け付けます。
例
workload_path
すべての CREATE WORKLOAD および CREATE RESOURCE クエリの保存先として使用されるディレクトリです。デフォルトでは、サーバーのワーキングディレクトリ配下の /workload/ ディレクトリが使用されます。
例
関連項目
workload_zookeeper_path
ZooKeeper ノードへのパスです。CREATE WORKLOAD および CREATE RESOURCE クエリすべての保存先として使用されます。一貫性を保つため、すべての SQL 定義はこの単一の znode の値として保存されます。デフォルトでは ZooKeeper は使用されず、定義は disk に保存されます。
例
関連項目
zookeeper
ClickHouse が ZooKeeper クラスターと連携するための設定を含みます。ClickHouse はレプリケーテッドテーブルを使用する際に、レプリカのメタデータを保存するために ZooKeeper を使用します。レプリケーテッドテーブルを使用しない場合、このセクションのパラメータは省略できます。
次の設定はサブタグで指定できます。
| Setting | Description |
|---|---|
node | ZooKeeper のエンドポイント。複数のエンドポイントを設定できます。例: <node index="1"><host>example_host</host><port>2181</port></node>。index 属性は、ZooKeeper クラスターへの接続を試行する際のノードの順序を指定します。 |
session_timeout_ms | クライアントセッションの最大タイムアウト(ミリ秒)。 |
operation_timeout_ms | 1 回の操作の最大タイムアウト(ミリ秒)。 |
root (optional) | ClickHouse サーバーが使用する znode 群に対してルートとして使用される znode。 |
fallback_session_lifetime.min (optional) | プライマリが利用できないとき(ロードバランシング)のフォールバックノードに対する ZooKeeper セッション存続期間の最小制限。秒単位で指定します。デフォルト: 3 時間。 |
fallback_session_lifetime.max (optional) | プライマリが利用できないとき(ロードバランシング)のフォールバックノードに対する ZooKeeper セッション存続期間の最大制限。秒単位で指定します。デフォルト: 6 時間。 |
identity (optional) | 要求された znode にアクセスするために ZooKeeper が要求するユーザーとパスワード。 |
use_compression (optional) | true に設定すると Keeper プロトコルで圧縮を有効にします。 |
また、ZooKeeper ノードの選択アルゴリズムを選べる zookeeper_load_balancing 設定(オプション)もあります。
| Algorithm Name | Description |
|---|---|
random | ZooKeeper ノードのうち 1 つをランダムに選択します。 |
in_order | 最初の ZooKeeper ノードを選択し、それが利用できない場合は 2 番目、その次という順に選択します。 |
nearest_hostname | サーバーのホスト名と最も類似したホスト名を持つ ZooKeeper ノードを選択します。ホスト名は名前のプレフィックスで比較されます。 |
hostname_levenshtein_distance | nearest_hostname と同様ですが、ホスト名をレーベンシュタイン距離で比較します。 |
first_or_random | 最初の ZooKeeper ノードを選択し、それが利用できない場合は残りの ZooKeeper ノードからランダムに 1 つ選択します。 |
round_robin | 最初の ZooKeeper ノードを選択し、再接続が発生した場合は次のノードを選択します。 |
設定例
関連項目
zookeeper_log
zookeeper_log システムテーブルの設定です。
以下の設定はサブタグで指定できます。
The following settings can be configured by sub-tags:
| Setting | Description | Default | Note |
|---|---|---|---|
database | Name of the database. | ||
table | Name of the system table. | ||
engine | MergeTree Engine Definition for a system table. | Cannot be used if partition_by or order_by defined. If not specified MergeTree is selected by default | |
partition_by | Custom partitioning key for a system table. | If engine is specified for system table, partition_by parameter should be specified directly inside 'engine' | |
ttl | Specifies the table TTL. | If engine is specified for system table, ttl parameter should be specified directly inside 'engine' | |
order_by | Custom sorting key for a system table. Can't be used if engine defined. | If engine is specified for system table, order_by parameter should be specified directly inside 'engine' | |
storage_policy | Name of the storage policy to use for the table (optional). | If engine is specified for system table, storage_policy parameter should be specified directly inside 'engine' | |
settings | Additional parameters that control the behavior of the MergeTree (optional). | If engine is specified for system table, settings parameter should be specified directly inside 'engine' | |
flush_interval_milliseconds | Interval for flushing data from the buffer in memory to the table. | 7500 | |
max_size_rows | Maximal size in lines for the logs. When the amount of non-flushed logs reaches the max_size, logs are dumped to the disk. | 1048576 | |
reserved_size_rows | Pre-allocated memory size in lines for the logs. | 8192 | |
buffer_size_rows_flush_threshold | Threshold for amount of lines. If the threshold is reached, flushing logs to the disk is launched in background. | max_size_rows / 2 | |
flush_on_crash | Sets whether logs should be dumped to the disk in case of a crash. | false |
例