参考:
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),开发者模式->加载已解压的扩展程序
测试: