下載
1.下載地址:https://www.elastic.co/cn/start
複製下載鏈接
# 下載資源
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.0-linux-x86_64.tar.gz
# 解壓資源
tar -xf elasticsearch-7.3.0-linux-x86_64.tar.gz
運行
cd elasticsearch-7.3.0-linux-x86_64
# 顯示啓動elk
./bin/elasticsearch
# 後臺啓動
./bin/elasticsearch -d
其它配置
跨域配置
當使用elasticsearch-head插件訪問elk時,需要設置允許跨域訪問
vim config/elasticsearch.yml
# 新增如下內容
http.cors.enabled: true
http.cors.allow-origin: "*"
允許外部網絡(非本地)訪問9200端口
默認情況下,啓動elk服務後,其它服務器是無法訪問elk服務的(telnet不通),只允許本地訪問。
需要做如下配置:
vim config/elasticsearch.yml
# 新增如下內容
network.host: 0.0.0.0
http.port: 9200
此時,啓動會報如下兩個錯誤:
ERROR: [2] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
對於第一個配置,root用戶權限下,增加如下配置:
vi /etc/sysctl.conf
# 新增如下內容
vm.max_map_count=262144
sysctl -p
對於第二個錯誤,增加如下配置:
vim config/elasticsearch.yml
# 新增如下內容
cluster.initial_master_nodes: [“node-1”]