当前位置: 首页 > news >正文

clickhouse集群搭建

Clickhouse集群搭建

文章目录

  • Clickhouse集群搭建
    • 安装包下载
    • clickhouse单机安装
      • 默认安装
        • 默认数据库目录
        • 更改默认数据目录
    • 2分片-1副本-3节点集群搭建
      • 1. 配置hosts
      • 2. 修改每个主机的主机名
      • 3. 配置文件上传
        • 配置文件分布
        • chnode1配置文件
        • chnode2配置文件
        • chnode3配置文件
      • 4. 重启clickhouse-server
      • 5. 集群搭建测试
    • Reference List

安装包下载

可以通过deb/rpm、tgz方式安装,但是离线安装选择tgz方式比较方便。本篇介绍
如何离线安装。

tgz下载:https://packages.clickhouse.com/tgz/lts

clickhouse单机安装

搭建集群需要在每台主机上进行单机安装,将tgz和install.sh上传到服务器,执行:

bash install.sh
  • install.sh
#!/bin/bashexport LATEST_VERSION=22.3.19.6
export ARCH=arm64tar -xzvf "clickhouse-common-static-$LATEST_VERSION-${ARCH}.tgz" \|| tar -xzvf "clickhouse-common-static-$LATEST_VERSION.tgz"
sudo "clickhouse-common-static-$LATEST_VERSION/install/doinst.sh"tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION-${ARCH}.tgz" \|| tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION.tgz"
sudo "clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh"tar -xzvf "clickhouse-server-$LATEST_VERSION-${ARCH}.tgz" \|| tar -xzvf "clickhouse-server-$LATEST_VERSION.tgz"
sudo "clickhouse-server-$LATEST_VERSION/install/doinst.sh" configure
sudo /etc/init.d/clickhouse-server starttar -xzvf "clickhouse-client-$LATEST_VERSION-${ARCH}.tgz" \|| tar -xzvf "clickhouse-client-$LATEST_VERSION.tgz"
sudo "clickhouse-client-$LATEST_VERSION/install/doinst.sh"

默认安装

默认数据库目录
  • 默认数据目录路径: 默认数据目录处于/var/lib/clickhouse
  • 数据目录初始化:删除此目录,重新启动clickhouse systemctl restart clickhouse-server可以重新将数据目录初始化。
更改默认数据目录

要更改默认数据目录更改,修改/etc/clickhouse-server/config.xml

    <!-- Path to data directory, with trailing slash. --><path>/var/lib/clickhouse/</path>

配置文件是只读的,所以要修改数据目录,

  1. 需要修改其权限
chmod 755 /etc/clickhouse-server/config.xml
  1. 将全部/var/lib/clickhouse/修改为其他数据目录
  2. 删除默认数据库目录下所有文件。
  3. 重启clickhouse-server,对数据目录进行重新初始化。

2分片-1副本-3节点集群搭建

clickhouse的集群每个分片的每个副本只能放到单独的实例上,比如2分片-2副本需要4台机器,3分片-2副本需要6台机器。

集群的拓扑:

节点角色描述
chnode1Data + ClickHouse Keeper数据节点 + 协调器
chnode2Data + ClickHouse Keeper数据节点 + 协调器
chnode3ClickHouse Keeper协调器

分片及副本分布:

节点角色
chnode1分片1、副本1
chnode2分片2、副本1
chnode3无分片、无副本

1. 配置hosts

对于每个主机,将如下内容追加到/etc/hosts

10.55.134.82 chnode1     
10.55.134.93 chnode2
10.55.134.99 chnode3

2. 修改每个主机的主机名

hostnamectl set-hostname chnode1

3. 配置文件上传

配置文件分布

/etc/clickhouse-server/config.d/目录中的配置会覆盖默认配置,所以官网建议:

  • 服务器配置添加到/etc/clickhouse-server/config.d/
  • 用户配置添加到/etc/clickhouse-server/users.d/
  • 不要更改/etc/clickhouse-server/config.xml
  • 不要更改/etc/clickhouse-server/users.xml

我们先来看看每个主机上的配置文件:

  • chnode1
