ELK生態:linux系統安裝和配置kibana管理工具

簡介

  • Kibana是一個針對Elasticsearch的開源分析及可視化平臺,用來搜索、查看交互存儲在Elasticsearch索引中的數據;
  • 使用Kibana,可以通過各種圖表進行高級數據分析及展示,是對elasticsearch搜索引擎進行有效管理的工具;

實踐

  • 上一篇博客,我們已經對elasticsearch在linux系統上安裝進行了詳細的說明,那麼es運行起來之後,我們需要選擇一種可視化的管理工具對es進行管理,那麼kibana就是其中一種管理工具,相對來說是比較好用的(另一種管理工具是head工具,這裏就不進行詳細說明了,有需要可以自行百度);
  • 首先,下載kibana-5.6.1壓縮安裝包,下載路徑可參考如下:
  1. windows版本:kibana-5.6.1工具包下載
  2. linux版本:kibana-5.6.1-linux
  • 這裏我們選擇linux版本的kibana安裝,然後,在linux存放es的同級目錄下解壓(方便管理);
  • 解壓之後,就開始進行文件配置了,找到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訪問地址(自行修改),端口9200
elasticsearch.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"

 

  • 最後,啓動kibana,進入bin目錄,執行以下命令:
#單次運行
$ ./kibana

#後臺運行,進程保護
$ nohup ./kibana &

 

  • 查看kibana進程,使用傳統的 ps aux|grep kibana 命令是無法查看kibana的進程的,執行命令:fuser -n tcp 5601; 
  • 如果停止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

問題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/
        ln -s /app/software/nodejs/bin/node /usr/local/bin/
	  
(6)測試node版本:node -v

 

總結

  • 以上就是安裝kibana管理工具的全過程,可能會出現的問題也提供了相應的解決方法,如果有其他的可能會遇到的問題,歡迎交流;
  • 安裝好了kibana之後,訪問kibana的地址一般是 ip地址+5601 的端口號,端口號可在配置文件自行更改;
  • 那麼es搜索引擎的管理工具kibana也安裝完成了,成功對elasticsearch裏面的索引和類型進行有效管理,接下來的博客將會講到如何使用logstash去重oracle、postgresql、sqlserever等數據庫全量或增量導入數據到es裏面,一鍵導入各類型數據庫數據;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章