- 项目场景:在clickhouse中创建副本表
- 问题描述:
- 原因分析:
- 解决方案:
问题描述: 创建副本表之后,插入数据,在副本服务器上查不到数据
CREATE TABLE default.test_distribute ON CLUSTER clickhouse_remote_servers(`EventDate` DateTime,`id` UInt64) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/default/test_distribute', '{replica}') PARTITION BY toYYYYMM(EventDate) ORDER BY id;
CREATE TABLE default.test_distribute_all ON CLUSTER clickhouse_remote_servers(`EventDate` DateTime,`id` UInt64) ENGINE = Distributed(clickhouse_remote_servers, default, test_distribute, rand());
insert into test_distribute values('2021-10-11 12:28:30',22,2);
原因分析: 经过检查配置文件,并没有发现问题,通过查看clickhouse的错误日志,发现了问题
cat /var/log/clickhouse-server/clickhouse-server.err.log
2021.10.11 15:45:57.518772 [ 8756 ] {} default.test_log (3f78b238-92aa-4cf8-bf78-b23892aadcf8): auto DB::StorageReplicatedMergeTree::processQueueEntry(Replica::SelectedEntryPtr)::(anonymous class)::operator()(DB::StorageReplicatedMergeTree::LogEntryPtr &) const: Poco::Exception. Code: 1000, e.code() = 0, e.displayText() =
timed out: 10.131.52.38:9009
, Stack trace (when copying this message, always include the lines below):
解决方案:
关闭副本所在主机的防火墙即可。
部署参考:
[1]: http://fuxkdb.com/2020/05/02/2020-05-02-ClickHouse%E5%A4%9A%E5%AE%9E%E4%BE%8B%E9%83%A8%E7%BD%B2/