[root@chnode1 clickhouse]# ll /etc/clickhouse-server/config.d/
total 24
-rw-r--r-- 1 root       root       985 Feb 13 15:41 enable-keeper.xml
-rw-r--r-- 1 clickhouse clickhouse  66 Feb 13 16:19 listen.xml
-rw-r--r-- 1 root       root       104 Feb 13 15:41 macros.xml
-rw-r--r-- 1 root       root       574 Feb 13 16:52 network-and-logging.xml
-rw-r--r-- 1 root       root       599 Feb 13 15:41 remote-servers.xml
-rw-r--r-- 1 root       root       386 Feb 13 15:41 use-keeper.xml
  • chnode2
[root@chnode2 clickhouse]# ll /etc/clickhouse-server/config.d/
total 24
-rw-r--r-- 1 root       root       985 Feb 13 15:41 enable-keeper.xml
-rw-r--r-- 1 clickhouse clickhouse  66 Feb 13 16:19 listen.xml
-rw-r--r-- 1 root       root       104 Feb 13 15:41 macros.xml
-rw-r--r-- 1 root       root       574 Feb 13 16:52 network-and-logging.xml
-rw-r--r-- 1 root       root       599 Feb 13 15:41 remote-servers.xml
-rw-r--r-- 1 root       root       386 Feb 13 15:41 use-keeper.xml
  • chnode3
[root@chnode3 clickhouse]# ll /etc/clickhouse-server/config.d/
total 12
-rw-r--r-- 1 clickhouse clickhouse 985 Feb 13 15:45 enable-keeper.xml
-rw-r--r-- 1 clickhouse clickhouse  61 Feb 13 16:06 listen.xml
-rw-r--r-- 1 clickhouse clickhouse 566 Feb 13 15:45 network-and-logging.xml
chnode1配置文件
  • network-and-logging.xml

    • 日志在1000M大小时滚动一次,保留3000M的日志。
    • clickhouse监听8123和9000端口
    • 服务器间通信使用端口9009
<clickhouse><logger><level>debug</level><log>/var/log/clickhouse-server/clickhouse-server.log</log><errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog><size>1000M</size><count>3</count></logger><display_name>clickhouse</display_name><listen_host>0.0.0.0</listen_host><http_port>8123</http_port><tcp_port>9000</tcp_port><interserver_http_port>9009</interserver_http_port>
</clickhouse>
  • enable-keeper.xml
    • chnode节点的server_id设置为1,其他节点id要不同。
    • 其他配置和chnode2一样
<clickhouse><keeper_server><tcp_port>9181</tcp_port><server_id>1</server_id><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>trace</raft_logs_level></coordination_settings><raft_configuration><server><id>1</id><hostname>chnode1</hostname><port>9234</port></server><server><id>2</id><hostname>chnode2</hostname><port>9234</port></server><server><id>3</id><hostname>chnode3</hostname><port>9234</port></server></raft_configuration></keeper_server>
</clickhouse>
  • macros.xml
    • shard值为1,指定了本节点存储分片1,副本1,chnode2里shard的值将变为2
    • 这种指定方式可以减少DDL语句复杂度,不用在建表时候再去指定分片分配到哪个节点。
<clickhouse><macros><shard>1</shard><replica>replica_1</replica></macros>
</clickhouse>
  • remote-servers.xml
    • remote-servers部分指定了所有集群,replace="true"表示覆盖默认配置里配置的集群。
    • 指定了一个集群名为cluster_2S_1R
    • 集群使用secret进行加密通信
    • cluster_2S_1R集群有两个分片,每个分片有一个副本。
    • internal_replication设置为true表示写入操作时会选择第一个发现的健康副本去写入。

chnode1和chnode2的remote-servers.xml配置相同。

<clickhouse><remote_servers replace="true"><cluster_2S_1R><secret>mysecretphrase</secret><shard><internal_replication>true</internal_replication><replica><host>chnode1</host><port>9000</port></replica></shard><shard><internal_replication>true</internal_replication><replica><host>chnode2</host><port>9000</port></replica></shard></cluster_2S_1R></remote_servers>
</clickhouse>
  • use-keeper.xml
    • 指定3个节点的zookeeper端口为9181
<clickhouse><zookeeper><node index="1"><host>chnode1</host><port>9181</port></node><node index="2"><host>chnode2</host><port>9181</port></node><node index="3"><host>chnode3</host><port>9181</port></node></zookeeper>
</clickhouse>
chnode2配置文件
  • network-and-logging.xml

和chnode1配置相同

<clickhouse><logger><level>debug</level><log>/var/log/clickhouse-server/clickhouse-server.log</log><errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog><size>1000M</size><count>3</count></logger><display_name>clickhouse</display_name><listen_host>0.0.0.0</listen_host><http_port>8123</http_port><tcp_port>9000</tcp_port><interserver_http_port>9009</interserver_http_port>
</clickhouse>
  • enable-keeper.xml
    • chnode2节点的server_id设置为2,其他相同
<clickhouse><keeper_server><tcp_port>9181</tcp_port><server_id>2</server_id><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>trace</raft_logs_level></coordination_settings><raft_configuration><server><id>1</id><hostname>chnode1</hostname><port>9234</port></server><server><id>2</id><hostname>chnode2</hostname><port>9234</port></server><server><id>3</id><hostname>chnode3</hostname><port>9234</port></server></raft_configuration></keeper_server>
</clickhouse>
  • macros.xml
    • shard值为2,指定了本节点存储分片2,副本1
<clickhouse><macros><shard>2</shard><replica>replica_1</replica></macros>
</clickhouse>
  • remote-servers.xml

chnode1和chnode2的remote-servers.xml配置相同。

<clickhouse><remote_servers replace="true"><cluster_2S_1R><secret>mysecretphrase</secret><shard><internal_replication>true</internal_replication><replica><host>chnode1</host><port>9000</port></replica></shard><shard><internal_replication>true</internal_replication><replica><host>chnode2</host><port>9000</port></replica></shard></cluster_2S_1R></remote_servers>
</clickhouse>
  • use-keeper.xml

和chnode1配置相同

<clickhouse><zookeeper><node index="1"><host>chnode1</host><port>9181</port></node><node index="2"><host>chnode2</host><port>9181</port></node><node index="3"><host>chnode3</host><port>9181</port></node></zookeeper>
</clickhouse>
chnode3配置文件
  • network-and-logging.xml

和chnode1配置相同

<clickhouse><logger><level>debug</level><log>/var/log/clickhouse-server/clickhouse-server.log</log><errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog><size>1000M</size><count>3</count></logger><display_name>clickhouse</display_name><listen_host>0.0.0.0</listen_host><http_port>8123</http_port><tcp_port>9000</tcp_port><interserver_http_port>9009</interserver_http_port>
</clickhouse>
  • enable-keeper.xml
    • chnode3节点的server_id设置为3,其他相同
<clickhouse><keeper_server><tcp_port>9181</tcp_port><server_id>3</server_id><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>trace</raft_logs_level></coordination_settings><raft_configuration><server><id>1</id><hostname>chnode1</hostname><port>9234</port></server><server><id>2</id><hostname>chnode2</hostname><port>9234</port></server><server><id>3</id><hostname>chnode3</hostname><port>9234</port></server></raft_configuration></keeper_server>
</clickhouse>

4. 重启clickhouse-server

三台服务器全部执行:

systemctl restart clickhouse-server

5. 集群搭建测试

下面来创建样例分布表,测试下效果:

  1. 连接chnode1,执行SHOW CLUSTERS
[root@chnode1 clickhouse]# clickhouse-client --password -h 127.0.0.1
ClickHouse client version 22.3.19.6 (official build).
Password for user (default): 
Connecting to 127.0.0.1:9000 as user default.
Connected to ClickHouse server version 22.3.19 revision 54455.clickhouse :) SHOW CLUSTERSSHOW CLUSTERSQuery id: 0ff16c63-3c1e-438d-8fad-1e8e25c42235┌─cluster───────┐
│ cluster_2S_1R │
└───────────────┘
  1. 创建数据库
CREATE DATABASE db1 ON CLUSTER cluster_2S_1R
  1. 创建一个分布表
CREATE TABLE db1.table1_dist ON CLUSTER cluster_2S_1R
(`id` UInt64,`column1` String
)
ENGINE = Distributed('cluster_2S_1R', 'db1', 'table1', rand())
  1. 分别clickhouse-client连接chnode1和chnode2.

chnode1插入:

INSERT INTO db1.table1 (id, column1) VALUES (1, 'abc');

chnode2插入:

INSERT INTO db1.table1 (id, column1) VALUES (2, 'def');
  1. 查询数据
clickhouse :) SELECT * FROM db1.table1_dist;SELECT *
FROM db1.table1_distQuery id: 8ce26016-f923-472e-894d-a7a3025a8927┌─id─┬─column1─┐
│  1 │ abc     │
└────┴─────────┘
┌─id─┬─column1─┐
│  1 │ abc     │
└────┴─────────┘

Reference List

  1. https://clickhouse.com/docs/en/architecture/horizontal-scaling

相关文章:

clickhouse集群搭建

Clickhouse集群搭建 文章目录 Clickhouse集群搭建安装包下载clickhouse单机安装默认安装默认数据库目录更改默认数据目录 2分片-1副本-3节点集群搭建1. 配置hosts2. 修改每个主机的主机名3. 配置文件上传配置文件分布chnode1配置文件chnode2配置文件chnode3配置文件 4. 重启cli…...

250214-java类集框架

单列集合是list和set&#xff0c;list的实现类有ArrayList和LinkedList&#xff0c;前者是数组实现&#xff0c;后者是链表实现。list和set&#xff0c;前者有序、可重复&#xff0c;后者无序不可重复。 1.单列集合 1.1. list java.util.List接口继承自Collection接口&#…...

二叉树(C语言版)

文章目录 二叉树完全二叉树和满二叉树二叉搜索树基本操作实现代码运行结果 分析红黑树2-3-4树(理论模型)红黑树(实际实现) 二叉树 树是一种层次结构&#xff0c;它在现实生活中是广泛存在的&#xff0c;比如&#xff1a;族谱(family tree)&#xff0c;组织机构&#xff0c;目录…...

ASP.NET Core 面试宝典【刷题系列】

文章目录 引言1、什么是 dot net core 的 startup class?2、什么是中间件?3、application builder 的 use 和 run 方法有什么区别?4、dot net core 管道里面的map拓展有什么作用?5、dot net core 里面的路径是如何处理的?6、如何在 dot net core 中激活 session 功能?7、…...

案例-02.部门管理-查询

一.查询部门-需求 二.查询部门-思路 API接口文档 三.代码实现 1.controller层&#xff1a;负责与前端进行交互&#xff0c;接收前端所发来的请求 注&#xff1a;Slf4j用于记录日志使用&#xff0c;可以省略private static Logger log LoggerFactory.getLogger(DeptControlle…...

src和href区别

src和href区别 (1)请求资源类型不同(2)作用结果不同(3)解析方式不同 (1)请求资源类型不同 href 用来建立文档和元素之间的链接(是引用),常用的有a、linksrc 在请求src资源时候会将指向的资源下载并且应用到文档中(引入),常用的有script、iframe、image。 (2)作用结果不同 hr…...

Java每日精进·45天挑战·Day19

第一部分&#xff1a;移除数字以形成最小数的贪心算法实现 在编程的世界里&#xff0c;我们经常遇到需要对字符串表示的数字进行操作的问题。今天&#xff0c;我们要深入探讨一个具体的挑战&#xff1a;给定一个以字符串形式表示的非负整数 num 和一个整数 k&#xff0c;我们的…...

区块链的交易管理和共识机制

区块链的交易管理和共识机制是其核心功能&#xff0c;以下为你详细介绍它们的实现方式&#xff1a; 交易管理的实现 交易发起 • 用户使用钱包软件创建一笔交易&#xff0c;该交易包含发送方地址、接收方地址、转账金额等关键信息。同时&#xff0c;发送方会使用自己的私钥对…...

最新国内 ChatGPT Plus/Pro 获取教程

最后更新版本&#xff1a;20250202 教程介绍&#xff1a; 本文将详细介绍如何快速获取一张虚拟信用卡&#xff0c;并通过该卡来获取ChatGPT Plus和ChatGPT Pro。 # 教程全程约15分钟开通ChatGPT Plus会员帐号前准备工作 一个尚未升级的ChatGPT帐号&#xff01;一张虚拟信用卡…...

Apollo 9.0 速度动态规划决策算法 – path time heuristic optimizer

文章目录 1. 动态规划2. 采样3. 代价函数3.1 障碍物代价3.2 距离终点代价3.3 速度代价3.4 加速度代价3.5 jerk代价 4. 回溯 这一章将来讲解速度决策算法&#xff0c;也就是SPEED_HEURISTIC_OPTIMIZER task里面的内容。Apollo 9.0使用动态规划算法进行速度决策&#xff0c;从类名…...

Apache Iceberg 与 Apache Hudi:数据湖领域的双雄对决

在数据存储和处理不断发展的领域中&#xff0c;数据湖仓的概念已经崭露头角&#xff0c;成为了一种变革性的力量。数据湖仓结合了数据仓库和数据湖的最佳元素&#xff0c;提供了一个统一的平台&#xff0c;支持数据科学、商业智能、人工智能/机器学习以及临时报告等多种关键功能…...

【LeetCode Hot100 普通数组】最大子数组和、合并区间、旋转数组、除自身以外数组的乘积、缺失的第一个正整数

普通数组 1. 最大子数组和&#xff08;Maximum Subarray&#xff09;解题思路动态规划的优化解法&#xff08;Kadane 算法&#xff09;核心思想 代码解析 2. 合并区间&#xff08;Merge Intervals&#xff09;解题思路代码实现 3. 旋转数组&#xff08;Rotate Array&#xff09…...

共享存储-一步一步部署ceph分布式文件系统

一、Ceph 简介 Ceph 是一个开源的分布式文件系统。因为它还支持块存储、对象存储&#xff0c;所以很自 然的被用做云计算框架 openstack 或 cloudstack 整个存储后端。当然也可以单独作 为存储&#xff0c;例如部署一套集群作为对象存储、SAN 存储、NAS 存储等。 二、ceph 支…...

19.Python实战:实现对博客文章的点赞系统

Flask博客点赞系统 一个基于Flask的简单博客系统&#xff0c;具有文章展示和点赞功能。系统使用MySQL存储数据&#xff0c;支持文章展示、点赞/取消点赞等功能。 功能特点 文章列表展示文章详情查看&#xff08;模态框展示&#xff09;点赞/取消点赞功能&#xff08;每个IP只…...

【stm32】定时器输出PWM波形(hal库)

一. PWM基本原理 PWM是一种通过调节信号的占空比&#xff08;Duty Cycle&#xff09;来控制输出平均电压的技术。占空比是指高电平时间与整个周期时间的比值。例如&#xff1a; - 占空比为50%时&#xff0c;输出平均电压为电源电压的一半。 - 占空比为100%时&#xff0c;输出始…...

当Ollama遇上划词翻译:我的Windows本地AI服务搭建日记

&#x1f680; 实现Windows本地大模型翻译服务 - 基于OllamaFlask的划词翻译实践 &#x1f6e0;️ 步骤概要1️⃣ python 环境准备2️⃣ Ollama 安装3️⃣ 一个 Flask 服务4️⃣ Windows 服务化封装5️⃣ 测试本地接口6️⃣ 配置划词翻译自定义翻译源7️⃣ 效果展示8️⃣ debug…...

Linux上Elasticsearch 集群部署指南

Es 集群部署 Es 集群部署 Es 集群部署 准备好三台服务器。示例使用&#xff1a;110.0.5.141/142/143 1、es用户和用户组创建&#xff0c;使用root账号 groupadd esuseradd -g es es2、将es安装包和ik分词器上传到&#xff1a;/home/es/目录下&#xff08;任意目录都行&#…...

字节Trae使用感想(后端)

前言 昨天分享了字节哥的Trae从0到1创作模式构建一个vue前端项目&#xff0c;今天又来试试她的后端项目能力。不是我舔&#xff0c;不得不说确实不错。可惜现在曾经没有好好学习&#xff0c;进不了字节。既然进不了字节&#xff0c;那我就用字节哥的产品吧。 后面有惊喜…...

国产编辑器EverEdit - 二进制模式下观察Window/Linux/MacOs换行符差异

1 换行符格式 1.1 应用场景 稍微了解计算机历史的人都知道&#xff0c; 计算机3大操作系统&#xff1a; Windows、Linux/Unix、MacOS&#xff0c;这3大系统对文本换行的定义各不相同&#xff0c;且互不相让&#xff0c;导致在文件的兼容性方面存在一些问题&#xff0c;比如它们…...

文心一言4月起全面免费,6月底开源新模型:AI竞争进入新阶段?

名人说&#xff1a;莫听穿林打叶声&#xff0c;何妨吟啸且徐行。—— 苏轼 Code_流苏(CSDN)&#xff08;一个喜欢古诗词和编程的Coder&#x1f60a;&#xff09; 目录 一、文心一言免费化的背后&#xff1a;AI成本与应用的双重驱动1️⃣成本下降&#xff0c;推动文心一言普及2…...

