①解壓文件 tar -zxvf elasticsearch-6.2.1.tar.gz
②重命名 mv elasticsearch-6.2.1 /usr/local/elasticsearch
③創(chuàng)建數(shù)據(jù)存放路徑 mkdir /usr/local/elk/elasticsearch/data
④建立用戶并授權(quán)(es不能用root運行)
#添加用戶??? useradd es???????? #設(shè)定密碼??? passwd es
#賦予文件夾權(quán)限???? chown -R es:es /usr/local/elasticsearch
⑤修改elasticsearch配置文件 ? ?vim /usr/local/elasticsearch/config/elasticsearch.yml
⑥調(diào)整jvm內(nèi)存 ? ?vim /usr/local/elasticsearch/config/jvm.options
#默認(rèn)是1g官方建議對jvm進(jìn)行一些修改,不然很容易出現(xiàn)OOM,參考官網(wǎng)改參數(shù)配置最好不要超過內(nèi)存的50%
-Xms200m
-Xmx200m
⑦使用非root用戶啟動Elasticsearch
#切換至es賬戶????????? su es
#啟動 /usr/local/elasticsearch/bin/./elasticsearch
如果啟動報如下錯則:切回root用戶 exit? ,修改相應(yīng)配置
ERROR:?[3]?bootstrap?checks?failed??
[1]:?max?file?descriptors?[65535]?for?elasticsearch?process?is?too?low,?increase?to?at?least?[65536]??
[2]:?max?number?of?threads?[3895]?for?user?[elastic]?is?too?low,?increase?to?at?least?[4096]??
[3]:?max?virtual?memory?areas?vm.max_map_count?[65530]?is?too?low,?increase?to?at?least?[262144]??
【1】修改/etc/security/limits.conf卦停,修改到提示值
[root@centos7.4-64?~]#?vim?/etc/security/limits.conf?
* soft nofile 65536
* hard nofile 65536
* soft memlock unlimited
* hard memlock unlimited
【2】修改/etc/security/limits.d/90-nproc.conf 文件
[root@centos7.4-64?~]#?vim?/etc/security/limits.d/90-nproc.conf???
將內(nèi)容改為:? *??????????soft????nproc?????4096
【3】修改/etc/sysctl.conf
[root@centos7.4-64?~]#?vim?/etc/sysctl.conf???
添加配置:vm.max_map_count=262144缺菌,然后執(zhí)行命令??
[root@centos7.4-64?~]#?sysctl?-p
1.es6安裝:
https://blog.csdn.net/cowbin2012/article/details/80717534
https://blog.csdn.net/qq_34021712/article/details/79333090
https://blog.csdn.net/fgf00/article/details/79571940
2.集群搭建
https://www.cnblogs.com/liuchuanfeng/articles/7059268.html
3.logstash使用rpm包安裝的時候沒有配置init的啟動腳本(可無此步驟)
生成啟動腳本,centos6使用sysv參數(shù),centos7使用systemd
# /usr/share/logstash/bin/system-install?/etc/logstash/startup.options sysv
4.es插件安裝:(node, grunt, elasticsearch-head)
https://blog.csdn.net/python36/article/details/80816707(不用單獨下載node)
https://www.cnblogs.com/hts-technology/p/8556279.html
5.啟動es: ?/usr/local/elasticsearch-1/bin/elasticsearch
啟動es-head插件:?/usr/local/elasticsearch-head/./node_modules/grunt/bin/grunt server &
訪問es-head插件:ip+9100
ES學(xué)習(xí)流程
(1)掌握 Elasticsearch 的基本概念禁悠,主要包括:
索引(index)
類型(type)
映射(mapping)
文檔(document)
倒排索引原理
文檔打分機(jī)制
集群(cluster)——單節(jié)點、集群安裝與部署
健康狀態(tài)(red/yellow/green)
數(shù)據(jù)存儲
數(shù)據(jù)類型(long/date/text、keyword/nested等)
數(shù)據(jù)展示(結(jié)合Head插件的基礎(chǔ)可視化)
……
(2)掌握 Elasitcsearch 的基本操作怀樟,主要包括:
新增(insert)
刪除(delete/deletebyquery)
修改(update/updatebyquery)
查找(search)
精確匹配檢索(term、terms盆佣、range往堡、exists)
模糊匹配檢索(wildcard、prefix共耍、negix正則)
分詞全文檢索(match/match_phrase等)
多條件 bool 檢索(must/must_not/should多重組合)
分詞(英文分詞虑灰、拼音分詞、中文分詞)
高亮
分頁查詢
指定關(guān)鍵詞返回
批量操作 bulk
scroll 查詢
reindex 操作
(3)掌握 Elasticsearch 高級操作痹兜,主要包括:
聚合統(tǒng)計(數(shù)量聚合穆咐、最大值、最小值字旭、平均值对湃、求和等聚合操作)
圖像化展示(hisgram 按照日期等聚合)
聚合后分頁
父子文檔
數(shù)組類型
nested 嵌套類型
ES 插件錯誤排查(集群問題、檢索問題遗淳、性能問題)
ES 性能調(diào)優(yōu)(配置調(diào)優(yōu)拍柒、集群調(diào)優(yōu)等)
……
(4)掌握 Elasticsearch Java/Python 等API,主要包括:
Elasticsearch 原生自帶 API洲脂、JEST斤儿、Springboot 等 API 選型
Elasticsearch 多條件 bool 復(fù)雜檢索 API
Elasticsearch 分頁 API
Elasticsearch 高亮 API
Elasticsearch 聚合 API
Elasticsearch 相關(guān) JSON 數(shù)據(jù)解析
……
(5)Elasticsearch 結(jié)合場景開發(fā)實戰(zhàn),主要包括:
數(shù)據(jù)可視化(Kibana恐锦、Grafana 等 其中 Grafana 比較適合監(jiān)控類場景)
通過 logstash/beats 等導(dǎo)入數(shù)據(jù)
Elasticsearch 和 Kafka 結(jié)合的應(yīng)用場景
Elasticsearch 和 Mongo 結(jié)合的應(yīng)用場景
Elasticsearch 和 Hadoop 結(jié)合的應(yīng)用場景
結(jié)合業(yè)務(wù)需求的定制化應(yīng)用場景(日志分析往果、文檔檢索、全文檢索一铅、金融等各行業(yè)檢索)
……
建議的第二學(xué)習(xí)優(yōu)先級為 Kibana陕贮。需要掌握的內(nèi)容如下。
Kibana 安裝與部署
ES 節(jié)點數(shù)據(jù)同步到 Kibana
Kibana Dev Tools 開發(fā)工具熟練使用
Kibana 圖像化組合展示
將 Kibana 圖像化展示效果圖應(yīng)用到自己的開發(fā)環(huán)境中
……
第三學(xué)習(xí)優(yōu)先級為 Logstash潘飘。需要掌握的內(nèi)容如下肮之。
Logstash 的安裝與部署
Logstash 將本地文件導(dǎo)入 ES
logstashinputjdbc 插件(5.X后無需安裝)將 MySQL/Oracle 等關(guān)系型數(shù)據(jù)庫數(shù)據(jù)導(dǎo)入 ES,全量導(dǎo)入和增量導(dǎo)入實現(xiàn)卜录。
logstashinputmongo插件將 Mongo 數(shù)據(jù)導(dǎo)入 ES
logstashinputkafaka 插件將 Kafak 數(shù)據(jù)導(dǎo)入 ES
logstashoutput* 插件將 ES 數(shù)據(jù)導(dǎo)入不同的數(shù)據(jù)庫和實時數(shù)據(jù)流中
……
第四學(xué)習(xí)優(yōu)先級為 Beats戈擒。需要掌握的內(nèi)容如下。
不同類型的 Beats 安裝與部署
將業(yè)務(wù)數(shù)據(jù)通過 Beats 導(dǎo)入 ES
……