ELK实时日志分析平台5.0版本源码安装配置(4)

# vim /etc/init.d/kibana

#!/bin/sh# Init script for kibana # Maintained by  # Generated by pleaserun. # Implemented based on LSB Core 3.1: #   * Sections: 20.2, 20.3# ### BEGIN INIT INFO # Provides:          kibana # Required-Start:    $remote_fs $syslog # Required-Stop:     $remote_fs $syslog # Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description:  # Description:       Kibana ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin export PATH KIBANA_HOME=/data/PRG/kibana name=kibana program=$KIBANA_HOME/bin/kibana args=''pidfile="$KIBANA_HOME/logs/$name.pid"LOG_HOME="$KIBANA_HOME/logs"[ -r /etc/default/$name ] && . /etc/default/$name [ -r /etc/sysconfig/$name ] && . /etc/sysconfig/$name [ -z "$nice" ] && nice=0trace() {   logger -t "/etc/init.d/kibana" "$@"} emit() {   trace "$@"   echo "$@"} start() {   # Ensure the log directory is setup correctly.   [ ! -d "$LOG_HOME" ] && mkdir "$LOG_HOME"   chmod 755 "$LOG_HOME"   # Setup any environmental stuff beforehand     # Run the program!     #chroot --userspec "$user":"$group" "$chroot" sh -c "      $program $args >> $LOG_HOME/kibana.stdout 2>> $LOG_HOME/kibana.stderr &   # Generate the pidfile from here. If we instead made the forked process   # generate it there will be a race condition between the pidfile writing   # and a process possibly asking for status.  echo $! > $pidfile   emit "$name started"   return 0} stop() {   # Try a few times to kill TERM the program  if status ; thenpid=$(cat "$pidfile")echo "Killing $name (pid $pid) with SIGTERM"ps -ef |grep $pid |grep -v 'grep' |awk '{print $2}' | xargs kill -9# Wait for it to exit.for i in 1 2 3 4 5 ; do  trace "Waiting $name (pid $pid) to die..."  status || break      sleep 1doneif status ; then  if [ "$KILL_ON_STOP_TIMEOUT" -eq 1 ] ; thentrace "Timeout reached. Killing $name (pid $pid) with SIGKILL.  This may result in data loss."kill -KILL $pid         emit "$name killed with SIGKILL."  elseemit "$name stop failed; still running."  fielse  emit "$name stopped."fi   fi} status() {  if [ -f "$pidfile" ] ; thenpid=$(cat "$pidfile")if ps -p $pid > /dev/null 2> /dev/null ; then  # process by this pid is running.       # It may not be our pid, but that's what you get with just pidfiles.  # TODO(sissel): Check if this process seems to be the same as the one we       # expect. It'd be nice to use flock here, but flock uses fork, not exec,  # so it makes it quite awkward to use in this case.       return 0else  return 2 # program is dead but pid file existsfi   elsereturn 3 # program is not running  fi}case "$1" in   force-start|start|stop|status|restart)     trace "Attempting '$1' on kibana";;esaccase "$1" in   force-start)     PRESTART=no     exec "$0" start     ;;   start)     status     code=$?if [ $code -eq 0 ]; then  emit "$name is already running"  exit $codeelse  start       exit $?fi;;   stop) stop ;;   status)     status     code=$?if [ $code -eq 0 ] ; then  emit "$name is running"else  emit "$name is not running"fiexit $code     ;;   restart)         stop && start     ;;  *)echo "Usage: $SCRIPTNAME {start|force-start|stop|force-start|force-stop|status|restart}" >&2exit 3   ;;esacexit $? # chmod +x /etc/init.d/kibana # /etc/init.d/kibana start  # /etc/init.d/kibana status # netstat -ntlp |grep 5601tcp 0 0 0.0.0.0:5601 0.0.0.0:* LISTEN 13052/node 七、 配置kibana # cat /data/PRG/kibana/config/kibana.yml |grep -v '#'server.host: "0.0.0.0"####以下模块视情况是否开启 xpack.security.enabled: truexpack.monitoring.enabled: truexpack.graph.enabled: truexpack.reporting.enabled: true 八、 安装x-pack插件 # /data/PRG/kibana/bin/kibana-plugin install file:///root/x-pack-5.0.0.zip# /data/PRG/elasticsearch/bin/elasticsearch-plugin install file:///root/x-pack-5.0.0.zip

离线安装x-pack要修改用户脚本,默认创建用户配置文件在/etc/elasticsearch/x-pack目录

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/b2b2ac98322b48de71d40b49f024598e.html