前置條件
Elasticsearch需要依賴JDK環境,必須先安裝JDK。此處使用JDK1.8
下載及啓動
從 https://www.elastic.co/downloads/elasticsearch 下載最新穩定的ES。當前下載的版本是7.2.0。
# 下載
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0-linux-x86_64.tar.gz
# 解壓
tar -zxvf elasticsearch-7.2.0.tar.gz
# 啓動
./bin/elasticsearch
常見的啓動問題:
-
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
這是每個進程最大打開文件太小了,修改/etc/security/limits.conf
vim /etc/security/limits.conf #增加如下二行 * soft nofile 65536 * hard nofile 65536
用戶退出後,重新登錄生效。
- [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf文件,增加配置vm.max_map_count=262144vi /etc/sysctl.conf sysctl -p
- [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
基本配置
通過配置conf/elasticsearch.yml進行配置
# 配置數據和日誌路徑
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
# 綁定IP,如果需要遠程訪問的話,需要配置
network.host: 192.168.40.191
# 設置端口
http.port: 9200
kibana 安裝
kibana是ES的可視化和管理工具。需要使用與ES對應的版本。
下載、解壓
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.2.0-linux-x86_64.tar.gz
tar -zxvf kibana-6.5.4-linux-x86_64
修改config/kibana.yml文件
# server.host
server.host: "192.168.40.191"
# 設置elasticsearch.url
elasticsearch.hosts: ["http://192.168.40.191:9200"]
啓動
.bin/kibana