#把下面这个放到es的server路径下,这个是rpm安装改了下。

#
# init.d / servicectl compatibility (openSUSE)
#
if [ -f /etc/rc.status ]; then
. /etc/rc.status
rc_reset
fi #
# Source function library.
#
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi # Sets the default values for elasticsearch variables used in this script
ES_USER="elasticsearch"
ES_GROUP="elasticsearch"
ES_HOME="/opt/elasticsearch/"
LOG_DIR="/opt/elasticsearch/logs"
DATA_DIR="/opt/elasticsearch/data"
CONF_DIR="/opt/elasticsearch/config" PID_DIR="/opt/elasticsearch/run/" MAX_OPEN_FILES=
MAX_MAP_COUNT=
ES_HEAP_SIZE=20g
MAX_LOCKED_MEMORY=unlimited
ES_GC_LOG_FILE="/opt/elasticsearch/run/gc.log" # Source the default env file
ES_ENV_FILE="/opt/elasticsearch/config/elasticsearch.config"
if [ -f "$ES_ENV_FILE" ]; then
. "$ES_ENV_FILE"
fi # CONF_FILE setting was removed
if [ ! -z "$CONF_FILE" ]; then
echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed."
exit
fi exec="$ES_HOME/bin/elasticsearch"
prog="elasticsearch"
pidfile="$PID_DIR/${prog}.pid" export ES_HEAP_SIZE
export ES_HEAP_NEWSIZE
export ES_DIRECT_SIZE
export ES_JAVA_OPTS
export ES_GC_LOG_FILE
export ES_STARTUP_SLEEP_TIME
export JAVA_HOME lockfile=/var/lock/subsys/$prog # backwards compatibility for old config sysconfig files, pre 0.90.1
if [ -n $USER ] && [ -z $ES_USER ] ; then
ES_USER=$USER
fi checkJava() {
if [ -x "$JAVA_HOME/bin/java" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA=`which java`
fi if [ ! -x "$JAVA" ]; then
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
exit
fi
} start() {
checkJava
[ -x $exec ] || exit
if [ -n "$MAX_LOCKED_MEMORY" -a -z "$ES_HEAP_SIZE" ]; then
echo "MAX_LOCKED_MEMORY is set - ES_HEAP_SIZE must also be set"
return
fi
if [ -n "$MAX_OPEN_FILES" ]; then
ulimit -n $MAX_OPEN_FILES
fi
if [ -n "$MAX_LOCKED_MEMORY" ]; then
ulimit -l $MAX_LOCKED_MEMORY
fi
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
fi
export ES_GC_LOG_FILE # Ensure that the PID_DIR exists (it is cleaned at OS startup time)
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
mkdir -p "$PID_DIR" && chown "$ES_USER":"$ES_GROUP" "$PID_DIR"
fi
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
touch "$pidfile" && chown "$ES_USER":"$ES_GROUP" "$pidfile"
fi cd $ES_HOME
echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.conf=$CONF_DIR
retval=$?
echo
[ $retval -eq ] && touch $lockfile
return $retval
} stop() {
echo -n $"Stopping $prog: "
# stop it here, often "killproc $prog"
killproc -p $pidfile -d $prog
retval=$?
echo
[ $retval -eq ] && rm -f $lockfile
return $retval
} restart() {
stop
start
} reload() {
restart
} force_reload() {
restart
} rh_status() {
# run checks to determine if the service is running or use generic status
status -p $pidfile $prog
} rh_status_q() {
rh_status >/dev/null >&
} case "$1" in
start)
rh_status_q && exit
$
;;
stop)
rh_status_q || exit
$
;;
restart)
$
;;
reload)
rh_status_q || exit
$
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit
esac
exit $?

改下其中/opt/elasticsearch/部分和

MAX_OPEN_FILES=65535
MAX_MAP_COUNT=262144

#主要这个es持有的内存
ES_HEAP_SIZE=20g

#在root下,顺序执行下面

ln -s /opt/elasticsearch/server/elasticsearch /etc/init.d/elasticsearch

groupadd elasticsearch
useradd elasticsearch -g elasticsearch -p elasticsearch chmod +x /opt/elasticsearch/bin/elasticsearch
chmod +x /opt/elasticsearch/server/elasticsearch
chown -R elasticsearch:elasticsearch /opt/elasticsearch
chown -R root:elasticsearch /opt/elasticsearch
chkconfig --add elasticsearch
chkconfig elasticsearch on
service elasticsearch restart

#启动起来么。就ok 不然么就去logs下看日志。

#sshfs 备份的问题 ,请在elasticsearch用户下执行挂载硬盘命令和创建备份路径命令。嘿嘿。我开始弄几次都挂不上。

