惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
P
Privacy International News Feed
Hugging Face - Blog
Hugging Face - Blog
U
Unit 42
博客园 - 叶小钗
月光博客
月光博客
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
The Hacker News
The Hacker News
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
Google DeepMind News
Google DeepMind News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Help Net Security
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Security Latest
Security Latest
I
Intezer
L
LINUX DO - 最新话题
Blog — PlanetScale
Blog — PlanetScale
T
The Exploit Database - CXSecurity.com
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Webroot Blog
Webroot Blog
WordPress大学
WordPress大学
A
About on SuperTechFans
P
Proofpoint News Feed
T
Tailwind CSS Blog
I
InfoQ
The Register - Security
The Register - Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AWS News Blog
AWS News Blog
博客园 - Franky
Simon Willison's Weblog
Simon Willison's Weblog
Last Week in AI
Last Week in AI
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google Online Security Blog
Google Online Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Attack and Defense Labs
Attack and Defense Labs
T
Tenable Blog
大猫的无限游戏
大猫的无限游戏
K
Kaspersky official blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
S
Security @ Cisco Blogs
MongoDB | Blog
MongoDB | Blog

ike‘s blog

mac软件推荐 用Siri来控制Windows电脑开机关机吧 clickhouse的一些优化建议和工具 2023sumppary 记录一下我的第一个网页游戏Mazeball 如何使用Clickhouse的索引 cloki分布式查询和clickhouse副本存储 使用ilogtail+cloki+clickhouse来做日志系统吧 clickhouse集群部署指南 快速安装部署clickhouse和cloki 快速部署thanos架构 如何使用go的jwt 如何修改git commit记录 业务容器化需要注意的一些地方 游戏企划 Prometheus Metrics精简优化2 来在线听音乐吧 Chatgpt的API入门 简单搭建国内也可以使用的chatgpt Prometheus Metrics精简优化 Kubernetes的探针机制 本地部署chatAI【chatglm】 AI绘画工具webui简单入门 之 高清化 写在地下城邂逅Ⅳ·灾厄篇·完结之后 如何部署gitalk作为评论系统 AI绘画工具webui简单入门 之 工具安装 grafanadb迁移到mysql kubectl常用命令 开始写博客啦 隐私政策URL Markdown Example Include Video in the Posts Markdown Extended Features Simple Guides for Fuwari Golang net/http & HTTP Serve 源码分析
如何从zookeeper切换为clickhouse—keeper
ike · 2023-10-17 · via ike‘s blog

简介#

    clickhouse-keeper和zookeeper的功能类似,都能实现数据复制和分布式DDL查询,但也有不同之处,clickhouse分布式表使用zookeeper作为元数据的存储,客户端每次读写分布式表都会读写zookeeper,zookeeper是个小型的日志文件系统,在大范围读写时会进入只读模式。
    clickhouse官方为了解决这个问题,自己开发了clickhouse-keeper来代替。clickhouse-keeper用C++语言编写,在Clickhouse的21.8版本开始引入,目前22.5版的写性能和zookeeper相当,读的性能比zookeeper好,最新版本已经读写性能都超过zookeeper,更加适配大量数据的Clickhouse集群。

对比#

zookeeper:

  • 使用java开发
  • 运维不便
  • 要求独立部署
  • zxid overflow问题
  • snapshot和log没有经过压缩
  • 不支持读的线性一致性

keeper:

  • 使用c++开发,技术栈与ck统一
  • 即可独立部署,又可集成到ck中
  • 没有zxid overflow问题
  • 读写性能更好
  • 支持对snapshot和log的压缩和校验
  • 支持读写的线性一致性

部署#

因为当前Clickhouse集群是用zookeeper作为数据复制和分布式查询的,切换为Clickhouse-keeper需要保留现有的数据,所以需要进行数据迁移,官方提供了相关的方法:
1、准备 clickhouse-keeper的配置文件 (config.xml)

<keeper_server>
      <tcp_port>9181</tcp_port>
      <server_id>1</server_id>  <!--第一台是1,第二台是2,第三台是3-->
      <log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
      <snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>

    <coordination_settings>
        <operation_timeout_ms>10000</operation_timeout_ms>
        <session_timeout_ms>30000</session_timeout_ms>
        <raft_logs_level>warning</raft_logs_level>
    </coordination_settings>

    <raft_configuration>
        <server>
            <id>1</id>
            <hostname>10.0.0.1</hostname>
            <port>9444</port>
        </server>
        <server>
            <id>2</id>
            <hostname>10.0.0.2</hostname>
            <port>9444</port>
        </server>
        <server>
            <id>3</id>
            <hostname>10.0.0.3</hostname>
            <port>9444</port>
        </server>
    </raft_configuration>
</keeper_server>

2、停止所有zk节点
3、重启zk leader节点,并再次停止(这一步是为了让leader节点生成一份snapshot)
4、运行clickhouse-keeper-converter(安装Clickhouse自带命令),生成keeper的snapshot文件

#示例命令
clickhouse-keeper-converter --zookeeper-logs-dir /var/lib/zookeeper/version-2 --zookeeper-snapshots-dir /var/lib/zookeeper/version-2 --output-dir /var/lib/clickhouse/keeper/snapshots

5、参考第一部修改配置,指定snapshots,启动keeper, 使其加载上一步中的snapshot。具体可以参考官方文档 6、重启clickhouse-server

参考#

官方文档ZH
官方文档EN