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 'a\fs.file-max=65536' /etc/sysctl.conf
sysctl -p
#修改环境变量
sed -i '$a\export NODE_HOME=/es5/esinstall/node-v6.9.1-l-linux-x64' /etc/profile
sed -i '$a\export 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\node.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系统服务注册成功"
es安装脚本的更多相关文章
- mysql 自动备份和nginx自动安装脚本
一.自动备份Mysql脚本: 如下脚本为mysql自动备份脚本,仅供参考,可以根据实际情况修改. #!/bin/sh #auto backup mysql #wugk #Define PATH定义变量 ...
- Linux安装脚本需要交互之如何实现自动安装
Linux中shell脚本运行时经常需要进行交互,比如安装软件的过程中对license声明的确认,需要输入yes,回车之类的确认信息.这个在自动化安装的时候就会是个问题. 通常对于这个问题比较灵活的解 ...
- iredmail安装脚本分析(一)---iRedmail.sh
iredmail是一套以postfix为核心的整合邮件系统的安装脚本,可以达到快速部署邮件服务器的目的.为了让自己不遗忘shell的语法,所以闲来无事,学习一下他的代码. 我从官网下载他的最新版,解压 ...
- CentOS 6、7下pptp vpn一键安装脚本
之前有折腾过<CentOS 6.7下IPSEC/L2TP VPN一键安装脚本>,不稳定.不支持IOS,因此换成pptp,并已经添加到<lnmp一键安装包>.这个脚本可以单独使用 ...
- 17.KVM安装之虚拟磁盘,安装脚本
1.创建磁盘 vm.list 指定虚拟磁盘名称和主机名 create_vm.sh #创建vm.list中的虚拟磁盘,并指定大小100G #!/bin/bash VM_DIR="/opt ...
- 一个比较完整的Inno Setup 安装脚本(转)
一个比较完整的Inno Setup 安装脚本,增加了对ini文件设置的功能,一个安装包常用的功能都具备了. [Setup] ; 注: AppId的值为单独标识该应用程序. ; 不要为其他安装程序使用相 ...
- windows 服务安装脚本拾遗
转自:http://blog.csdn.net/susubuhui/article/details/7881096 1.安装脚本 echo 请按任意键开始安装客户管理平台的后台服务 echo. pau ...
- Linux环境下JDK/Eclipse一键安装脚本
-------------------------------------------------------------------- author:jiangxin Email:jiangxinn ...
- 一个比较完整的Inno Setup 安装脚本
一个比较完整的Inno Setup 安装脚本,增加了对ini文件设置的功能,一个安装包常用的功能都具备了. [Setup] ; 注: AppId的值为单独标识该应用程序. ; 不要为其他安装程序使用相 ...
随机推荐
- Linked List Cycle I&&II——快慢指针(II还没有完全理解)
Linked List Cycle I Given a linked list, determine if it has a cycle in it. Follow up: Can you solve ...
- 怎么WordPress增加在线投稿功能
现在很多个人博客为了增加博客的内容,都会提供投稿通道,大部分都是以邮箱的形式进行投稿,不过这样一来,也很费人力,要拷贝复制,然后编辑等.如果给博客加个在线投稿功能,那就方便多了.稍微审核下文章内容就可 ...
- SpringMVC一些功能
1.日期格式转换 当页面提交日期格式时 默认的格式为2017/10/1 如果指定日期格式为2017-10-1 //初始化绑定日期格式--不定义初始化格式时只能默认用yyyy/MM/dd格式 @Init ...
- 计蒜客 A2232.程序设计:蒜厂年会-单调队列(双端队列(STL deque)实现)滑窗维护最小前缀和
程序设计:蒜厂年会 问答问题反馈 只看题面 16.79% 1000ms 262144K 在蒜厂年会上有一个抽奖,在一个环形的桌子上,有 nn 个纸团,每个纸团上写一个数字,表示你可以获得多少蒜币. ...
- 运行时候报异常could only be replicated to 0 nodes instead of minReplication (=1). There are 2 datanode(s) running and no node(s) are excluded in this operation.
运行时候报异常could only be replicated to 0 nodes instead of minReplication (=1). There are 2 datanode(s) ...
- SystemProperties cannot be resolved错误
单独用eclipse打开一个工程,出现SystemProperties.get()会出现SystemProperties cannot be resolved.错误 1. 引用SystemProper ...
- 从Windows复制文件到Linux显示乱码问题
(1).文件名乱码 这并不是所有人都会碰到的问题,一般常见于使用putty的用户.使用convmv命令可以解决这个问题. 我写详细一点还原真实场景,首先我来上传一个测试文件“a此文件在windows下 ...
- 【爬虫】python requests模拟登录知乎
需求:模拟登录知乎,因为知乎首页需要登录才可以查看,所以想爬知乎上的内容首先需要登录,那么问题来了,怎么用python进行模拟登录以及会遇到哪些问题? 前期准备: 环境:ubuntu,python2. ...
- Memory Allocation with COBOL
Generally, the use of a table/array (Static Memory) is most common in COBOL modules in an applicatio ...
- linux的bash和shell关系
shell通俗理解:把用户输入的命令翻译给操作系统. shell 是一个交互性命令解释器.shell独立于操作系统,这种设计让用户可以灵活选择适合自己的shell.shell让你在命令行键入命令,经过 ...