我有两个关于如何在clickhouse中切分的问题。
问题1。在clickhouse中是否需要使用分布式引擎进行切分?
问题2。我想知道是否可以根据我设置的标准进行切分,而不是根据切分的重量自动分配。
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.
谢谢你阅读我的问题。我期待你的答复。
1条答案
按热度按时间kse8i1jr1#
问题1。在clickhouse中是否需要使用分布式引擎进行切分?
对。分布式引擎知道如何将查询分发到分布在碎片和副本上的本地表。否则,您需要对每个shard运行查询并自己组装结果。
问题2。我想知道是否可以根据我设置的标准进行切分,而不是根据切分的重量自动分配。
对。有两种方法可以将数据写入碎片。
通过分布式表插入。clickhouse将使用分片键分发到本地表。
直接写入本地表。在这种情况下,由您决定如何分发数据。许多安装都使用这种方法,因为它可以通过直接访问底层表来获得更高的性能。
分布式引擎实际上只是本地表的网关,这就是#2工作的原因。