ES之二:centos7安装kibana和IK分词器

发布于:2024-08-26 ⋅ 阅读:(154) ⋅ 点赞:(0)

一、Kibana介绍

Kibana是一个针对Elasticsearch的开源分析及可视化平台,使用Kibana可以查询、查看并与存储在ES索引的数据进行交互操作,使用Kibana能执行高级的数据分析,并能以图表、表格和地图的形式查看数据。

二、Kibana安装

1、注意elasticsearch 和 kibana使用同一个版本

下载地址:https://www.elastic.co/cn/downloads/kibana

[root@localhost es7.14]# wget https://artifacts.elastic.co/downloads/kibana/kibana-7.14.0-linux-x86_64.tar.gz

2、更改配置

  1. 解压
    在这里插入图片描述

  2. 更改config/kibana.yml

    [root@localhost es7.14]# cd kibana-7.14
    [root@localhost kibana-7.14]# vim config/kibana.yml
    
    
    server.port: 15601
    
    # Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
    # The default is 'localhost', which usually means remote machines will not be able to connect.
    # To allow connections from remote users, set this parameter to a non-loopback address.
    # 允许访问的IP,如果允许任何IP访问此处输入0.0.0.0
    server.host: "192.168.21.18"
    
    # Enables you to specify a path to mount Kibana at if you are running behind a proxy.
    # Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
    # from requests it receives, and to prevent a deprecation warning at startup.
    # This setting cannot end in a slash.
    #server.basePath: ""
    
    # Specifies whether Kibana should rewrite requests that are prefixed with
    # `server.basePath` or require that they are rewritten by your reverse proxy.
    # This setting was effectively always `false` before Kibana 6.3 and will
    # default to `true` starting in Kibana 7.0.
    #server.rewriteBasePath: false
    
    # The maximum payload size in bytes for incoming server requests.
    #server.maxPayloadBytes: 1048576
    
    # The Kibana server's name.  This is used for display purposes.
    # 服务名称
    server.name: "ltkj-kibana"
    
    # The URLs of the Elasticsearch instances to use for all your queries.
    # ES服务地址
    elasticsearch.hosts: ["http://localhost:9200"]
    
    # When this setting's value is true Kibana uses the hostname specified in the server.host
    # setting. When the value of this setting is false, Kibana uses the hostname of the host
    # that connects to this Kibana instance.
    #elasticsearch.preserveHost: true
    #
    # Kibana uses an index in Elasticsearch to store saved searches, visualizations and
    # dashboards. Kibana creates a new index if the index doesn't already exist.
    # 创建的索引
    #kibana.index: ".kibana"
    #
    # # The default application to load.
    # #kibana.defaultAppId: "home"
    
    # # If your Elasticsearch is protected with basic authentication, these settings provide
    # # the username and password that the Kibana server uses to perform maintenance on the Kibana
    # # index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
    # # is proxied through the Kibana server.
    # 登录ES使用的用户名和密码
    #elasticsearch.username: "kibana"
    #elasticsearch.password: "pass"
    
    
    # Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
    # These settings enable SSL for outgoing requests from the Kibana server to the browser.
    #server.ssl.enabled: false
    #server.ssl.certificate: /path/to/your/server.crt
     #server.ssl.key: /path/to/your/server.key
    #
    # Optional settings that provide the paths to the PEM-format SSL certificate and key files.
    # These files are used to verify the identity of Kibana to Elasticsearch and are required when
    # xpack.security.http.ssl.client_authentication in Elasticsearch is set to required.
    #elasticsearch.ssl.certificate: /path/to/your/client.crt
    #elasticsearch.ssl.key: /path/to/your/client.key
    
    # Optional setting that enables you to specify a path to the PEM file for the certificate
    # authority for your Elasticsearch instance.
    #elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]
    
    # To disregard the validity of SSL certificates, change this setting's value to 'none'.
    #elasticsearch.ssl.verificationMode: full
    
    # Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of
    # the elasticsearch.requestTimeout setting.
    #elasticsearch.pingTimeout: 1500
    
    # Time in milliseconds to wait for responses from the back end or Elasticsearch. This value
    # must be a positive intege
    #elasticsearch.requestTimeout: 30000
    #
    # # List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side
    # # headers, set this value to [] (an empty list).
    # #elasticsearch.requestHeadersWhitelist: [ authorization ]
    #
    # Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
    # by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
    #elasticsearch.customHeaders: {}
    #
    # Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
    #elasticsearch.shardTimeout: 30000
    
    # Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying.
    #elasticsearch.startupTimeout: 5000
    #
    # Logs queries sent to Elasticsearch. Requires logging.verbose set to true.
    #elasticsearch.logQueries: false
    #
    # Specifies the path where Kibana creates the process ID file.
    #pid.file: /var/run/kibana.pid
    #
    ables you specify a file where Kibana stores log output.
    #logging.dest: stdout
    #
    # Set the value of this setting to true to suppress all logging output.
    #logging.silent: false
    
    # Set the value of this setting to true to suppress all logging output other than error messages.
    #logging.quiet: false
    
    # Set the value of this setting to true to log all events, including system usage information
    # and all requests.
    #logging.verbose: false
    
    # Set the interval in milliseconds to sample system and process performance
    # metrics. Minimum is 100ms. Defaults to 5000.
    #ops.interval: 5000
    
    # Specifies locale to be used for all localizable strings, dates and number formats.
    # Supported languages are the following: English - en , by default , Chinese - zh-CN .
    # 设置kibana为中文
    i18n.locale: "zh-CN"
    
    
  3. 用非root用户启动并赋权

    chown -R es:es kibana-7.6.1
    su es
    
  4. 启动kibanna
    在这里插入图片描述

3、kibana使用

  1. 使用kibana中的开发工具

  2. 更多操作
    这里的操作和restapi是一样的,好处是有自动提示,具体更多操作可以参考我的另一篇文章:
    Elasticsearch-02-es的restapi使用

三、Kibana安装

ik分词器: https://github.com/infinilabs/analysis-ik

源码: https://github.com/infinilabs/analysis-ik.git

1. 解压ik分词器

注:ik分词器要解压到elasticsearch-7.14.0的plugins目录中。解压后,重启es没问题,表示安装成功,验证可以看第7条(安装和验证ik分词器)

  • 首先进入elasticsearch-7.14.0的plugins目录,创建ik目录
  • 将elasticsearch-analysis-ik-7.16.1.zip移动到ik目录下:
[root@localhost ik]# cd /usr/local/soft/es7.14/elasticsearch-7.14/plugins
[root@localhost ik]# mkdir ik
[root@localhost ik]# unzip elasticsearch-analysis-ik-7.16.1.zip

[root@localhost ik]# chown -R es:es  /usr/local/soft/es7.14/elasticsearch-7.14

2. 重新启动ES

ik分词器版本 7.16.1

启动报错:
uncaught exception in thread [main]
java.lang.IllegalArgumentException: Plugin [analysis-ik] was built for Elasticsearch version 7.16.1 but version 7.14.0 is running

在这里插入图片描述

解决方法
在改分词器文件夹下找到plugin-descriptor.properties

elasticsearch.version=改成你当前服务器es的版本

在这里插入图片描述
在这里插入图片描述