前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ElasticSearch 优化配置

ElasticSearch 优化配置

作者头像
Meet相识
发布2018-09-12 16:31:11
6910
发布2018-09-12 16:31:11
举报
文章被收录于专栏:技术专栏技术专栏

索引建立优化

代码语言:javascript
复制
{
  "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

代码语言:javascript
复制
    // 禁用通配符删除
    "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

代码语言:javascript
复制
# 最小最大堆内存
-Xms 
-Mmx 

nginx 负载均衡 nginx.conf

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

  server {
      listen 9999;
      proxy_timeout 20s;
      proxy_pass backend 
  }
}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.02.06 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
负载均衡
负载均衡(Cloud Load Balancer,CLB)提供安全快捷的流量分发服务,访问流量经由 CLB 可以自动分配到云中的多台后端服务器上,扩展系统的服务能力并消除单点故障。负载均衡支持亿级连接和千万级并发,可轻松应对大流量访问,满足业务需求。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档