调用支付宝接口响应40004 SYSTEM_ERROR问题排查

在对接支付宝API的时候&#xff0c;遇到了一些问题&#xff0c;记录一下排查过程。 Body:{"datadigital_fincloud_generalsaas_face_certify_initialize_response":{"msg":"Business Failed","code":"40004","sub_msg…...

电脑插入多块移动硬盘后经常出现卡顿和蓝屏

当电脑在插入多块移动硬盘后频繁出现卡顿和蓝屏问题时&#xff0c;可能涉及硬件资源冲突、驱动兼容性、供电不足或系统设置等多方面原因。以下是逐步排查和解决方案&#xff1a; 1. 检查电源供电问题 问题原因&#xff1a;多块移动硬盘同时运行可能导致USB接口供电不足&#x…...

Python实现prophet 理论及参数优化

文章目录 Prophet理论及模型参数介绍Python代码完整实现prophet 添加外部数据进行模型优化 之前初步学习prophet的时候&#xff0c;写过一篇简单实现&#xff0c;后期随着对该模型的深入研究&#xff0c;本次记录涉及到prophet 的公式以及参数调优&#xff0c;从公式可以更直观…...

关键领域软件测试的突围之路:如何破解安全与效率的平衡难题

在数字化浪潮席卷全球的今天&#xff0c;软件系统已成为国家关键领域的核心战斗力。不同于普通商业软件&#xff0c;这些承载着国家安全使命的软件系统面临着前所未有的质量挑战——如何在确保绝对安全的前提下&#xff0c;实现高效测试与快速迭代&#xff1f;这一命题正考验着…...

Java 二维码

Java 二维码 **技术&#xff1a;**谷歌 ZXing 实现 首先添加依赖 <!-- 二维码依赖 --><dependency><groupId>com.google.zxing</groupId><artifactId>core</artifactId><version>3.5.1</version></dependency><de…...

Selenium常用函数介绍

目录 一&#xff0c;元素定位 1.1 cssSeector 1.2 xpath 二&#xff0c;操作测试对象 三&#xff0c;窗口 3.1 案例 3.2 窗口切换 3.3 窗口大小 3.4 屏幕截图 3.5 关闭窗口 四&#xff0c;弹窗 五&#xff0c;等待 六&#xff0c;导航 七&#xff0c;文件上传 …...

BLEU评分:机器翻译质量评估的黄金标准

BLEU评分&#xff1a;机器翻译质量评估的黄金标准 1. 引言 在自然语言处理(NLP)领域&#xff0c;衡量一个机器翻译模型的性能至关重要。BLEU (Bilingual Evaluation Understudy) 作为一种自动化评估指标&#xff0c;自2002年由IBM的Kishore Papineni等人提出以来&#xff0c;…...

Scrapy-Redis分布式爬虫架构的可扩展性与容错性增强:基于微服务与容器化的解决方案

在大数据时代&#xff0c;海量数据的采集与处理成为企业和研究机构获取信息的关键环节。Scrapy-Redis作为一种经典的分布式爬虫架构&#xff0c;在处理大规模数据抓取任务时展现出强大的能力。然而&#xff0c;随着业务规模的不断扩大和数据抓取需求的日益复杂&#xff0c;传统…...

Java 与 MySQL 性能优化:MySQL 慢 SQL 诊断与分析方法详解

文章目录 一、开启慢查询日志&#xff0c;定位耗时SQL1.1 查看慢查询日志是否开启1.2 临时开启慢查询日志1.3 永久开启慢查询日志1.4 分析慢查询日志 二、使用EXPLAIN分析SQL执行计划2.1 EXPLAIN的基本使用2.2 EXPLAIN分析案例2.3 根据EXPLAIN结果优化SQL 三、使用SHOW PROFILE…...

网页端 js 读取发票里的二维码信息(图片和PDF格式)

起因 为了实现在报销流程中&#xff0c;发票不能重用的限制&#xff0c;发票上传后&#xff0c;希望能读出发票号&#xff0c;并记录发票号已用&#xff0c;下次不再可用于报销。 基于上面的需求&#xff0c;研究了OCR 的方式和读PDF的方式&#xff0c;实际是可行的&#xff…...