#把下面这个放到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. win7限制登录时间的设置方法

    win7使用Net User命令行语句限制登录时间的方法: 1.单击“开始”,然后单击“运行”. 2.在“打开”框中,键入cmd,然后单击“确定”. 3..键入 net user username / ...

  2. 原生JavaScript的省市县三级联动

    三级联动是我们写表单时必不可少的,比如在写收货地址时,就用到他了,最近在看原生JavaScript,从基础写起,待完善,以后再写个jquery版的. <!DOCTYPE html> < ...

  3. ODBC 中遇到的错误

    直接贴解决办法的链接: http://zhidao.baidu.com/link?url=pyd2AiazzsZr4IlMpiCdXlLC6nnao908xmqmY9QI0yj8vIGCbRPRrqh ...

  4. mac下versions 提交提示 SVN Working Copy xxx locked

    终端进入工程目录,执行 find . | grep ".svn/lock" | xargs rm

  5. 怎样在delphi中实现控件的拖拽

    下面这2种方法都能实现对控件和窗体的拖拽 方法1 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift ...

  6. [RxJS] Filtering operators: takeUntil, takeWhile

    take(), takeLast(), first(), last(), those opreators all take number or no param. takeUtil and takeW ...

  7. FastJson解析对象及对象数组--项目经验

    第一次使用json,解析工具为FastJson,使用语言为java 常见的json解析实例,以map为例: Map<String,String> map=new HashMap<St ...

  8. [转] 再叙TIME_WAIT

    http://huoding.com/2013/12/31/316 之所以起这样一个题目是因为很久以前我曾经写过一篇介绍TIME_WAIT的文章,不过当时基本属于浅尝辄止,并没深入说明问题的来龙去脉, ...

  9. 洛谷比赛 堕落的Joe

    /*暴力50*/ #include<iostream> #include<cstdio> #include<cstring> #define maxn 100010 ...

  10. WCF上传、下载、删除文件

    关键代码: --上传的stream处理,转为bytep[] private void Parse(Stream stream, Encoding encoding) { this.Success = ...