📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

配置项作用 #

node.remote_cluster_client 配置项用于控制节点是否允许作为远程集群客户端

当启用时,节点可以连接到其他 Easysearch 集群,执行跨集群搜索(CCS)等操作。当禁用时,节点无法建立到远程集群的连接。

注意:此配置项已被废弃,推荐使用 node.roles 配置来替代。

配置项属性 #

  • 配置路径: node.remote_cluster_client
  • 数据类型: Boolean(布尔值)
  • 默认值: true
  • 是否可选: 是
  • 作用域: NodeScope(节点级别)
  • 动态更新: 否(需要重启节点生效)
  • 废弃状态: 已废弃,使用 node.roles 替代

配置项详解 #

工作机制 #

远程集群客户端工作机制

启用远程集群客户端 (node.remote_cluster_client: true):
├── 可以连接远程集群
├── 执行跨集群搜索
│   ├── cluster1:index1
│   ├── cluster2:index2
│   └── 联合查询
├── 跨集群复制
└── 数据同步


禁用远程集群客户端 (node.remote_cluster_client: false):
├── 无法连接远程集群
├── 跨集群搜索失败
├── 本地集群操作正常
└── 安全隔离 ✅

跨集群搜索架构 #

跨集群搜索 (CCS) 架构

集群 A (本地)                  集群 B (远程)
┌─────────────────┐          ┌─────────────────┐
│   协调节点      │          │   协调节点      │
│  (remote_client)│◄────────►│  (接受连接)     │
└────────┬────────┘          └────────┬────────┘
         │                            │
    ┌────┴────┐                  ┌────┴────┐
    │ 数据节点 │                  │ 数据节点 │
    │ index_a │                  │ index_b │
    └─────────┘                  └─────────┘


搜索请求:
POST /cluster_a:index_a,cluster_b:index_b/_search
{
  "query": {
    "match": { "message": "hello" }
  }
}


执行流程:
1. 协调节点接收请求
2. 解析跨集群语法
3. 连接到集群 B
4. 并行搜索两个集群
5. 合并结果
6. 返回完整结果

角色映射 #

废弃配置与新角色映射

旧配置 (node.remote_cluster_client):
node.remote_cluster_client: true
    │
    ↓
等效于:
node.roles: [ "remote_cluster_client" ]  ✅


完整角色配置示例:
node.roles: [ "master", "data", "remote_cluster_client" ]


仅远程客户端:
node.roles: [ "remote_cluster_client" ]  ✅


禁用远程连接:
在 node.roles 中不包含 remote_cluster_client 角色,例如:
node.roles: [ "data" ]

远程集群配置 #

远程集群连接配置

配置远程集群:
cluster:
  remote:
    cluster_one:
      seeds: ["192.168.1.10:9300"]
    cluster_two:
      seeds: ["192.168.1.20:9300"]


节点要求:
node:
  remote_cluster_client: true


验证连接:
GET /_remote/info


响应:
{
  "cluster_one" : {
    "connected" : true,
    "max_connections_per_node": 10,
    "initial_connect_timeout": "30s"
  },
  "cluster_two" : {
    "connected" : true,
    ...
  }
}

配置建议 #

生产环境(默认) #

node:
  remote_cluster_client: true  # 默认值

建议: 保持默认值 true。支持跨集群功能。

仅本地集群 #

node:
  remote_cluster_client: false  # 禁用远程连接

建议: 不需要跨集群功能时禁用,提高安全性。

协调节点 #

node:
  master: false
  data: false
  remote_cluster_client: true  # 作为跨集群网关

建议: 专门的跨集群协调节点。

推荐配置(使用新角色) #

# 支持远程集群的节点
node.roles: [ "remote_cluster_client" ]

# 仅本地数据节点
node.roles: [ "data" ]

建议: 使用 node.roles 替代废弃的配置。

代码示例 #

easysearch.yml 基础配置 #

node:
  remote_cluster_client: true

完整远程集群配置 #

# 节点配置
node:
  name: "cross-cluster-node"
  remote_cluster_client: true

# 远程集群配置
cluster:
  remote:
    production:
      seeds: ["prod-node1:9300", "prod-node2:9300"]
    dr:
      seeds: ["dr-node1:9300"]

仅本地集群配置 #

node:
  name: "local-only-node"
  remote_cluster_client: false

混合节点配置 #

node:
  master: true
  data: true
  remote_cluster_client: true

推荐使用角色配置 #

# 跨集群协调节点
node.roles: [ "remote_cluster_client" ]

# 数据节点(本地)
node.roles: [ "data" ]

# 全能节点
node.roles: [ "master", "data", "remote_cluster_client" ]

相关配置 #

配置项作用默认值
node.remote_cluster_client远程集群客户端角色true
cluster.remote.*远程集群连接配置-
node.roles节点角色列表(推荐)-

跨集群搜索示例 #

跨集群搜索操作

1. 查看远程集群信息:
GET /_remote/info


