linux系统安装和配置kibana管理工具

来源:互联网 发布:泰晤士小镇 知乎 编辑:程序博客网 时间:2024/05/21 02:33

简介

  Kibana是一个针对Elasticsearch的开源分析及可视化平台,用来搜索、查看交互存储在Elasticsearch索引中的数据。使用Kibana,可以通过各种图表进行高级数据分析及展示,是对elasticsearch搜索引擎进行有效管理的工具;

实践

  上一篇博客,我们已经对elasticsearch在linux系统上安装进行了详细的说明,那么es运行起来之后,我们需要选择一种可视化的管理工具对es进行管理,那么kibana就是其中一种管理工具,相对来说是比较好用的(另一种管理工具是head工具,这里就不进行详细说明了,有需要可以自行百度);
那么接下来就对安装kibana进行详细说明:</font>

  1. 下载kibana-5.6.1压缩安装包,下载路径可参考如下:kibana-5.6.1工具包下载,然后在linux存放es的同级目录下解压(方便管理);
  2. 解压之后呢,就开始进行文件配置了,找到config目录下的kibana.yml文件,然后进行配置,具体的参考配置如下,为了方便下面的配置只设置了本机地址和es访问连接地址,有其他需求的话可继续配置:
#设置kibna端口;默认5601#server.port: 5601# 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.#设置本机IP地址server.host: "127.0.0.1"# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests# to Kibana. This setting cannot end in a slash.#server.basePath: ""# 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: "your-hostname"#设置ES访问地址(自行修改),端口9200elasticsearch.url: "http://192.168.1.1: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: "discover"# 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## 设置访问kibana时的用户名;默认为空;可以直接访问#elasticsearch.username: "user"## 设置访问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 validate that your Elasticsearch backend uses the same key files.#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 integer.#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: 0# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying.#elasticsearch.startupTimeout: 5000# Specifies the path where Kibana creates the process ID file.#pid.file: /var/run/kibana.pid# Enables 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# The default locale. This locale can be used in certain circumstances to substitute any missing# translations.#i18n.defaultLocale: "en"
  1. 以上文件配置完了之后,那么就可以去启动kibana了,所以这一个工具的安装还是挺方便的,进入bin目录,执行命令语句: ./ kibana & 后台启动;
  2. 启动之后,怎么查看kibana的进程呢,使用传统的 ps aux|grep kibana 命令是无法查看kibana的进程的,需要执行命令语句:fuser -n tcp 5601;
  3. 查看到kibana的进程之后,说明启动成功了,如果想要杀死进程,可直接执行: kill -9 进程号 命令即可;

问题

  看到上面安装、配置、启动如此简单,那么当然就避免不了可能会发生的几种问题,以下是一些问题的总结和解决方式:

  1. JDK版本不兼容,或者太低。安装启动kibana的JDK必须1.8或以上,在不改变当前JDK环境变量的情况下,可以在bin目录下的kibana
    启动文件里面的头部新增如下命令(jdk1.8的linux版本如果没有,需要自行下载,放到指定的路径下),这种解决方式和前面提到过的es启动遇到的问题的解决方式是一样的:
    export JAVA_HOME=/usr/local/jdk1.8.0_121
    export PATH=$JAVA_HOME/bin:$PATH

    jdk1.8.0_121是自行下载的一个jdk版本,如果没有可自行下载;

  2. 启动kibana的时候可能会报找不到node命令的错误,需要先安装nodejs,配置node环境,具体安装步骤:
    (1) 下载node-v6.10.0-linux-x64.tar.xz安装包(网上一大堆下载,这里就不放上来了),放到kibana同级目录(方便管理);
    (2) tar -xvf node-v6.10.0-linux-x64.tar.xz
    (3) mv node-v6.10.0-linux-x64 nodejs
    (4) 确认一下nodejs下bin目录是否有node 和npm文件,如果有,执行软连接,如果没有,重新下载执行上边步骤;
    建立软连接,变为全局
    (5) ln -s /app/software/nodejs/bin/npm /usr/local/bin/
    (6) ln -s /app/software/nodejs/bin/node /usr/local/bin/
    (7) 测试版本:node -v

总结

  以上就是安装kibana管理工具的全过程,可能会出现的问题也提供了相应的解决方法,如果有其他的可能会遇到的问题,欢迎交流;
  安装好了kibana之后,访问kibana的地址一般是ip地址+5601的端口号,端口号可在配置文件自行更改;
  那么es搜索引擎的管理工具kibana也安装完成了,成功对elasticsearch里面的索引和类型进行有效管理,接下来的博客将会讲到如何使用logstash去重oracle、postgresql、sqlserever等数据库全量或增量导入数据到es里面,一键导入各类型数据库数据;