环境
服务器环境linux7 java环境jdk1.8
下载
解压
解压elasticsearch-7.1.1-linux-x86_64.tar.gz到/usr/local/目录:
tar -avxf elasticsearch-7.1.1-linux-x86_64.tar.gz -C /usr/local/
进入目录elasticsearch
- 新建data目录:
mkdir data
- 修改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"]`
修改 ./config/jvm.options
直接添加 :vim config/jvm.options
-Xms200m-Xmx200m
添加用户 root用户无法直接启动
添加Esuser用户
useradd Esuser
修改所属组
chown Esuser /usr/local/elasticsearch-7.1.1/ -R
修改配置
- 修改sysctl文件:vi /etc/sysctl.conf ,增加下面配置项
vm.max_map_count=655360
- 查看 sysctl -p 还需要配置 编辑/etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 65565
* hard nproc 65565
启动
/usr/local/elasticsearch-7.1.1/bin/elasticsearch -d
验证
curl 'http://192.168.11.203:9200'