2. 跨集群搜索:
POST /cluster_one:logs,cluster_two:logs/_search
{
  "query": {
    "match": { "level": "ERROR" }
  },
  "aggs": {
    "by_cluster": {
      "terms": {
        "field": "_index"
      }
    }
  }
}


3. 跨集群别名:
PUT /logs_all
{
  "aliases": [
    { "index": "cluster_one:logs-*" },
    { "index": "cluster_two:logs-*" }
  ]
}

GET /logs_all/_search
{
  "query": { "match_all": {} }
}


4. 跨集群复制:
PUT /_ccr/info

性能影响分析 #

node.remote_cluster_client 设置优点缺点
true支持跨集群功能连接开销、内存占用
false无远程连接开销无法使用跨集群功能

资源消耗 #

资源消耗分析

启用远程集群客户端:
├── 网络连接
│   ├── 每个远程节点
│   ├── 连接池管理
│   └── 心跳维护
├── 内存使用
│   ├── 连接缓存
│   ├── 查询结果缓存
│   └── 元数据存储
├── CPU 使用
│   ├── 结果合并
│   ├── 网络通信
│   └── 协议处理
└── 延迟增加
    ├── 网络往返
    ├── 查询远程
    └── 结果合并


禁用远程集群客户端:
├── 网络连接: 无 ✅
├── 内存使用: 更少 ✅
├── CPU 使用: 更少 ✅
└── 本地查询更快 ✅


推荐配置:
├── 少数节点启用
├── 专门协调节点
├── 数据节点禁用
└── 按需启用

使用场景 #

推荐启用 remote_cluster_client 的场景 #

  • 跨集群搜索: 需要查询多个集群的数据
  • 数据聚合: 聚合多个集群的搜索结果
  • 数据中心: 多数据中心部署
  • 灾难恢复: 跨集群数据同步
  • 联邦查询: 统一查询多个独立集群

推荐禁用 remote_cluster_client 的场景 #

  • 独立集群: 不需要与其他集群交互
  • 安全隔离: 限制外部连接
  • 数据节点: 专注本地存储和查询
  • 资源受限: 减少连接和内存开销

集群规划建议 #

集群规划建议

小型单集群:
├── 所有节点: remote_cluster_client: true
├── 简化配置
└── 按需使用


大型多集群:
├── 专门的跨集群协调节点
├── node.roles: [ "remote_cluster_client" ]
├── 数据节点禁用
├── 减少连接数
└── 提高效率


安全敏感环境:
├── 严格控制远程连接
├── 仅特定节点启用
├── 网络隔离
└── 访问控制

安全考虑 #

安全配置建议

1. 网络隔离
   ├── 使用 VPN
   ├── 专用网络
   └── 防火墙规则


2. 认证授权
   ├── 启用 TLS/SSL
   ├── 证书验证
   └── 访问控制


3. 限制连接
   ├── 仅必要节点启用
   ├── 限制远程集群数量
   └── 连接数限制


4. 监控审计
   ├── 记录跨集群查询
   ├── 监控连接状态
   └── 异常检测

注意事项 #

  1. 已废弃: 此配置项已被废弃,推荐使用 node.roles

  2. 需要重启: 修改此配置需要重启节点。

  3. 远程配置: 需要配合 cluster.remote.* 配置使用。

  4. 网络连接: 确保网络可达性和防火墙配置。

  5. 资源消耗: 启用会增加连接和内存开销。

  6. 查询语法: 跨集群搜索需要特殊语法 cluster:index

  7. 故障处理: 远程集群故障会影响跨集群查询。

  8. 监控建议: 监控远程连接状态和性能。

  9. 性能影响: 跨集群查询延迟高于本地查询。

  10. 迁移建议: 新配置使用 node.roles

故障排查 #

常见问题排查

问题 1: 无法连接远程集群

检查:
├── node.remote_cluster_client: true
├── cluster.remote 配置正确
├── 网络连通性
└── 远程集群状态


解决:
├── 验证配置
├── 测试网络
├── 检查远程集群健康
└── 查看日志


问题 2: 跨集群搜索慢

原因:
├── 网络延迟
├── 远程集群负载
├── 大量数据传输
└── 查询复杂


解决:
├── 优化查询
├── 增加带宽
├── 使用专门的协调节点
└── 限制结果集大小


问题 3: 连接数过多

原因:
├── 太多节点启用
├── 连接池过大
└── 远程集群过多


解决:
├── 减少启用的节点数
├── 调整连接池大小
└── 减少远程集群数量

废弃说明 #

配置迁移指南

从废弃配置迁移到新配置

跨集群节点:
旧配置:
node.remote_cluster_client: true


新配置 (推荐):
node.roles: [ "remote_cluster_client" ]


仅本地节点:
旧配置:
node.remote_cluster_client: false


新配置 (推荐):
node.roles: [ "data" ]
(不包含 remote_cluster_client 角色)


全能节点:
node.roles: [ "master", "data", "remote_cluster_client" ]


迁移步骤:
1. 备份当前配置
2. 确定所需角色
3. 更新配置文件
4. 滚动重启节点
5. 验证跨集群功能