命令记不住

登陆

Elasticsearch 和 kibana 安装配置

Elasticsearch和kibana安装配置

1.Elasticsearch/ik中文分词

1.下载安装jdk 1.8
2.下载es版本

功能完整版本:https://www.elastic.co/cn/downloads/past-releases#elasticsearch
开源版本:https://www.elastic.co/cn/downloads/past-releases/elasticsearch-oss-6-7-1

3.安装中文分词插件
https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v6.7.1
下载6.7.1手工下载,解压释放到

D:\elasticsearch-6.7.1\plugins\ik

或者(可能需要挂代理)

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.7.1/elasticsearch-analysis-ik-6.7.1.zip

2.运行es/ik

1.安装运行ES

D:\elasticsearch-6.7.1>bin\elasticsearch.bat

浏览器访问 http://localhost:9200/

{
"name" : "A9Gz_ee",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "N30_TSFHRaS-DdwqQw50Ew",
"version" : {
 "number" : "6.7.1",
 "build_flavor" : "default",
 "build_type" : "zip",
 "build_hash" : "2f32220",
 "build_date" : "2019-04-02T15:59:27.961366Z",
 "build_snapshot" : false,
 "lucene_version" : "7.7.0",
 "minimum_wire_compatibility_version" : "5.6.0",
 "minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}

可能需要的配置

D:\elasticsearch-6.7.1\config\elasticsearch.yml
# 禁止磁盘空间检查
cluster.routing.allocation.disk.threshold_enabled: false

服务器索引一览

http://localhost:9200/_cat/indices
green  open jaeger-span-2019-04-14    4Bh6BvEJQ--dhgEsI0HAkA 1 0 97 0 42.3kb 42.3kb
green  open .kibana_1                 E2TqS8SPTDGwBn4GZsf-sg 1 0  1 0  3.7kb  3.7kb
yellow open megacorp                  KjFARwMBRb2T4wtJSuDmeA 5 1  3 0 17.5kb 17.5kb

3.kibana

1.下载kibana
https://www.elastic.co/cn/downloads/past-releases/kibana-6-7-1

2.解压运行kibana

D:\kibana-6.7.1-windows-x86_64>bin\kibana.bat
# The URLs of the Elasticsearch instances to use for all your queries.
#elasticsearch.hosts: ["http://localhost:9200"]

访问浏览器查看
http://localhost:5601/

解决异常情况:

es索引close

close .kibana_1            
close .kibana_task_manager 

打开索引

curl -X POST "localhost:9200/.kibana/_open"
curl -X POST "localhost:9200/.kibana_task_manager/_open"

4.测试中文分词插件

GET /_analyze
{
"analyzer": "ik_max_word",
"text": "美国留给伊拉克的是个烂摊子吗"
}
{
  "tokens" : [
    {
      "token" : "美国",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "CN_WORD",
      "position" : 0
    },
    {
      "token" : "留给",
      "start_offset" : 2,
      "end_offset" : 4,
      "type" : "CN_WORD",
      "position" : 1
    },
    {
      "token" : "伊拉克",
      "start_offset" : 4,
      "end_offset" : 7,
      "type" : "CN_WORD",
      "position" : 2
    },
    {
      "token" : "的",
      "start_offset" : 7,
      "end_offset" : 8,
      "type" : "CN_CHAR",
      "position" : 3
    },
    {
      "token" : "是",
      "start_offset" : 8,
      "end_offset" : 9,
      "type" : "CN_CHAR",
      "position" : 4
    },
    {
      "token" : "个",
      "start_offset" : 9,
      "end_offset" : 10,
      "type" : "CN_CHAR",
      "position" : 5
    },
    {
      "token" : "烂摊子",
      "start_offset" : 10,
      "end_offset" : 13,
      "type" : "CN_WORD",
      "position" : 6
    },
    {
      "token" : "烂",
      "start_offset" : 10,
      "end_offset" : 11,
      "type" : "CN_CHAR",
      "position" : 7
    },
    {
      "token" : "摊子",
      "start_offset" : 11,
      "end_offset" : 13,
      "type" : "CN_WORD",
      "position" : 8
    },
    {
      "token" : "吗",
      "start_offset" : 13,
      "end_offset" : 14,
      "type" : "CN_CHAR",
      "position" : 9
    }
  ]
}
推荐阅读