Skip to content

wangrui027/elasticsearch-install

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Elasticsearch安装指南

概述

本指南在CentOS7下安装elasticsearch-6.2.2版本,其他环境及版本未做测试。

安装jdk

yum install http://mirrors.gfstack.geo/Oracle/JAVA/8/8u162/linux/jdk-8u162-linux-x64.rpm

创建目录下载文件

elasticsearch-6.2.2.tar.gzelasticsearch-analysis-ik-6.2.2.zip可能存在下载速度慢的问题,可到项目的download目录下下载。

mkdir /elasticsearch
cd /elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.2/elasticsearch-analysis-ik-6.2.2.zip

安装unzip命令

yum install unzip

解压程序包

tar -xvf elasticsearch-6.2.2.tar.gz
unzip elasticsearch-analysis-ik-6.2.2.zip

创建ik目录,拷贝文件

mkdir elasticsearch-6.2.2/plugins/ik
mv elasticsearch/* elasticsearch-6.2.2/plugins/ik/

删除没用的目录和程序包

rm -rf elasticsearch elasticsearch-6.2.2.tar.gz elasticsearch-analysis-ik-6.2.2.zip

配置文件修改

vi /elasticsearch/elasticsearch-6.2.2/config/elasticsearch.yml

#cluster.name: my-application:放开注释,修改为自定义的集群名称

#node.name: node-1:放开注释,修改为自定义的节点名称

#network.host: 192.168.0.1:释放注释,修改为服务器的ip地址

vi /etc/security/limits.conf

添加如下内容:

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
vi /etc/sysctl.conf

添加如下内容:

vm.max_map_count=655360

并执行命令:

sysctl -p

关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

创建并配置用户

# 添加一个用户:elasticsearch
useradd elasticsearch
# 给用户elasticsearch设置密码,连续输入2次
passwd elasticsearch
# 创建一个用户组 es
groupadd es
# 分配 elasticsearch 到 es 组
usermod -G es elasticsearch
# 将/elasticsearch目录授权给elasticsearch用户
chown -R elasticsearch /elasticsearch

切换到elasticsearch用户并启动程序

su elasticsearch
cd /elasticsearch/elasticsearch-6.2.2/bin/
./elasticsearch

或者加-d参数后台启动

./elasticsearch -d

参考链接

https://www.sojson.com/blog/81.html

https://blog.csdn.net/qq_33363618/article/details/78882827

About

elasticsearch安装指南,看这篇就够了

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published