Linux 安装部署 Kibana 8.12.2

  • 官网下载安装包,上传解压打开
    tar -xzf kibana-8.12.2-linux-x86_64.tar.gz
  • 分配文件夹权限
    chown -R elastic:elastic kibana-8.12.2
    chmod -R 777 kibana-8.12.2
  • 修改配置文件config/kibana.yml(里边内容替换为自己的)

    # For more configuration options see the configuration guide for Kibana in
    # https://www.elastic.co/guide/index.html
    
    # =================== System: Kibana Server ===================
    # 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.
    # kibana所在服务器地址
    server.host: "你的服务器ip"
    
    # 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.
    # kibana暴露给外部的访问地址
    server.publicBaseUrl: "外网访问地址"
    
    # The maximum payload size in bytes for incoming server requests.
    #server.maxPayload: 1048576
    
    # The Kibana server's name. This is used for display purposes.
    #server.name: "your-hostname"
    
    # =================== System: Elasticsearch (Optional) ===================
    # 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: /opt/elasticsearch-8.12.2/config/certs/ca/ca.crt
    # elasticsearch.ssl.key: /opt/elasticsearch-8.12.2/config/certs/ca/ca.key
    
    # 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: certificate

    -运行kibana

    # 切换到新用户,启动Kibana
    su elastic
    cd kibana-8.12.2/bin
    ./kibana

    -浏览器打开kibana启动页面显示的链接,输入enrollment-token 初始化,输入账号密码登录,
    -账号:elastic 密码:ES集群启动时生成的密码
    -配置服务

    su root 
    cd /etc/init.d      ###配置服务脚本的目录
    vim kibana     ###写入如下内容
    #!/bin/bash
    
    KIBANA_HOME=/usr/local/kibana
    EXEC=${KIBANA_HOME}/bin/kibana
    PIDFILE=${KIBANA_HOME}/kibana.pid
    LOG_DIR=${KIBANA_HOME}/logs
    LOG_FILE=${LOG_DIR}/kibana.log
    
    # 创建日志目录
    mkdir -p $LOG_DIR
    
    start_kibana() {
        if [ -f $PIDFILE ]; then
            echo "Kibana is already running with PID $(cat $PIDFILE)."
        else
            echo "Starting Kibana..."
            su - elastic -c "nohup $EXEC >> $LOG_FILE 2>&1 & echo \$! > $PIDFILE"
            echo "Kibana started with PID $(cat $PIDFILE)."
        fi
    
    }
    
    stop_kibana() {
        if [ -f $PIDFILE ]; then
            PID=$(cat $PIDFILE)
            echo "Stopping Kibana with PID $PID..."
            kill $PID
            # 等待Kibana进程结束
            sleep 10
        if pgrep -f $EXEC > /dev/null; then
            echo "Kibana could not be stopped gracefully, killing forcefully..."
            kill -9 $PID
            fi
            rm $PIDFILE
            echo "Kibana stopped."
        else
            echo "Kibana is not running."
        fi
    }
    
    case "$1" in
        start)
            start_kibana
            ;;
        stop)
            stop_kibana
            ;;
        restart|force-reload)
            stop_kibana
            sleep 3
            start_kibana
            ;;
        *)
        echo "Usage: $0 {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
    esac
    exit 0

    -启动

    # 启动服务
    service kibana start
    # 停止服务
    service kibana stop
    # 重启服务 
    service kibana restart
1. 本站所有资源来源于用户上传和网络,如有侵权请及时联系删除,本站不承担任何法律责任!
2. 分享目的仅供大家学习和研究,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的教程、源码等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"www.94zyw.com",如遇到无法解压的请联系管理员!
94资源网 » Linux 安装部署 Kibana 8.12.2