meilisearch v1.30.0 版本更新介绍
发布日期: 2025-12-15
版本号: v1.30.0
Meilisearch v1.30.0 增强了企业版的网络分片功能,允许动态调整分片节点数量,无需重新创建集群。这一改进引入了破坏性变更,主要影响启用了自动分片的实验性网络功能用户,稳定版用户不受影响。使用新功能需要指定一个领导者节点来接收所有任务,并通过
PATCH /network接口配置网络拓扑。此后,设置、文档等任务仅能发送给领导者,并会自动同步到整个网络。新增或移除节点时,系统会自动重新分配文档。此外,版本更新还包括修复 macOS 编译问题、升级 Rust 版本以及移除 CI 中的命令注入风险,并重新提供了 macOS AMD64 架构的二进制文件。
更新内容 (中文)
🌈 改进
网络上下扩展
自 v1.19.0 起,Meilisearch 企业版 支持在多个 Meilisearch 实例间自动分片文档,从而实现超越单实例容量的扩展。
Meilisearch v1.30.0 新增了修改分片参与节点数量的功能,无需重新开始向包含所需机器数量的新集群发送文档。
为此,Meilisearch v1.30.0 引入了 重大变更。这些变更仅影响启用自动分片(network.sharding = true)的实验性 network 功能用户。稳定功能的用户不受影响。
使用说明
设置初始网络
- 选择一台作为主节点接收所有任务的机器。现在,在非主节点的机器上调用创建文档、设置或网络相关任务的路由会返回错误。
- 通过调用
PATCH /network将网络拓扑发送至主节点:
// PATCH /network
{
"self": "ms0",
"leader": "ms0", // 必须与 `self` 相同
"remotes": {
"ms0": {
"url": "URL_OF_MS0",
"searchApiKey": "SEARCH_API_KEY_OF_MS0",
"writeApiKey": "WRITE_API_KEY_OF_MS0",
},
"ms1": {
"url": "URL_OF_MS1",
"searchApiKey": "SEARCH_API_KEY_OF_MS1",
"writeApiKey": "WRITE_API_KEY_OF_MS1",
}
}
}
- 网络会自动传播到网络中的其他成员。
- 像往常一样发送设置和文档,但仅限发送至主节点。它们会传播到网络中的所有参与者,每个参与者处理部分文档。
从 v1.29 或更早版本升级
- 我们建议使用实验性的无转储升级功能从 Meilisearch v1.13+ 升级到 Meilisearch v1.29。
- 使用实验性无转储升级时,如果 Meilisearch 实例已有
sharding设置为true的network实例,则会修改network对象,使主节点为字母顺序排列的第一个远程节点。例如,如果您的网络包含远程节点:A、B、C,则主节点将设置为A。
添加新远程节点
- 在主节点上调用
PATCH /network,提供新远程节点的信息:
{
"remotes": {
// 添加关于新远程节点的信息
"ms2": {
"url": "URL_OF_MS2",
"searchApiKey": "SEARCH_API_KEY_OF_MS2",
"writeApiKey": "WRITE_API_KEY_OF_MS2",
}
// 无需重复关于现有远程节点的信息
}
- 新的网络将从主节点传播到所有远程节点(包括新远程节点
ms2)。 - 所有远程节点将注册一个新的
networkTopologyChange任务,该任务将在现有远程节点与新远程节点之间“重新平衡”文档,即ms0和ms1会将部分文档发送给ms2。
移除远程节点
- 在主节点上调用
PATCH /network,将任何被移除的远程节点设置为null:
{
"remotes": {
// 将被移除的远程节点设置为 null
"ms2": null
// 无需重复关于现有远程节点的信息
}
- 新的网络将从主节点传播到所有远程节点(包括旧的远程节点
ms2,它随后将不再参与网络)。 - 所有远程节点将注册一个新的
networkTopologyChange任务,该任务将在剩余的远程节点之间“重新平衡”文档,即ms2将其文档发送给ms0和ms1。
变更列表
变更列表,部分为重大变更
- 重大变更:
/network路由返回或编辑的Network对象进行如下修改:- 移除了
sharding布尔字段。 - 新增
leader字段,为可选字符串。当其不为null时,具有与先前Network对象中sharding: true相同(且更多)的效果。主节点用于接收任务创建请求时的验证。 - 新增
version字段,为 UUID,默认为 null UUID。该版本在处理任务时使用。
- 移除了
- 重大变更:当设置了
network.leader时,如果目标节点的network.self与其network.leader不同,调用以下路由将返回not_a_leader错误:POST /indexesPATCH/DELETE /indexes/{:indexUid}POST/PUT/DELETE /indexes/{:indexUid}/documentsPOST /indexes/{:indexUid}/documents/deletePOST /indexes/{:indexUid}/documents/delete-batchPOST /indexes/{:indexUid}/documents/editPATCH/DELETE /indexes/{:indexUid}/settings及设置子路由PATCH /network(如果目标是新主节点)POST /swap-indexes
- 重大变更:设置了
leader时,PATCH /network不再返回Network对象。而是生成一个新的networkTopologyChange任务,并返回摘要任务视图。 - 重大变更:调用以下路由时,主节点会将任务复制到整个网络:
POST /indexes(本 PR 新增)PATCH/DELETE /indexes/{:indexUid}(本 PR 新增)POST/PUT/DELETE /indexes/{:indexUid}/documents(本 PR 之前已如此)POST /indexes/{:indexUid}/documents/delete(本 PR 之前已如此)POST /indexes/{:indexUid}/documents/delete-batch(本 PR 之前已如此)POST /indexes/{:indexUid}/documents/edit(本 PR 之前已如此)PATCH/DELETE /indexes/{:indexUid}/settings及设置子路由(本 PR 新增)PATCH /network(如果目标是新主节点,本 PR 新增)POST /swap-indexes(本 PR 新增)
- 新的
networkTopologyChange任务执行以下操作:- 执行所有剩余需要处理且
network.version低于网络任务版本的任务。 - 遍历所有索引中的所有文档,确定其新分片,并将文档发送到在新版本中必须持有该文档的远程节点,并从本地数据库中删除该文档
- 导出路由代码已重构并特化以支持此功能
- 如果导出到远程节点失败,相应的文档将保留在本地
- 如果某个索引没有文档需要发送,仍会使用空负载和包含预期元数据的适当头调用文档添加接口
- 如果整个远程节点没有文档需要发送,会调用
network路由,并包含预期元数据的特定头
- 等待并处理来自旧版本网络远程节点的任务。
- 执行所有剩余需要处理且
- 重大变更:导入转储文件时,我们会丢弃网络中的
self和leader。 - 网络拓扑变更任务可以取消。在这种情况下,状态将是当前状态(任何已移动的文档将保持移动后的状态)。取消操作需要在所有机器上进行。
由 @dureuill 在 https://github.com/meilisearch/meilisearch/pull/6000 中贡献
🛠️ 维护
- 修复 macOS AMD64 编译问题,由 @dureuill 在 https://github.com/meilisearch/meilisearch/pull/6037 中贡献
- 升级至 Rust v1.91.1,由 @Kerollmops 在 https://github.com/meilisearch/meilisearch/pull/6039 中贡献
- 移除 CI 中的命令注入风险,由 @curquiza 在 https://github.com/meilisearch/meilisearch/pull/6041 中贡献
资源可用性说明
🌈 Meilisearch 二进制文件再次可用于 meilisearch-enterprise-macos-amd64 和 meilisearch-macos-amd64。在 Meilisearch v1.29 中不可用。
完整变更日志: https://github.com/meilisearch/meilisearch/compare/v1.29.0...v1.30.0
更新内容 (原始)
🌈 Improvements
Up and down network scaling
Since v1.19.0, Meilisearch Enterprise Edition allows the automatic sharding of documents over multiple Meilisearch instances, enabling scaling to more documents than a single instance would accommodate.
Meilisearch v1.30.0 adds the ability to modify the number of participants in sharding, without having to start over sending documents to a new cluster containing the number of desired machines.
To make this possible, Meilisearch v1.30.0 introduces breaking changes. These breaking changes only affect the users of the experimental network feature who enabled automatic sharding (network.sharding = true). Users of the stable features are not affected.
Usage
Setting up the initial network
- Pick a leader machine that will receive all tasks. Calling a route that creates a dcument, settings or network-related task on a machine that is not the leader will now return an error.
- Send your network topology to the leader by calling
PATCH /network:
// PATCH /network
{
"self": "ms0",
"leader": "ms0", // must be equal to `self`
"remotes": {
"ms0": {
"url": "URL_OF_MS0",
"searchApiKey": "SEARCH_API_KEY_OF_MS0",
"writeApiKey": "WRITE_API_KEY_OF_MS0",
},
"ms1": {
"url": "URL_OF_MS1",
"searchApiKey": "SEARCH_API_KEY_OF_MS1",
"writeApiKey": "WRITE_API_KEY_OF_MS1",
}
}
}
- The network is automatically propagated to other members of the network.
- Send settings and documents as usual, but exclusively to the leader. They will be propagated to all participants in the network, and each participant will process a piece of the documents.
Upgrading from v1.29 or earlier
- We recommend using the experimental dumpless upgrade feature to go from Meilisearch v1.13+ to Meilisearch v1.29.
- When using the experimental dumpless upgrade and the Meilisearch instance already has a
networkinstance withshardingset totrue, then thenetworkobject will be modified so that the leader is the first remote in alphabetic order. For instance, if you network contains remotes:A,B,C, the leader will be set toA.
Adding a new remote
- Call
PATCH /networkon the leader with the information about the new remote:
{
"remotes": {
// add information about the new remote
"ms2": {
"url": "URL_OF_MS2",
"searchApiKey": "SEARCH_API_KEY_OF_MS2",
"writeApiKey": "WRITE_API_KEY_OF_MS2",
}
// information about existing remotes does not need to be repeated
}
- The new network will be propagated from the leader to all remotes (including the new remote
ms2). - All remotes will register a new
networkTopologyChangetask that will “rebalance” the documents between the existing remotes and the new remote, that is,ms0andms1will send parts of their documents toms2
Removing a remote
- Call
PATCH /networkon the leader by setting any removed remote tonull:
{
"remotes": {
// set removed remote to null
"ms2": null
// information about existing remotes does not need to be repeated
}
- The new network will be propagated from the leader to all remotes (including to the old remote
ms2that will then no longer participate in the network). - All remotes will register a new
networkTopologyChangetask that will “rebalance” the documents between the remaining remotes, that is,ms2will send its documents betweenms0andms1
List of changes
List of changes, some of which are breaking
- Breaking change: The
Networkobject returned or edited by the/networkroute is modified in the following way:- the
shardingboolean is removed - a
leaderfield is added as an optional string. When it is notnull, it has the same effect (and more) than havingsharding: truein the previous iteration of theNetworkobject. The leader is used as a check when receiving task creation requests. - a
versionfield is added as a UUID, defaulting to the null UUID. The version is used when processing tasks.
- the
- Breaking change: When a
network.leaderis set, calling one of the following routes will fail withnot_a_leadererror if the target’snetwork.selfis not the same as itsnetwork.leader:POST /indexesPATCH/DELETE /indexes/{:indexUid}POST/PUT/DELETE /indexes/{:indexUid}/documentsPOST /indexes/{:indexUid}/documents/deletePOST /indexes/{:indexUid}/documents/delete-batchPOST /indexes/{:indexUid}/documents/editPATCH/DELETE /indexes/{:indexUid}/settingsand settings sub-routesPATCH /networkif the target is the new leaderPOST /swap-indexes
- Breaking change: when a
leaderis set,PATCH /networkno longer returns aNetworkobject. Rather, it spawns a newNetworkTopologyChangetask, and returns the summarized task view. - Breaking change: Tasks are duplicated by the leader to the entire network when calling the following routes:
POST /indexes(new to this PR)PATCH/DELETE /indexes/{:indexUid}(new to this PR)POST/PUT/DELETE /indexes/{:indexUid}/documents(was already the case before this PR)POST /indexes/{:indexUid}/documents/delete(was already the case before this PR)POST /indexes/{:indexUid}/documents/delete-batch(was already the case before this PR)POST /indexes/{:indexUid}/documents/edit(was already the case before this PR)PATCH/DELETE /indexes/{:indexUid}/settingsand settings sub-routes (new to this PR)PATCH /networkif the target is the new leader (new to this PR)POST /swap-indexes(new to this PR)
- New
NetworkTopologyChangetasks that perform the following:- Execute any remaining task to process with a
network.versionlower than the network task’s version - Iterate over all documents in all indexes, determine their new shard, and send the document to the remote that must now have it in the new version , deleting it from the local DB
- The export route code has been factored and specialized to allow this
- Should the export to a remote fail, the corresponding documents are kept locally
- If there are no documents to send for an index, still call the documents addition with an empty payload and appropriate headers containing the expected metadata
- If there are no documents to send for an entire remote, call the
networkroute with specific headers containing the expected metadata
- Wait for and process tasks from the remotes of the previous version of the network.
- Execute any remaining task to process with a
- Breaking change: When importing dumps, we drop the
selfandleaderfrom the network - Network topology change tasks can be cancelled. In this case the state will be the current one (any moved documents will stay that way). Cancellation needs to happen on all machines.
by @dureuill in https://github.com/meilisearch/meilisearch/pull/6000
🛠️ Maintenance
- Fix macos-amd64 compilation by @dureuill in https://github.com/meilisearch/meilisearch/pull/6037
- Move to Rust v1.91.1 by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6039
- Remove risk of command injection in CI by @curquiza in https://github.com/meilisearch/meilisearch/pull/6041
Asset availability note
🌈 The Meilisearch binary is available again for meilisearch-enterprise-macos-amd64 and meilisearch-macos-amd64. It was not available for Meilisearch v1.29.
Full Changelog: https://github.com/meilisearch/meilisearch/compare/v1.29.0...v1.30.0
下载链接
- meilisearch-enterprise-linux-aarch64
- meilisearch-enterprise-linux-amd64
- meilisearch-enterprise-macos-amd64
- meilisearch-enterprise-macos-apple-silicon
- meilisearch-enterprise-windows-amd64.exe
- meilisearch-linux-aarch64
- meilisearch-linux-amd64
- meilisearch-macos-amd64
- meilisearch-macos-apple-silicon
- meilisearch-openapi.json
- meilisearch-windows-amd64.exe
- meilisearch.deb