ElasticSearch 优化配置

索引建立优化

{
  "settings": {
    // 副本数
    "number_of_replicas": 0,
    // 分片数
    "number_of_shards": 5,
    // 存储类型
    "index.store.type": "niofs",
    // 默认查询字段
    "index.query.default_field": "title",
    // 节点掉线延迟时间
    "index.unassigned.node_left.delayed_timeout": "5m"
  },
  "mappings": {
    "house": {
      // 非动态引擎
      "dynamic": "strict",
      // 不是对所有字段都查询索引
      "_all":{
        "enabled": false
      },
      "properties": {
        "houseId": {
          "type": "long"
        },
        "title": {
          "type": "text",
          "index": "analyzed",
          "analyzer": "ik_smart",
          "search_analyzer": "ik_smart"
        },
        "price": {
          "type": "integer"
        },
        "area": {
          "type": "integer"
        },
        "createTime": {
          "type": "date",
          "format": "strict_date_optional_time||epoch_millis"
        },
        "lastUpdateTime": {
          "type": "date",
          "format": "strict_date_optional_time||epoch_millis"
        },
        "cityEnName": {
          "type": "keyword"
        },
        "regionEnName": {
          "type": "keyword"
        },
        "direction": {
          "type": "integer"
        },
        "distanceToSubway": {
          "type": "integer"
        },
        "subwayLineName": {
          "type": "keyword"
        },
        "subwayStationName": {
          "type": "keyword"
        },
        "tags": {
          "type": "text"
        },
        "street": {
          "type": "keyword"
        },
        "district": {
          "type": "keyword"
        },
        "description": {
          "type": "text",
          "index": "analyzed",
          "analyzer": "ik_smart",
          "search_analyzer": "ik_smart"
        },
        "layoutDesc" : {
          "type": "text",
          "index": "analyzed",
          "analyzer": "ik_smart",
          "search_analyzer": "ik_smart"
        },
        "traffic": {
          "type": "text",
          "index": "analyzed",
          "analyzer": "ik_smart",
          "search_analyzer": "ik_smart"
        },
        "roundService": {
          "type": "text",
          "index": "analyzed",
          "analyzer": "ik_smart",
          "search_analyzer": "ik_smart"
        },
        "rentWay": {
          "type": "integer"
        },
        "suggest":{
          "type": "completion"
        },
        "location":{
          "type": "geo_point"
        }
      }
    }
  }
}
复制代码

配置优化 ./config/elasticsearch.yml

    // 禁用通配符删除
    "action.destructive_requires_name": true,
    # 刷新间隔
    "index.refresh_interval": "30s",
    # 节点间的存活检测间隔
    "discovery.zen.fd.ping_interval": "1s",
    # 存活超时时间
    "discovery.zen.fd.ping_timeout": "1s",
    # 存活超时重试次数
    "discovery.zen.fd.ping_retries": 3
    

   # node节点配置
    "node.master":true
    "node.data": false
    #  数据节点配置
    "node.master":false
    "node.data": true

    # 针对数据节点http功能关闭
    "http.enabled":false

    # 负载均衡节点配置(一般不用es的配置)
    
复制代码

./config/jvm.options

# 最小最大堆内存
-Xms 
-Mmx 
复制代码

nginx 负载均衡 nginx.conf

# 激活nginx core-module模块
./configure with-stream 
复制代码
./
stream{
   upstream_backend{
        server localhost:9300;
  }

  server {
      listen 9999;
      proxy_timeout 20s;
      proxy_pass backend 
  }
}
复制代码
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值