ClickHouse / ClickHouse/ClickHouse
Clickhouse Nodes out of sync causing Code 242 DB:Exception and Keeper_exception
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
Hello,
I have migrated my FortiSiem DB into clickhouse the last 6 months and I face the following issues.
Firstly, let me clear that I contact the vendor support but they can't resolve the issue apart from telling me to remove keep only 1 keeper node instead of 3.
My architecture: 1 supervisor, 3 keeper only nodes, 2 data nodes x 2 shards (4 total data & query nodes)
All nodes are VMs running on ESXi host. The clickhouse runs properly apart from some times, which is usually once per week, throws this exception in the logs:

**Code 242** DB: Exception, table is in readonly mode
**OR** **Code: 999**, Session expired
Keep in mind that VMs run on the same host and only a VSwitch exist between them for sending/receiving packets.
After investigation in the keeper logs, we discovered possible connectivity issue between keepers causing replicas on data nodes to go in read only state:
keeper2-data-clickhouse-hot-1/clickhouse-keeper/app_logs/clickhouse-keeper.log:2024.05.21 17:23:41.008101 [ 2268 ] {} RaftInstance: Election timeout, initiate leader election
keeper3-data-clickhouse-hot-1/clickhouse-keeper/app_logs/clickhouse-keeper.log:2024.05.20 17:04:09.139589 [ 2253 ] {} RaftInstance: Election timeout, initiate leader election
There are cases where timeout occurs because response time is <500ms
Although I suspect the issue might be a connectivity, I checked the ESXi host that has the VMs running and I cannot conclude that this is the cause because it has low cpu/ram/disk usage.
My questions to the community are:
1) Based on your experience, what are the possible causes of these issues?
2) How can I check that ESXi has issues on CPU wait time for the VMs and if this is the cause, how to improve that?
Contributor guide
Assessment
This issue has not been assessed yet.