1. 下载并解压
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.0.tar.gz
2. 更改网络配置,让外网可以访问(vi /home/elasticsearch-6.3.0/config/elasticsearch.yml)
network.host: 0.0.0.0
3. 更改系统配置,通过Elastic启动检查
1)修改 max virtual memory,添加(vi /etc/sysctl.conf,完成后执行sysctl -p)
vm.max_map_count=262144
2)修改 max file descriptors,添加(vi /etc/security/limits.conf)
* hard nofile 65536
* soft nofile 65536
* soft nofile 65536
4. 运行(必须以非root用户运行)
1)创建elasticsearch用户并附权限
useradd -g root -G root elasticsearch
passwd elasticsearch
chown -R elasticsearch /home/elasticsearch-6.3.0
passwd elasticsearch
chown -R elasticsearch /home/elasticsearch-6.3.0
2)切换到elasticsearch用户并运行(cd /home/elasticsearch-6.3.0/bin)
su elasticsearch
./elasticsearch -d(在后台运行)
3)查看启动日志
tail -10f ../logs/elasticsearch.log
5. 外网访问验证(如果是阿里云需要在控制台放开9200端口)
http://xxx:9200/
tips: 可以通过安装elasticsearch-head的Chrome插件来访问elasticsearch
6. 关闭(ps -ef | grep elasticsearch)
kill pid