Elasticsearch 的配置文件通常位于 elasticsearch.yml,以下是常见配置项的说明:

基础配置结构

# 配置文件头部
cluster.name: my_cluster
node.name: node_01
network.host: 0.0.0.0
http.port: 9200
elasticsearch_config

常见配置示例

  1. 集群配置

    • 设置主节点与数据节点角色:
      node.master: true
      node.data: true
      
    • 配置数据存储路径:
      path.data: /var/lib/elasticsearch
      
  2. 安全配置

    • 启用 HTTPS:
      https.enabled: true
      
    • 设置密码认证:
      xpack.security.http.ssl.enabled: true
      
  3. 索引优化

    • 配置分片策略:
      index.number_of_shards: 3
      index.number_of_replicas: 1
      

扩展阅读

elasticsearch_cluster
elasticsearch_indexing