su elasticsearch
#这里可以再配置文件里面多弄几个备份路径,省得后面重启的啰嗦
mkdir /opt/elasticsearch/hdisk/bak1
mkdir /opt/elasticsearch/hdisk/bak2
mkdir /opt/elasticsearch/hdisk/bak3
sshfs root@备份服务器ip:/opt/hdisk/dbbak1/ /opt/elasticsearch/hdisk/bak1
sshfs root@备份服务器ip:/opt/hdisk/dbbak2/ /opt/elasticsearch/hdisk/bak2
sshfs root@备份服务器ip:/opt/hdisk/dbbak3/ /opt/elasticsearch/hdisk/bak3

centos es2.x安装的更多相关文章

  1. MonoDevelop 4.2.2/Mono 3.4.0 in CentOS 6.5 安装笔记

    MonoDevelop 4.2.2/Mono 3.4.0 in CentOS 6.5 安装笔记 说明 以root账户登录Linux操作系统,注意:本文中的所有命令行前面的 #> 表示命令行提示符 ...

  2. Centos、Ubuntu 安装 Mono、Jexus

    Mono是.NET的跨平台实现 在众多关于语言的争论中,.NET一直被以不能跨平台而诟病,Mono改变了这一现状. 有人当心Mono会涉及版权啥的问题.高深的偶不懂,不过我觉得Unity3D都能用,为 ...

  3. Centos 7.0 安装Mono 3.4 和 Jexus 5.6

    2013-07-26 写过一篇<CentOS 6.3下 安装 Mono 3.2 和Jexus 5.4>,CentOS 7在CentOS 6的基础上有很大的调整,本文是这篇文章的更新,主要介 ...

  4. 环境搭建系列-系统安装之centos 6.5安装与配置

    按照国际惯例,系列目录先奉上: 系列一:系统安装之centos 6.5安装与配置 系列二:准备工作之Java环境安装 系列三:数据为先之MySQL读写集群搭建 系列四:谈分布式之RabbitMQ集群搭 ...

  5. 在CentOS 7上安装.NET Core R2跑Hello World

    前言 在上个月.NET Core出了最新版本预览版,只是在Window系统上试验了一下.原本想等发布正式版的时候在linux系统上试试,可能还需要一段时间,刚好有空可以折腾一下. 由于之前安装的Ubu ...

  6. CentOS 6/7安装ffmpeg

    环境 CentOS 6/7 安装 导入GPG key rpm --import http://packages.atrpms.net/RPM-GPG-KEY.atrpms 安装ATRPMS Repo ...

  7. CentOS 7.0安装配置Vsftp服务器

    一.配置防火墙,开启FTP服务器需要的端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...

  8. centos下编译安装lnmp

    centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...

  9. CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)

    准备篇: CentOS 6.6系统安装配置图解教程 http://www.osyunwei.com/archives/8398.html 1.配置防火墙,开启80端口.3306端口 vi /etc/s ...

随机推荐

  1. liststack——链表栈(procedure)

    #include <stdio.h> #include <stdlib.h> #include <string.h> #include "list.h&q ...

  2. 390. Elimination Game

    正规解法直接跳到代码上面一点的部分就可以了.但我想记录下自己的思考和尝试过程,希望二刷能看到问题所在. 找规律的时候写了好多,虽然规律很简单. 只要随便写3以上的例子,就应该发现,相邻的2个最后结果是 ...

  3. kafka consumer频繁reblance

    转载请注明地址http://www.cnblogs.com/dongxiao-yang/p/5417956.html 结论与下文相同,kafka不同topic的consumer如果用的groupid名 ...

  4. winform 读取TXT文件 放在Label中 分类: WinForm 2014-07-31 09:56 310人阅读 评论(0) 收藏

    <span style="font-family: Arial, Helvetica, sans-serif;">#region 读取TXT 文件,放到Label中&l ...

  5. 【Android - MD】之TabLayout的使用

    TabLayout是Android 5.0新特性--Material Design中的一个控件,是一个标签页的导航条,常结合ViewPager完成页面导航. 和其他MD控件一样,使用TabLayout ...

  6. AnonymousType匿名类型和对象之间的转换

    本文转载:http://www.cnblogs.com/dean-Wei/p/3150553.html 一.匿名对象转换为对象. 1.问题: 2.解决方案:强制指定类型. 解决之. 二. 对象转换为匿 ...

  7. css 权威指南笔记(三)结合css和XHTML

    link rel stylesheet alternate stylesheet(候选样式表) title type media all screen print ..... 内联样式

  8. 快速记忆JavaScript中exec和match的使用

    JS模式匹配中exec,match用得非常多,所以掌握其用法对我们进行字符串的处理帮助非常大 1.exec的定义其用法        exec与match主要的不同是,exec是正则表达式里面的方法. ...

  9. 17、SQL Server 备份和还原

    SQL Server 备份 恢复模式 SQL Server 数据恢复模式分为三种:完整恢复模式.大容量日志恢复模式.简单恢复模式. 完整恢复模式 默认的恢复模式,它会完整记录下操作数据库的每一个步骤, ...

  10. HTML5 <Audio>标签API整理(一)

    简单实例: <audio id="myAudio"></audio> <script> var myAudio = document.getEl ...