/article/2019/08/28/elastic-es-install/
Elasticsearch的安装简介
- 【分类】Service
- 【发布】2019-08-28 21:23
- 【更新】2019-08-28 21:23
elasticsearch 安装启动
官方elasticsearch下载页: https://www.elastic.co/downloads/elasticsearch
elasticsearch 安装
elasticsearch安装需要的环境
- es2.0使用jdk1.7以上版本。
- es5.0以上推荐使用最新的jdk1.8版本。
- es7.0以上版本可以使用es自带的jdk版本。
安装elasticsearch
安装说明
- 新建elasticsearch用户
- 解压安装包
- 移动到安装目录
- 修改配置文件
- 配置es的数据data目录和日志logs目录
- bootstrap启动检查
- 使用elasticsearch用户启动es
命令参考
ESVERSION=5.2.2 ESVERSION=6.8.2 ESVERSION=7.2.1 ESVERSION=7.3.1 #INSTALLPATH= wget -O elasticsearch-${ESVERSION?unkown?}-linux-x86_64.tar.gz https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ESVERSION?unkown?}-linux-x86_64.tar.gz if [ $? -eq 0 ];then DOWNLOAD_NAME=elasticsearch-${ESVERSION?unkown?}-linux-x86_64.tar.gz else wget -O elasticsearch-${ESVERSION?unknown}.tar.gz https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ESVERSION?unknown}.tar.gz [ $? -eq 0 ] && DOWNLOAD_NAME=elasticsearch-${ESVERSION?unknown}.tar.gz fi INSTALLPATH=${INSTALLPATH:-/usr/local} tar -zxvf ${DOWNLOAD_NAME?unknown?} -C ${INSTALLPATH?unkown?} groupadd -g 430 elasticsearch useradd -u 430 -g 430 elasticsearch chown -R elasticsearch:elasticsearch ${INSTALLPATH?unkown?}/elasticsearch-${ESVERSION?unkown?} ln -s elasticsearch-${ESVERSION?unkown?} ${INSTALLPATH?unkown?}/elasticsearch mkdir -p /data/elasticsearch/logs/ #mkdir -p /data/elasticsearch/data/ #mkdir -p /data/elasticsearch/tmp/ chown -R elasticsearch:elasticsearch /data/elasticsearch chmod 700 /data/elasticsearch
elasticsearch配置文件
elasticsearch使用的配置文件是config目录下的elasticsearch.yml
Bootstrap Checks
https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
elasticsearch 简单启停
# 启动es守护进程 sudo -u elasticsearch -i /usr/local/elasticsearch/bin/elasticsearch -p /tmp/elasticsearch.pid -d # es7.0以上版本启动es守护进程 sudo -u elasticsearch JAVA_HOME=/usr/local/elasticsearch/jdk /usr/local/elasticsearch/bin/elasticsearch -p /tmp/elasticsearch.pid -d # 停止命令示例: ps -ef|grep elastic |awk '{print $2}' |xargs kill && echo "kill es successfull."