새 버전elasticsearch 시작 시 jdk1.8 버전 지정

6963 단어 elasticsearch

배경


내 컴퓨터 환경의 jdk는 1.7이고 필요한 버전은 1.8이다.따라서elasticsearch에 jdk1.8을 지정해야 합니다. (jdk1.8을 환경 변수에 설정할 필요가 없습니다.)

1. 다운로드

  • 1, jdk: jdk1.8 다운로드를 클릭하십시오
  • 2
    tar -xvf xxx1.8.tar.gz

  • 2. 구성

  • 1,elasticsearch 시작 스크립트를 수정하여elasticsearchHOME/bin/elasticsearch 편집을 엽니다
  • [root]# vim bin/elasticsearch
    #  
    export JAVA_HOME=/home/hiekay/jdk1.8.0_181/      ( 1.8export PATH=$JAVA_HOME/bin:$PATH
    
    if [ -x "$JAVA_HOME/bin/java" ]; then
            JAVA="/home/yutao/jdk1.8.0_121/bin/java"
    else
            JAVA=`which java`
    fi

    전체 구성 파일
    #!/bin/bash
    
    # CONTROLLING STARTUP:
    #
    # This script relies on a few environment variables to determine startup
    # behavior, those variables are:
    #
    #   ES_PATH_CONF -- Path to config directory
    #   ES_JAVA_OPTS -- External Java Opts on top of the defaults set
    #
    # Optionally, exact memory values can be set using the `ES_JAVA_OPTS`. Note that
    # the Xms and Xmx lines in the JVM options file must be commented out. Example
    # values are "512m", and "10g".
    #
    #   ES_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/elasticsearch
    # jdk1.8
    export JAVA_HOME=/home/hiekay/jdk1.8.0_181/
    export PATH=$JAVA_HOME/bin:$PATH
    
    source "`dirname "$0"`"/elasticsearch-env
    
    ES_JVM_OPTIONS="$ES_PATH_CONF"/jvm.options
    JVM_OPTIONS=`"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.JvmOptionsParser "$ES_JVM_OPTIONS"`
    ES_JAVA_OPTS="${JVM_OPTIONS//\$\{ES_TMPDIR\}/$ES_TMPDIR} $ES_JAVA_OPTS"
    
    # jdk 
    if [ -x "$JAVA_HOME/bin/java" ]; then
            JAVA="/home/hiekay/jdk1.8.0_181/bin/java"
    else
            JAVA=`which java`
    fi
    
    cd "$ES_HOME"
    # manual parsing to find out, if process should be detached
    if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' > /dev/null; then
      exec \
        "$JAVA" \
        $ES_JAVA_OPTS \
        -Des.path.home="$ES_HOME" \
        -Des.path.conf="$ES_PATH_CONF" \
        -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
        -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
        -cp "$ES_CLASSPATH" \
        org.elasticsearch.bootstrap.Elasticsearch \
        "$@"
    else
      exec \
        "$JAVA" \
        $ES_JAVA_OPTS \
        -Des.path.home="$ES_HOME" \
        -Des.path.conf="$ES_PATH_CONF" \
        -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
        -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
        -cp "$ES_CLASSPATH" \
        org.elasticsearch.bootstrap.Elasticsearch \
        "$@" \
        $retval -eq 0 ] || exit $retval
      if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then
        sleep $ES_STARTUP_SLEEP_TIME
      fi
      if ! ps -p $pid > /dev/null ; then
        exit 1
      fi
      exit 0
    fi
    
    exit $?

    좋은 웹페이지 즐겨찾기