在 clickhouse 中有什么方法可以分片吗?
is there someway to sharding in clickhouse?
我有两个关于如何在 clickhouse 中分片的问题。
Q1。
clickhouse sharding 有必要使用分布式引擎吗?
Q2。
请问是不是可以按照我设置的标准分片,不是按照分片的权重自动分配。
Example.
- If id is 1, it is stored in shard1.
- If id is 2, it is stored in shard2.
- If id is 3, it is stored in shard3.
I understand the sharding through the distribution engine as follows.
- distributed engine use the cluster defined in the config.xml file.
- It is automatically distributed to the shard according to the weight of the shard.
感谢您阅读我的问题。期待您的回复。
Q1. Is it necessary to use a distributed engine for sharding in clickhouse?
是的。分布式引擎知道如何将查询分发到分布在分片和副本上的本地 table。如果没有这个,您将需要 运行 每个分片上的查询和 assemble 自己的结果。
Q2. I wonder if sharding is possible according to the criteria that I set, not automatically distributed according to the weight of the shard.
是的。有两种方法可以将数据写入分片。
- 通过分布式插入table。 ClickHouse会使用sharding key分发到本地table(s)
- 直接写入本地table。在这种情况下,由您决定如何分发数据。许多安装都使用这种方法,因为它通过直接进入底层 table 来实现更高的性能。
分布式引擎实际上只是通往本地 table 的网关,这就是 #2 起作用的原因。
我有两个关于如何在 clickhouse 中分片的问题。
Q1。 clickhouse sharding 有必要使用分布式引擎吗?
Q2。 请问是不是可以按照我设置的标准分片,不是按照分片的权重自动分配。
Example.
- If id is 1, it is stored in shard1.
- If id is 2, it is stored in shard2.
- If id is 3, it is stored in shard3.
I understand the sharding through the distribution engine as follows.
- distributed engine use the cluster defined in the config.xml file.
- It is automatically distributed to the shard according to the weight of the shard.
感谢您阅读我的问题。期待您的回复。
Q1. Is it necessary to use a distributed engine for sharding in clickhouse?
是的。分布式引擎知道如何将查询分发到分布在分片和副本上的本地 table。如果没有这个,您将需要 运行 每个分片上的查询和 assemble 自己的结果。
Q2. I wonder if sharding is possible according to the criteria that I set, not automatically distributed according to the weight of the shard.
是的。有两种方法可以将数据写入分片。
- 通过分布式插入table。 ClickHouse会使用sharding key分发到本地table(s)
- 直接写入本地table。在这种情况下,由您决定如何分发数据。许多安装都使用这种方法,因为它通过直接进入底层 table 来实现更高的性能。
分布式引擎实际上只是通往本地 table 的网关,这就是 #2 起作用的原因。