Contos 7.5下搭建elasticsearch-7.6.2


linux環境下搭建ES

一,下載地址

Es下載地址:https://www.elastic.co/cn/downloads/elasticsearch

Kibana:https://www.elastic.co/cn/downloads/kibana

 

ES的版本要和Kibana的版本對應

 

 

本次環境搭建教程是版本7.6.2

 

 

二,環境搭建

2.1配置java開發環境

Java的開發環境最好是1.8以上的

2.2 手動安裝elasticsearch和Kibana

2.2.1 將下載好的ES和Kibana解壓

我是將文件放到了/usr/local/elasticsearch中,以此解壓ES和kibana的壓縮包。

解壓指令:

tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz

tar -zxvf kibana-7.6.2-linux-x86_64.tar.gz

解壓后得到兩個文件夾

 

2.2.2  elasticsearch-7.6.2中的文件

工欲善其事必先利其器,我們先熟悉es中的文件,以便以后的學習和維護操作等等。

①bin目錄放的是啟動文件

②config目錄為配置文件

③lib相關的jar包

④plugins目錄中為插件文件,比如IK中文分析器

⑤logs 自己創建的,存放日志文件

⑥data 自己創建的,存放數據的地方

 

熟悉了目錄后,我們了解一下config下的配置文件。

主要的配置文件有

①elasticsearch.yml es的配置文件

②jvm.options jvm的配置文件

③log4j2.properties 日志配置文件

 

2.2.3配置文件詳解

①elasticsearch.yml

cluster.name: my-application

node.name: node-1

path.data: /usr/local/elasticsearch/elasticsearch-7.6.2/data

path.logs: /usr/local/elasticsearch/elasticsearch-7.6.2/logs

network.host: 0.0.0.0

http.port: 9200

cluster.initial_master_nodes: ["node-1"]

放開這些注釋,

單機,node.name為node-1,

默認端口為9200,

nework.host修改為0.0.0.0,其他網絡可以對es進行訪問;

②jvm.options

ES比較吃內存,配置的內存越高越爽,條件原因,設置1G

 

2.2.3 啟動ES

創建ES用戶

useradd es

chown -R es /usr/local/elasticsearch/elasticsearch-7.6.2

啟動ES

su es
cd /usr/local/elasticsearch/elasticsearch-7.6.2/bin
./elasticsearch

 

啟動成功

 

2.2.4常見問題

①防火牆問題:

如果沒有開放9200端口

firewall-cmd --zone=public --add-port=9200/tcp --permanent

firewall-cmd --reload

 

②max virtual memory areas vm.maxmapcount [xxxxx] is too low

vim /etc/sysctl.conf

vm.max_map_count=262144然后sysctl -p生效

2.3 Kibana的安裝

修改kibana的配置文件

server.port: 5601

server.host: "0.0.0.0"

elasticsearch.hosts: ["http://localhost:9200"]

啟動

cd /usr/local/elasticsearch/kibana-7.6.2/bin

./kibana


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM