參考:
https://www.cnblogs.com/pangyangqi/p/11277354.html
https://www.cnblogs.com/gwyy/p/12205257.html
https://www.cnblogs.com/ourlang/p/12230965.html
https://blog.csdn.net/weixin_37281289/article/details/101483434
1、elasticsearch下載下傳
- 官網位址(官網下載下傳慢)
https://www.elastic.co/cn/downloads/elasticsearch
- csdn (es6.4.3套件es+analysis-ik中文分詞+kibana)下載下傳
https://download.csdn.net/download/weixin_40845192/12482445
2、elasticsearch安裝
- 環境要求
記憶體1G以上,JDK1.8以上
附:檢視記憶體使用情況
free -m
- 上傳并解壓
tar -zxvf elasticsearch-6.4.3.tar.gz
- 添加使用者 組
#添加組
groupadd es
#添加使用者并附加到es組
useraddes -g es -p pwd
#授權檔案夾
chown -R es:es /usr/local/elasticsearch-6.4.3
附:es有執行腳本的能力,因安全因素,不能在root使用者下運作,強行運作會報如下錯誤:
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
- 修改配置檔案
vim elasticsearch-6.4.3/config/elasticsearch.yml
- 添加如下配置:
#叢集名稱
cluster.name: binmaa
#節點名稱
node.name: node-1
#網絡設定 配置外網通路位址
network.host: 0.0.0.0
http.port: 9200
附:http通路端口為9200 程式通路端口預設為9300!!!
- 啟動
su es
elasticsearch-6.4.3/bin/elasticsearch
- 啟動報錯
錯誤:max file descriptors [1024] for elasticsearch process likely too low, increase to at least [65536]
修改方式:
vi /etc/security/limits.conf
将 * soft nofile 65535 改成 * soft nofile 65536
錯誤:bootstrap checks failed max virtual memory areas vm.max_map_count [65530] is too low, increase to at least
修改方式:
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并執行指令:
sysctl -p
重新啟動elasticsearch
- 測試是否啟動成功
curl http://192.168.1.16:9200或浏覽器通路http://192.168.1.16:9200得到如下結果,安裝成功:
$ curl http://192.168.1.16:9200
{
"name" : "node-1",
"cluster_name" : "binmaa",
"cluster_uuid" : "Lar9rF4bQ6SQvxQSY5yz8Q",
"version" : {
"number" : "6.4.3",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "fe40335",
"build_date" : "2018-10-30T23:17:19.084789Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
3、analysis-ik中文分詞安裝
https://github.com/medcl/elasticsearch-analysis-ik/releases 下載下傳對應版本!!!
cd elasticsearch-6.4.3/plugins/
mkdir ik
cd ik
unzip elasticsearch-analysis-ik-6.4.3.zip
安裝成功後啟動會加載[analysis-ik]
[2020-06-02T08:57:40,236][INFO ][o.e.p.PluginsService ] [node-1] loaded plugin [analysis-ik]
4、kibana安裝
tar -xzvf kibana-6.4.3-linux-x86_64.tar.gz
- 修改配置檔案,添加如下内容:
vim kibana-6.4.3-linux-x86_64/config/kibana.yml
添加如下内容:
#服務端口
server.port: 5601
#外網位址
server.host: "0.0.0.0"
#es服務位址
elasticsearch.url: "http://localhost:9200"
- 啟動:
cd kibana-6.4.3-linux-x86_64]# cd bin/
./kibana
- 浏覽器通路:
http://192.168.1.16:5601/
5、Chrome安裝es-head 插件
https://github.com/mobz/elasticsearch-head/tree/master/crx
将es-head.crx拖入chrome擴充程式清單
若拖入失敗,修改.crx為.zip 解壓(https://download.csdn.net/download/weixin_40845192/12482481),開發者模式->加載已解壓的擴充程式
測試: