ELK 관련 시작 스크립트

3180 단어
elasticsearch 시작 스크립트
#!/bin/bash
# Description:Elasticsearch ORS SERVER
ES_HOME=/usr/local/elasticsearch-5.0.0
PID=$(jps | grep Elasticsearch | awk '{print $1}')
ES_STOP=$ES_HOME/bin/shutdown.sh
ES_START=$ES_HOME/bin/startup.sh

#Necessary environment variables
ES_USER=hadoop

case $1 in
        start)
        if [ -n "$PID" ]
        then
            echo "elasticsearch process is already running."
        else
        echo -n "Starting elasticsearch Server..."
        /bin/su - $ES_USER -s /bin/bash -c $ES_START
        echo " done"
        fi
        ;;
        stop)
        if [ -z "$PID" ]
        then
                echo "elasticsearch process is not running."
        else
                echo -n "Stopping elasticsearch Server..."
        /bin/su - $ES_USER -s /bin/bash -c $ES_STOP
        echo " done"
        fi
        ;;
        restart)
        $0 stop
        $0 start
        ;;
        *)
        echo "Usage: service $0 {start|stop|restart}" >&2
        exit 1
esac

elasticsearch 관련 하위 스크립트
cat > /usr/local/elasticsearch-5.0.0/bin/shutdown.sh < /dev/null 2>&1
fi
EOF
cat > /usr/local/elasticsearch-5.0.0/bin/startup.sh < 
    


kibana

#!/bin/bash
# Description:kibana ORS SERVER
KB_HOME=/usr/local/kibana-5.0.0-linux-x86_64
PID=$(ps -ef|grep node|grep -v grep|awk '{print $2}')
KB_LOG="/data/kibana_logs"
KB_START=$KB_HOME/bin/startup.sh
KB_STOP=$KB_HOME/bin/shutdown.sh
#Necessary environment variables
KB_USER=hadoop
KB_GROUP=hadoop

[ ! -d "$KB_LOG" ] && mkdir "$KB_LOG"
chown -R "$KB_USER":"$KB_GROUP" "$KB_LOG"
chmod 755 "$KB_LOG"

case $1 in
        start)
        if [ -n "$PID" ]
        then
            echo "Kibana process is already running."
        else
        echo -n "Starting Kibana Server..."
        /bin/su - $KB_USER -s /bin/bash -c $KB_START
        echo " done"
        fi
        ;;
        stop)
        if [ -z "$PID" ]
        then
                echo "Kibana process is not running."
        else
                echo "Stopping Kibana Server..."
        /bin/su - $KB_USER -s /bin/bash -c $KB_STOP
                echo "Kibana Server has been stopped."
        fi
        ;;
        restart)
        $0 stop
        $0 start
        ;;
        *)
        echo "Usage: service $0 {start|stop|restart}" >&2
        exit 1
esac

kibana 관련 하위 스크립트
cat >/usr/local/kibana-5.0.0-linux-x86_64/bin/startup.sh<> /data/kibana_logs/kibana.stdout 2>> /data/kibana_logs/kibana.stderr &
EOF
cat >/usr/local/kibana-5.0.0-linux-x86_64/bin/shutdown.sh< 
    



다음으로 전송:https://blog.51cto.com/jinyan2049/1914597

좋은 웹페이지 즐겨찾기