文章目录
Linux版本CentOS 7
一. 下载Elasticsearch
官方版本: [https://www.elastic.co/cn/downloads/past-releases#elasticsearch](https://www.elastic.co/cn/downloads/past-releases#elasticsearch)
二. 解压Elasticsearch到 /usr/local/ 目录下
tar -avxf elasticsearch.tar.gz -C /usr/local/
三. 解压后进入elasticsearch
1. 创建一个 data 目录
mkdir data
2.修改 elasticsearch/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”]
#增加参数,使head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: “*”
完成后保存退出 wq!
四.添加一个 es 用户启动 elasticsearch
elasticsearch 为了安全不能用root用户启动
adduser es
passwd es
(再输入新的密码和确认密码)
改一下es目录所属用户:
chown es /usr/local/elasticsearch-7.1.1/ -R
vim 编辑 /etc/security/limits.conf,在末尾加上
es soft nofile 65536
es hard nofile 65536
es soft nproc 4096
es hard
nproc 4096
vim 编辑 vim /etc/security/limits.d/20-nproc.conf,将 * 改为用户名 es
es soft nproc 4096
root soft nproc unlimited
vim 编辑 /etc/sysctl.conf,在末尾加上
vm.max_map_count = 655360
执行 sysctl -p:\
[root@localhost ~]# sysctl -p
vm.max_map_count = 655360
到此 Elasticsearch的安装就算完成了
上述内容根据 https://blog.csdn.net/luo1544943710/article/details/93196147所写,
如果侵权请告知