下載:
官網多版本下載:
Past Releases of Elastic Stack Software | Elastic
github多版本下載:
https://github.com/elastic/elasticsearch/releases
上傳后解壓到當前目錄
tar -zxvf elasticsearch-8.19.3-linux-x86_64.tar.gz
或指定解壓目錄
tar -xzf elasticsearch-8.19.3-linux-x86_64.tar.gz -C /opt/elasticsearch
創建data目錄(存放數據)
mkdir?/opt/elasticsearch-8.19.3/data
logs目錄:elasticsearch-8.19.3中自帶了logs目錄,直接使用
(es必須使用非root用戶啟動)創建啟動es的用戶
useradd esuser
修改目錄權限
chown -R esuser?/opt/elasticsearch-8.19.3
修改配置
修改jvm內存(設置大小自己根據機器估算)
/config/jvm.options
## IMPORTANT: JVM heap size
-Xms265m
-Xmx4g
修改es設置
/config/elasticsearch.yml
cluster.name: my-application
path.data: /opt/elasticsearch-8.19.3/data
path.logs: /opt/elasticsearch-8.19.3/logs
network.host: 0.0.0.0
http.port: 9200
# 關閉生產環境檢查(僅用于本地測試!)
discovery.type: single-node
配置系統sevice服務
/etc/systemd/system/中創建文件elasticsearch.service
[Unit]
Description=Elasticsearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target[Service]
WorkingDirectory=/opt/elasticsearch-8.19.3
ExecStart=/opt/elasticsearch-8.19.3/bin/elasticsearch
#啟動失敗后自動重啟
#Restart=always
User=esuser
Group=esuser[Install]
WantedBy=multi-user.target
啟動sevice服務
systemctl start?elasticsearch
查看日志
tail -f?/opt/elasticsearch-8.19.3/logs/my-application.log
設置密碼
es8默認啟用了安全策略,啟動后就有密碼了在日志中可以查找
啟動后自定義密碼
./bin/elasticsearch-reset-password -u elastic -i
驗證是否可用
瀏覽器訪問https://yourip:9200(注意用https)輸入密碼
或
curl -k -u 'elastic:yourpassword' https://localhost:9200/
安裝kibana
官網多版本下載
Past Releases of Elastic Stack Software | Elastic
解壓縮
tar -zxvf kibana-8.19.3-linux-x86_64.tar.gz
修改目錄權限
chown -R esuser?/opt/kibana-8.19.3
修改用戶kibana_system密碼
回到es8修改用戶密碼
es8禁止直接使用內置的 elastic 超級用戶來運行 Kibana
/opt/elasticsearch-8.19.3/bin/elasticsearch-reset-password -u kibana_system -i
修改配置
/opt/kibana-8.19.3/config/kibana.yml
server.port: 5601
server.host: "0.0.0.0"
server.name: "kibana-server"
elasticsearch.hosts: ["https://localhost:9200"]
elasticsearch.username: "kibana_system"
elasticsearch.password: "elastic"
elasticsearch.ssl.certificateAuthorities: [ "/opt/elasticsearch-8.19.3/config/certs/http_ca.crt" ]logging.appenders.default:type: rolling-filefileName: /opt/kibana-8.19.3/logs/kibana.logpolicy:type: size-limitsize: 256mbstrategy:type: numericmax: 10layout:type: json
設置service服務
/etc/systemd/system/中創建文件kibana.service
[Unit]
Description=Kibana
Documentation=https://www.elastic.co
After=network.target[Service]
WorkingDirectory=/opt/kibana-8.19.3
ExecStart=/opt/kibana-8.19.3/bin/kibana
#Restart=always
User=esuser
Group=esuser[Install]
WantedBy=multi-user.target
啟動
systemctl start kibana
查看日志
tail -f /opt/kibana-8.19.3/logs/kibana.log
訪問
?
http://yourip:5601
kibana登錄可以用es中的用戶例如用戶:elastic 密碼