云计算平台(检索篇)-Elasticsearch-配置篇

ElasticSearch安装好后我们需要对ElasticSearch的Config进行一系列配置,具体如下:

 

cluster.name: rmscloud

集群名称

 

node.name: "rcnode21"

节点名称

 

node.tag: "tag21"

节点标签

 

node.data: true

节点是否存储数据

 

index.number_of_shards: 5

索引分片数

 

index.number_of_replicas: 1

索引副本数

 

path.data: /data/elasticsearch/data

数据目录存放位置

 

path.logs: /data/elasticsearch/log

日志数据存放位置

bootstrap.mlockall: true

内存

 

index.cache.field.max_size: 500000

索引缓存

 

index.cache.field.expire: 5m

索引缓引过期时间

 

其它配置基本上不用调,具体可参考附录。另外需要的调配置是分词具体例子如下:

index:

  analysis:

    tokenizer:

      my_pinyin:

          type: pinyin

          first_letter: "prefix"

          padding_char: ""

      pinyin_first_letter:

          type: pinyin

          first_letter: "only"

      mmseg_maxword:

          type: mmseg

          seg_type: "max_word"

      mmseg_complex:

          type: mmseg

          seg_type: "complex"

      mmseg_simple:

          type: mmseg

          seg_type: "simple"

      semicolon_spliter:

          type: pattern

          pattern: ";"

      pct_spliter:

          type: "pattern"

          pattern: "[%]+"

 

    filter:

      ngram_min_2:

          max_gram: 10

          min_gram: 2

          type: nGram

      ngram_min_1:

          max_gram: 10

          min_gram: 1

          type: nGram

      min2_length:

          min:  2

          max:  4

          type: length

 

    analyzer:

      lowercase_keyword:

          type: custom

          filter: [standard,lowercase]

          tokenizer: standard

      lowercase_keyword_ngram_min_size1:

          type: custom

          filter: [ngram_min_1,standard,lowercase]

          tokenizer: nGram

      lowercase_keyword_ngram_min_size2:

          type: custom

          filter: [ngram_min_2,standard,lowercase,min2_length,stop]

          tokenizer: nGram

      lowercase_keyword_ngram:

          type: custom

          filter: [ngram_min_1,standard,lowercase]

          tokenizer: nGram

      lowercase_keyword_without_standard:

          type: custom

          filter: [lowercase]

          tokenizer: keyword

      lowercase_whitespace:

          type: custom

          filter: [lowercase]

          tokenizer: whitespace

      ik:

          alias: [ik_analyzer]

          type: org.elasticsearch.index.analysis.IkAnalyzerProvider

      ike:

          alias: [ike_analyzer]

          type: org.elastichsearch.ik.index.IkAnalyzerProvider

          usermode: true

      mmseg:

          alias: [mmseg_analyzer]

          type: org.elasticsearch.index.analysis.MMsegAnalyzerProvider

      comma_spliter:

          type: "pattern"

          pattern: "[,|\\s]+"

      pct_spliter:

          type: "pattern"

          pattern: "[%]+"

      custom_snowball_analyzer:

          type: "snowball"

          language: "English"

      simple_english_analyzer:

          type: "custome"

          tokenizer: whitespace

          filter: [standard,lowercase,snowball]

      edge_ngram:

          type: custom

          tokenizer: edgeNGram

          filter: [lowercase]

      pinyin_ngram_analyzer:

          type: custom

          tokenizer: my_pinyin

          filter: [standard,lowercase,nGram]

      pinyin_first_letter_analyzer:

          type: custom

          tokenizer: pinyin_first_letter

          filter: [standard,lowercase]

      custom_auth_en_analyzer:

          type: custom

          tokenizer: semicolon_spliter

          filter: [standard,snowball,lowercase,trim]

 

index.analysis.analyzer.default.type : "keyword"

 

 

进行完Config的配置后还需要对bin目录下面的elastichsearch进行配置,此处主要是控制JVM的一些参数

ES_MIN_MEM=27G

ES_MAX_MEM=27G

调整JVM的最大内存和最小内存就可以了,其它JVM参数见附录。

posted on 2012-12-06 08:16  Mr.HiFiy  阅读(2181)  评论(0编辑  收藏  举报