1、先修改系统配置
vi /etc/sysctl.conf
vm.max_map_count=262144
vi /etc/security/limits.conf
* soft nproc 65536 * hard nproc 65536 * soft nofile 65536 * hard nofile 65536
vi /etc/security/limits.d/20-nproc.conf
* soft nproc 65536
重启一下系统
2、安装
tar zxvf elasticsearch-7.8.0-linux-x86_64.tar.gz
mv elasticsearch-7.8.0 elasticsearch
adduser elasticsearch
echo elasticsearch | passwd --stdin elasticsearch
chown -R elasticsearch /usr/local/elasticsearch
3、修改配置文件
vi /usr/local/elasticsearch/config/elasticsearch.yml (主要修改或增加如下配置)
cluster.name: my-application node.name: node-1 network.host: 0.0.0.0 http.port: 9200 discovery.seed_hosts: ["127.0.0.1", "[::1]"] cluster.initial_master_nodes: ["node-1"] http.cors.allow-origin: "*" http.cors.enabled: true http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization http.cors.allow-credentials: true
4、启动
su elasticsearch -l -c "/usr/local/elasticsearch/bin/elasticsearch" #调试启动