zoukankan      html  css  js  c++  java
  • es安装脚本

    #!/bin/bash

    file_name="/sdzw/es5/conf/es.config"

    #安装目录

    install_dir="/es5/esinstall"

    #es数据目录

    es_dir="/data/es5data"

    network_host=`cat ${file_name} | grep network_host` 

    network_host=${network_host#*=} 

    #节点名

    node_name=""$network_host""

    hosts=`cat ${file_name} | grep hosts`

    hosts=${hostst#*=} 

    if[ $1 ]

    then

    jvm_options=$1

    else

    jvm_options="8g"

    fi

    jarpath="/es5/source"

    mkdir_cmd="mkdir -p ${install_dir}" 

    sed -i 'afs.file-max=65536'   /etc/sysctl.conf 

    sysctl -p

    #修改环境变量

    sed -i '$aexport NODE_HOME=/es5/esinstall/node-v6.9.1-l-linux-x64'  /etc/profile

    sed -i '$aexport PATH=$PATH:$NODE_HOME/bin'   /etc/profile

    source /etc/profile

    userdel es5

    adduser es5

    if [ -f ${es_dir} ]

    then

    echo "数据目录已存在"

    else

    mkdir -p ${es_dir}

    fi

    chmod 777 /data/es5data

    if [ -f ${install_dir} ]

    then

    echo "安装目录已存在"

    else

    mkdir_cmd

    fi

    chmod es5:es5 -R ${install_dir}

    tar -xzvf ${jarpath}/elasticsearch-5.4.0.tar.gz -C  ${install_dir}

    tar -xzvf ${jarpath}/eshead.tar.gz -C  ${install_dir}

    tar -xzvf ${jarpath}/node.tar.gz -C  ${install_dir}

    chown es5:es5 -R {install_dir}/elasticsearch-5.4.0

    chown es5:es5 -R {install_dir}/elasticsearch-head

    chown es5:es5 -R {install_dir}/node-v6.9.1-linux-x64

    #修改配置文件

    sed -i "/#node.name: node-1/a ode.name: ${node_name}" ${install_dir}/elasticsearch-5.4.0/config/elasticsearch.yml  

    sed -i "s/-Xms2g/-Xms${ jvm_options}/g"  ${install_dir}/elasticsearch-5.4.0/config/jvm.options 

    sed -i "s/-Xmx2g/-Xmx${ jvm_options}/g"  ${install_dir}/elasticsearch-5.4.0/config/jvm.options 

    cat >> ${install_dir}/elasticsearch-5.4.0/config/elasticsearch.yml

    discovery.zen.ping.unicast.hosts: ${hosts}

    network.host: ${network_host}

    EOF

    echo '注册系统服务'

    cp -af /es5/conf/esserver /etc/init.d/esserver

    chmod +x /etc/init.d/esserver

    chkconfig_list=`chkconfig --list 2>&1`

    if echo "$chkconfig_list" | grep -q "esserver" ; then

    chkconfig --del esserver

    fi

    chkconfig --add esserver

    echo "启动es"

    su es5 -c "nohup /es5/esinstall/elasticsearch-5.4.0/bin/elasticsearch >> /dev/null &"

    echo "es系统服务注册成功"

  • 相关阅读:
    音频(一)_音频认知(1.音频释义)
    音频_写在前面的话
    SignInWithAppleId(Apple登录接入)_unity篇
    编程工具~用了都说好的快捷键大杂烩
    Unity的PlayerPrefs存储路径
    unity如何判断应用的运行平台
    Unity资源加载机制www的坑
    VSCode快捷键
    MD5加密字符串并转化为base64(C#和PHP代码相同实现)
    转载:关于 Google Chrome 中的全屏模式和 APP 模式
  • 原文地址:https://www.cnblogs.com/nicebaby/p/8066363.html
Copyright © 2011-2022 走看看