Skip to main content

Kibana

Note

Unless there is a specific requirement, deploying Kibana is usually unnecessary.

Introduction to Kibana

Kibana is an open-source data visualization and analysis platform designed specifically for Elasticsearch.

It offers an intuitive web interface that allows users to interactively and visually query data stored in Elasticsearch.

Additionally, it works well with Metricbeat to monitor the performance of indices in the current Elasticsearch cluster.

Deploying Kibana

  1. Download the Kibana installation package

    wget https://pdpublic.mingdao.com/private-deployment/offline/common/kibana-8.5.3-linux-x86_64.tar.gz
  2. Extract and move it to the installation directory

    tar xf kibana-8.5.3-linux-x86_64.tar.gz
    mv kibana-8.5.3 /usr/local/kibana
  3. Modify the Kibana configuration file

    cat > /usr/local/kibana/config/kibana.yml << EOF
    server.port: 5601
    server.host: "0.0.0.0"
    server.maxPayloadBytes: 10485760
    elasticsearch.hosts: ["http://192.168.10.10:9200"]
    elasticsearch.username: "kibana_system"
    elasticsearch.password: "123456"
    i18n.locale: "zh-CN"
    monitoring.ui.ccs.enabled: false
    server.publicBaseUrl: "https://hap.domain.com:443/privatedeploy/mdy/monitor/kibana"
    server.basePath: "/privatedeploy/mdy/monitor/kibana"
    EOF
    • server.publicBaseUrl and server.basePath are used in conjunction with nginx reverse proxy. If proxy configuration is not needed, comment out these two lines and access the service via local_IP:5601 after deployment.
  4. Configure the password for the kibana_system user in Elasticsearch

    # This can be done on any Elasticsearch node

    /usr/local/elasticsearch/bin/elasticsearch-reset-password -u kibana_system -i

    # Password 123456 will not be displayed in the terminal after input, just paste or type your custom password as usual
  5. Set up start and stop scripts for Kibana

    cat > /usr/local/kibana/start_kibana.sh << EOF
    nohup /usr/local/kibana/bin/kibana --allow-root &
    EOF

    cat > /usr/local/kibana/stop_kibana.sh << EOF
    kill \$(pgrep -f '/usr/local/kibana/bin')
    EOF

    chmod +x /usr/local/kibana/start_kibana.sh
    chmod +x /usr/local/kibana/stop_kibana.sh
  6. Start Kibana

    cd /usr/local/kibana/ && bash start_kibana.sh
  7. Configure nginx reverse proxy, see the proxy configuration file example below

    location /privatedeploy/mdy/monitor/kibana/ {
    proxy_pass http://192.168.10.10:5601;
    proxy_redirect off;
    proxy_buffering off;
    proxy_http_version 1.1;
    proxy_set_header Connection "Keep-Alive";
    proxy_set_header Proxy-Connection "Keep-Alive";
    rewrite ^/privatedeploy/mdy/monitor/kibana/(.*)$ /$1 break;
    }
  8. Once the proxy is configured, access the service via https://hap.domain.com:443/privatedeploy/mdy/monitor/kibana

    • The username/password are for Elasticsearch authentication. The default initial user is elastic, and the password is based on the actual configuration.

Deploying Metricbeat

Metricbeat needs to be deployed on every Elasticsearch node

  1. Download the Metricbeat installation package

    wget https://pdpublic.mingdao.com/private-deployment/offline/common/metricbeat-8.5.3-linux-x86_64.tar.gz
  2. Extract and move it to the installation directory

    tar xf metricbeat-8.5.3-linux-x86_64.tar.gz
    mv metricbeat-8.5.3 /usr/local/metricbeat
  3. Navigate to the Metricbeat installation directory

    cd /usr/local/metricbeat
  4. Configure the metricbeat.yml file

    cat > metricbeat.yml <<EOF
    metricbeat.config.modules:
    path: ${path.config}/modules.d/*.yml
    reload.enabled: false

    setup.template.settings:
    index.number_of_shards: 1
    index.codec: best_compression

    setup.kibana:
    host: "192.168.10.10:5601"
    username: "elastic"
    password: "123456"

    output.elasticsearch:
    hosts: ["192.168.10.10:9200"]
    username: "elastic"
    password: "123456"

    processors:
    - add_host_metadata: ~
    - add_cloud_metadata: ~
    - add_docker_metadata: ~
    - add_kubernetes_metadata: ~
    EOF
  5. Manage monitoring modules

    ./metricbeat modules enable elasticsearch-xpack
    ./metricbeat modules disable system
  6. Configure the elasticsearch-xpack module file

    cat > ./modules.d/elasticsearch-xpack.yml <<EOF
    - module: elasticsearch
    xpack.enabled: true
    period: 10s
    hosts: ["http://192.168.10.10:9200"]
    username: "elastic"
    password: "123456"
    EOF
  7. Initialize the dashboards

    ./metricbeat setup -e
    • Normally, it outputs loaded dashboards. In case of errors, resolve as per the error messages and reinitialize.
  8. Set up start and stop scripts

    cat > /usr/local/kibana/start_metricbeat.sh << EOF
    nohup /usr/local/metricbeat/metricbeat -e &
    EOF

    cat > /usr/local/kibana/stop_metricbeat.sh << EOF
    kill \$(pgrep -f '/usr/local/metricbeat/metricbeat')
    EOF

    chmod +x /usr/local/metricbeat/start_metricbeat.sh
    chmod +x /usr/local/metricbeat/stop_metricbeat.sh
  9. Start Metricbeat

    bash start_metricbeat.sh