Elastic Search Kibana 설치 후 Stack 모니터링 설정

 

Elastic Search Kibana 설치 후 Stack 모니터링 설정

지난 포스팅에 이어 Kibana 설치를 하고 엘라스틱 서치와 키바나 스택에 대한 모니터링 등록까지 진행할 예정입니다.

 

Kibana 설치

지난 포스팅에서 yum을 이용해 엘라스틱 서치를 설치를 했기 때문에 키바나 역시 yum을 이용해 설치할 예정입니다.

$ yum install --enablerepo=elasticsearch kibana

설치가 완료 되었으니 환경 설정 파일을 수정합니다.

$ vi /etc/kibana/kibana.yml

# Kibana is served by a back end server. This setting specifies the port to use.
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.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "10.100.170.61"

# 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

# Specifies the public URL at which Kibana is available for end users. If
# `server.basePath` is configured this URL should end with the same basePath.
#server.publicBaseUrl: ""

# 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: "es-master-01"

# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch.hosts: ["http://10.100.170.61:9200"]

# 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"

...
..
.
(생략)

이렇게 몇가지 설정을 바꾼 후에  웹페이지를 통해 접속을 하면 키바나 화면이 등장합니다.

현재 다른 데이터를 추가 할 것은 아니고 설치한 엘라스틱 서치와 키바나 스택 자체를 모니터링을 하기 위한 설정을 합니다.

 

Stack 모니터링

키바나와 마스터 노드가 설치된 서버에서만 설치를 진행합니다.

metricbeat는 서버 및 솔루션의 metirc 정보를 긁어서 엘라스틱에 보내는 역할을 합니다.

filebeat는 log 파일들의 내용을 엘라스틱으로 보내는 역할을 합니다.

$ yum install --enablerepo=elasticsearch metricbeat filebeat

$ vi /etc/metricbeat/metricbeat.yml

# =================================== Kibana ===================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  hosts: ["10.100.170.61:5601"]

  # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

# =============================== Elastic Cloud ================================

# These settings simplify using Metricbeat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
# `setup.kibana.host` options.
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["10.100.170.61:9200","10.100.170.62:9200","10.100.170.73","10.100.170.76"]

  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  #username: "elastic"
  #password: "changeme"

다른 부분은 건들지 않고 kibana와 데이터가 쌓이는 엘라스틱 서치의 정보(스택의 엘라스틱 서치 마스터노드)를 기입해줍니다.

그리고 xpack을 이용한 모니터링을 할 것이기 때문에 해당 모듈들을 활성화 하고 설정 파일을 수정합니다.

$ metricbeat modules enable elasticsearch-xpack
$ metricbeat modules enable kibana-xpack

$ vi /etc/metricbeat/modules.d/elasticsearch-xpack.yml

# Module: elasticsearch
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.11/metricbeat-module-elasticsearch.html

- module: elasticsearch
  xpack.enabled: true
  period: 10s
  hosts: ["http://10.100.170.61:9200","http://10.100.170.62:9200","http://10.100.170.73:9200","http://10.100.170.76:9200"]
  #username: "user"
  #password: "secret"

$ vi /etc/metricbeat/modules.d/kibana-xpack.yml

# Module: kibana
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.11/metricbeat-module-kibana.html

- module: kibana
  xpack.enabled: true
  period: 10s
  hosts: ["10.100.170.61:5601"]
  #basepath: ""
  #username: "user"
  #password: "secret"

그리고 metricbeat를 구동해 줍니다.

$ systemctl start metricbeat

로그 파일을 키바나에서 보기 위해 filebeat를 설정하겠습니다.

스택 엘라스틱 서치의 로그만 보낼 것이기 때문에 다른 설정은 건드리지 않을겁니다.

$ vi /etc/filebeat/filebeat.yml

# =================================== Kibana ===================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "10.100.170.61:5601"

  # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

# =============================== Elastic Cloud ================================

# These settings simplify using Filebeat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
# `setup.kibana.host` options.
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["10.100.170.61:9200"]

  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  #username: "elastic"
  #password: "changeme"

그리고 filebeat의 elasticsearch 모듈을 사용으로 바꿔 줍니다.

$ filebeat modules enable elasticsearch

$ vi /etc/filebeat/modules.d/elasticsearch.yml

# Module: elasticsearch
# Docs: https://www.elastic.co/guide/en/beats/filebeat/7.11/filebeat-module-elasticsearch.html

- module: elasticsearch
  # Server log
  server:
    enabled: true

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths:
      - /var/log/elasticsearch/*_server.json

  gc:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    #var.paths:

  audit:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    #var.paths:

  slowlog:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths:
      - /var/log/elasticsearch/*_index_search_slowlog.json
      - /var/log/elasticsearch/*_index_indexing_slowlog.json

  deprecation:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    #var.paths:

로그 패스들을 지정해 주고 filebeat를 구동합니다.

$ systemctl start filebeat

좌측 하단에 Stack Monitoring 이라는 메뉴가 있습니다.

Stack Monitoring을 누르면 다음과 같은 화면으로 넘어갑니다.

이렇게 구성된 엘라스틱과 키바나에 대한 모니터링 데이터 역시 엘라스틱 서치에 쌓여서 모니터링을 하고 있는 걸 확인할 수 있습니다.

저는 MongoDB와 연동을 하기 위해 엘라스틱 서치를 설치한 것이기 때문에 Monstache 를 이용할 예정이기 때문에 logstash를 설치 하지 않았습니다.

엘라스틱 서치와 키바나에 대한 구성은 여기까지만 하고 완료합니다.

 

 

 

 

소셜 미디어로 공유하기

You may also like...

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

 

새 블로그로 이사갑니다.

 

rastalion.dev

 

도메인 변경했어요. 현재 지속적으로 개선 중입니다.

 

This will close in 10 seconds