1.第一步
查看系统中是否安装jdk1.8版本
2.下载
进行elasticsearch6.2.2下载: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
3、解压elasticsearch
#创建目录,存放es安装位置 mkdir /server/elasticsearch 解压elasticsearch安装包
tar -xvf elasticsearch-6.2.2.tar.gz -C /server/elasticsearch
4、创建软连接
# 创建应用程序软链接的目录
mkdir -p /server/es/
# 创建Elasticsearch根目录的软链接
ln -s /server/elasticsearch/elasticsearch-6.2.2/ /server/es/elasticsearch
5、创建用户组合用户(elasticsearch5.x以上版本不能用root用户启动)
#创建用户组
groupadd hgzx-credit
##创建用户hgzx-es
指定到hgzx-credit用户组 并设置用户hgzx的密码为hgzx-es
useradd hgzx-es -g hgzx-credit-p hgzx-es
查看是否创建成功
id hgzx-es
# 先切换到Elasticsearch根目录
cd /server/es/elasticsearch #
更改目录及文件权限
chown -R hgzx-es:hgzx-credit .
rm -f bin/*.bat #删除.bat结尾的文件
chmod u+x bin/* #执行脚本添加可执行权限
6.修改相关配置
1. 修改limits.conf配置文件(修改用户最大可创建文件数) vim /etc/security/limits.conf # 添加如下内容 * soft nofile 65536 * hard nofile 1048576 * soft nproc 65536 * hard nproc unlimited * soft memlock unlimited * hard memlock unlimited vim /etc/security/limits.d/90-nproc.conf # 修改成4096或者更大 * soft nproc 4096 root soft nproc unlimited vim /etc/sysctl.conf # 尾部添加下面的配置 vm.max_map_count=655360 # 然后执行命令 sysctl -p
7、编辑elasticsearch.yml文件
cd /server/elasticsearch/node-1/config/
vi elasticsearch.yml
##集群名称
cluster.name: credit-es
##节点名称
node.name: node-1
##网络监听地址
network.host: 0.0.0.0
http.port: 9200
##使用head等插件监控集群信息,需要打开以下配置项
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-credentials: true
# Centos6不支持SecComp,
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
Bootstrap.memory_lock和bootstrap.system_call_filter默认为true而Centos6不支持SecComp,而Elasticsearch默认bootstrap.system_call_filter为true进行检测 会导致失败
8、从root用户切换到hgzx-es用户,
bin/elasticsearch -d(-d是后台启动)