ES安装部署文档
1.环境及准备
服务器:Ubuntu
Jdk:1.8
Elasticsearch版本:5.6.9
注意:Elastic 需要 Java8 环境。注意要保证环境变量JAVA_HOME正确设置。
出于安全性考虑,es不允许root账户启动,须新建用户,并开启目录权限,使用新账户启动。因此建议安装前先切换用户。
Elasticsearch压缩包下载地址:
https://www.elastic.co/downloads/past-releases/elasticsearch-5-6-9
Ik分词器git地址(找到与自己的ES相同的版本(5.6.9)):
https://github.com/medcl/elasticsearch-analysis-ik/releases
文档解析插件ingest-attachment:
2.ES安装步骤
用传输工具将下载好的压缩包传到服务器,然后解压缩:
tar -xvf elasticsearch-5-6-9.tar.gz
解压缩后,进入解压后的目录,运行下面的命令,启动 Elastic。
./bin/elasticsearch -d
如果这时报错"max virtualmemory areas vm.maxmapcount [65530] is too low",要运行下面的命令再重新启动。
错误查看地址:https://stackoverflow.com/questions/42300463/elasticsearch-bootstrap-checks-failing
ulimit -n 65536
或者
sudo sysctl -w vm.max_map_count=655360
默认情况下,Elastic 只允许本机访问,如果需要远程访问,可以修改 Elastic 安装目录的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成服务器IP,然后重新启动 Elastic。
关闭es,先用jps命令查看es进程号,在用kill 命令结束,如下图:

3. Elasticsearch-head安装(非必须)
Elasticsearch-head 是集群管理工具、数据可视化、增删改查工具。
5.0以上版本的es已经不支持plugin安装了,只能跑独立的服务或者使用Chrome插件,建议使用Chrome插件,较方便。
直接Chrome应用商店搜索Elasticsearchhead安装即可。

独立服务安装方法。https://github.com/mobz/elasticsearch-head

界面如下:

4. ik分词器安装
https://github.com/medcl/elasticsearch-analysis-ik/releases
找到与自己的ES相同的版本(5.6.9)
在es目录下的plugins目录下创建一个新文件夹,命名为analysis-ik,然后把上面的压缩包中的内容解压到该目录中。
重启es。
5. ingest-attachment插件安装
ingest-attachment插件下载地址:
在es目录下的plugins目录下创建一个新文件夹,命名为ingest-attachment,然后把上面的压缩包中的内容解压到该目录中。
重新启动es
增加文档解析预处理器:
POSThttp://172.19.254.66:9200/_ingest/pipeline/multi_attachment
{
"description": "Extract attachment information from arrays",
"processors": [
{
"foreach": {
"field": "files",
"processor": {
"attachment": {
"target_field": "_ingest._value.attachment",
"field": "_ingest._value.data",
"indexed_chars": -1,
"ignore_missing": true
}
}
}
}
,
{
"foreach": {
"field": "files",
"processor": {
"remove": {
"field": "_ingest._value.data"
}
}
}
}
]
}
网友评论