简体   繁体   English

ClickHouse ReplicatedMergeTrees配置问题

[英]ClickHouse ReplicatedMergeTrees configuration problems

I have two tables on two different machines both running zookeeper as a daemon, one of them has myid 1 the other has myid 2. 我在两台不同的计算机上有两个表,两个表都将zookeeper作为守护程序运行,其中一个具有myid 1,另一个具有myid 2。

The table is configured as such on the machine "1": 该表在机器“ 1”上的配置如下:

CREATE TABLE test(values)
ReplicatedMergeTree('/clickhouse/tables/01/test', '1', date, timestamp, 8192)

The table is configured as such on the machine "2": 该表在机器“ 2”上的配置如下:

CREATE TABLE test(values)
ReplicatedMergeTree('/clickhouse/tables/01/test', '2', date, timestamp, 8192)

The 01 in the '/clickhouse/tables/01/test' is probably the values messing with me... since I '{layer}-{shard}' with it.... but since I have no remote_servers configured I assumed I can just use any value and it wouldn't matter, since I don't want query distribution, just data duplication. “ / clickhouse / tables / 01 / test”中的01可能是困扰我的值……因为我使用了“ {layer}-{shard}”……。但是由于我没有配置remote_servers,所以我认为我可以使用任何值,这并不重要,因为我不希望查询分布,而只是数据重复。

Also the tables seem to be "aware" of eachother since creating two tables with the replica number '2' or '1' results in an error saying such a table already exists. 由于创建两个副本号为'2'或'1'的表会导致错误,表明该表已经存在,因此这些表似乎彼此“意识到”。

Do I need to configure a remote_server by default if I want to use replication ? 如果要使用复制,是否需要默认配置remote_server? Do I need to configure zookeeper specifically for the tables I want to replicated ? 我是否需要为要复制的表专门配置zookeeper? Do you guys have any in-details examples of setting up data replication with clickhouse ? 你们是否有使用clickhouse设置数据复制的详细示例?

It seems that you have done everything correctly. 看来您已正确完成所有操作。 {layer}-{shard} part is optional - it just simplifies creation of similar tables on many servers. {layer}-{shard}部分是可选的-只是简化了许多服务器上相似表的创建。 Bare minimum for configuring a replicated table is a path in zookeeper that is common for all replicas (by convention this path starts with /clickhouse/tables/ but in fact any unique path will do) and an identifier that is unique to each replica ( '1' and '2' are totally OK, but more descriptive names allowing you to identify the corresponding host are recommended). 配置复制表的最低要求是/clickhouse/tables/所有副本都通用的路径(按照惯例,该路径以/clickhouse/tables/开头,但实际上任何唯一路径都可以)和每个副本唯一的标识符( '1''2'完全可以,但是建议使用更具描述性的名称,以便您标识相应的主机。

Configuring remote_servers is not necessary for replication, but zookeeper is required. 复制不需要配置remote_servers ,但是zookeeper是必需的。 You can use a single zookeeper cluster for all replicated tables. 您可以对所有复制的表使用单个Zookeeper集群。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM