elasticsearch安装

1.解压elasticsearch

tar -avxf elasticsearch-7.1.1-linux-x86_64.tar.gz -C /usr/local/
mkdir /usr/local/elasticsearch-7.1.1/data

2.修改elasticsearch配置 vim /usr/local/elasticsearch-7.1.1/config/elasticsearch.yml

cluster.name: my-application #集群名称
node.name: node-1 #节点名称
#数据和日志的存储目录
path.data: /usr/local/elasticsearch-7.1.1/data
path.logs: /usr/local/elasticsearch-7.1.1/logs
#设置绑定的ip,设置为0.0.0.0以后就可以让任何计算机节点访问到了
network.host: 0.0.0.0
http.port: 9200 #端口
#设置在集群中的所有节点名称,这个节点名称就是之前所修改的,当然你也可以采用默认的也行,目前是单机,放入一个节点即可
cluster.initial_master_nodes: ["node-1"]
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"

3.修改jvm配置 vim /usr/local/elasticsearch-7.1.1/config/jvm.options

-Xms200m
-Xmx200m

4.启动

# 1.新建用户
adduser es
passwd es

#2.修改elasticsearch目录所属用户
chown es /usr/local/elasticsearch-7.1.1/ -R

#3.vim /etc/security/limits.conf,在末尾加上
es soft nofile 65536
es hard nofile 65536
es soft nproc 4096
es hard nproc 4096

#4.vim vim /etc/security/limits.d/20-nproc.conf,将* 改为用户名es

#5.vim  /etc/sysctl.conf,在末尾加上:
vm.max_map_count = 655360

#6.执行
sysctl -p

#7.
su es
./usr/local/elasticsearch-7.1.1/bin/elasticsearch
原文地址:https://www.cnblogs.com/konglingxi/p/12992041.html