aws ec2 安装Elastic search 7.2.0 kibana 并配置 hanlp 分词插件
Elastic search & kibana & 分词器 安装
版本控制
ES版本:7.2.0
分词器版本:
kibana 版本:7.2.0
下载地址
ES 下载地址:https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-2-0
kibana 下载地址:https://www.elastic.co/cn/downloads/past-releases/kibana-7-2-0
hanlp 分词器下载地址: https://github.com/KennFalcon/elasticsearch-analysis-hanlp
Elastic search安装
- 0.添加es 用户,并新建目录
不能以root 方式运行elasticSearch
groupadd elasticsearch
useradd elasticsearch -g elasticsearch
chown -R elasticsearch:elasticsearch /home/elasticsearch
- 1.修改 配置文件 elasticsearch.yml
cluster.name: fastclaim
node.name: node-test
network.host: 172.31.3.50
http.port: 9200
cluster.initial_master_nodes: ["node-test"]
- 2.针对无法创建本地文件问题,用户最大可创建文件数太小
切换到root用户,编辑limits.conf配置文件
vi /etc/security/limits.conf
#末尾添加
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
- 3.针对无法创建本地线程问题,用户最大可创建线程数太小
vi /etc/security/limits.d/90-nproc.conf
将
* soft nproc 1024
修改为
* soft nproc 4096
- 4.针对最大虚拟内存太小
解决方法:切换到root用户下,修改配置文件sysctl.conf
vi /etc/sysctl.conf
添加配置
vm.max_map_count=655360
执行命令
sysctl -p
- 5.重新启动,启动成功
如果要在后台运行,使用./bin/elasticsearch -d启动
curl 172.31.3.50:9200
{
"name" : "node-test",
"cluster_name" : "fastclaim",
"cluster_uuid" : "VtYF-EQIQNKHR1XWk7sE4g",
"version" : {
"number" : "7.2.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "508c38a",
"build_date" : "2019-06-20T15:54:18.811730Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
kibana 安装
- 1.安装及启动
tar -xzvf 解压缩后,进行安装,
vim config/kibana.yml
# 修改如下四行
server.port: 5601
server.host: "172.31.3.50"
elasticsearch.hosts: ["http://172.31.3.50:9200"]
kibana.index: ".kibana"
# 后台启动
nohup ./bin/kibana >/dev/null &
- 2.开发工具地址
http://IP:5601/app/kibana#/dev_tools/console?_g=()
分词器配置
参考链接:https://github.com/KennFalcon/elasticsearch-analysis-hanlp
- 1.下载安装ES对应Plugin Release版本
安装方式:
方式一
a. 下载对应的release安装包,最新release包可从baidu盘下载(链接:https://pan.baidu.com/s/1mFPNJXgiTPzZeqEjH_zifw 密码:i0o7)
b. 执行如下命令安装,其中PATH为插件包绝对路径:
./bin/elasticsearch-plugin install file://${PATH}
方式二
a. 使用elasticsearch插件脚本安装command如下:
./bin/elasticsearch-plugin install https://github.com/KennFalcon/elasticsearch-analysis-hanlp/releases/download/v7.2.0/elasticsearch-analysis-hanlp-7.2.0.zip
- 2.安装数据包
release包中存放的为HanLP源码中默认的分词数据,若要下载完整版数据包,请查看HanLP Release。
数据包目录:ES_HOME/plugins/analysis-hanlp
注:因原版数据包自定义词典部分文件名为中文,这里的hanlp.properties中已修改为英文,请对应修改文件名
hanlp.properties 在
/home/elasticsearch/elasticsearch-7.2.0/config/analysis-hanlp 目录中
因为aws ec2 里面网络环境比较好,推荐直接在线安装。
- 3.重启Elasticsearch
注:上述说明中的ES_HOME为自己的ES安装路径,需要绝对路径
- 4.配置自定义词典并热更新
在本版本中,增加了词典热更新,修改步骤如下:
a. 在ES_HOME/plugins/analysis-hanlp/data/dictionary/custom目录中新增自定义词典
b. 修改hanlp.properties,修改CustomDictionaryPath,增加自定义词典配置
c. 等待1分钟后,词典自动加载
具体脚本,以医学常用词典medical.txt 为例
mv /tmp/medical.txt /home/elasticsearch/
cp /home/elasticsearch/medical.txt /home/elasticsearch/elasticsearch-7.2.0/plugins/analysis-hanlp/data/dictionary/custom/
#移动完成后修改权限
chown -R elasticsearch:elasticsearch /home/elasticsearch/
ll /home/elasticsearch/elasticsearch-7.2.0/plugins/analysis-hanlp/data/dictionary/custom/
#修改添加自定义目录
vim /home/elasticsearch/elasticsearch-7.2.0/config/analysis-hanlp/hanlp.properties
# Custom dictinary path
CustomDictionaryPath=data/dictionary/custom/CustomDictionary.txt; ModernChineseSupplementaryWord.txt; ChinesePlaceName.txt ns; PersonalName.txt; OrganizationName.txt; ShanghaiPlaceName.txt ns;data/dictionary/person/nrf.txt nrf; medical.txt;
注:每个节点都需要做上述更改
- 5.提供的分词方式说明
hanlp: hanlp默认分词
hanlp_standard: 标准分词
hanlp_index: 索引分词
hanlp_nlp: NLP分词
hanlp_n_short: N-最短路分词
hanlp_dijkstra: 最短路分词
hanlp_crf: CRF分词(已有最新方式)
hanlp_speed: 极速词典分词
- 6.分词样例
GET /_analyze?pretty
{
"analyzer" : "hanlp_crf",
"text" : ["南京市长江大桥"]
}
{
"tokens" : [
{
"token" : "南京市",
"start_offset" : 0,
"end_offset" : 3,
"type" : "ns",
"position" : 0
},
{
"token" : "长江大桥",
"start_offset" : 0,
"end_offset" : 4,
"type" : "nz",
"position" : 1
}
]
}
aws ec2 安装Elastic search 7.2.0 kibana 并配置 hanlp 分词插件的更多相关文章
- docker安装elastic search和kibana
安装目标 使用docker安装elastic search和kibana,版本均为7.17.1 安装es 1. docker pull 去dockerhub看具体版本,这里用7.17.1 docker ...
- AWS EC2安装docker时的问题
在AWS EC2的实例(Ubuntu)里面安装docker时,使用通常的安装步骤 :~$ sudo apt-get update :~$ sudo apt-get install docker 安装完 ...
- tpot从elastic search拉攻击数据之二 配置端口映射
虽然知道了本地的数据接口位置,但是我们需要的是从远程拉取数据,所以我们需要更改es的ip端口为0.0.0.0:xxxx. 直接修改下图的elasticsearch.yml配置文件,结果发现无效. 这是 ...
- Hanlp分词插件docker集群安装
背景:我是用docker-compose的方式装的es集群,正常情况es镜像没有插件,如果在docker里面用命令安装了那么重启以后又没了,所以采用挂载离线安装的方式 版本: es7.2 1下载Han ...
- chrom中安装elastic search head插件
1. 访问https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm/ ...
- 通过tarball形式安装HBASE Cluster(CDH5.0.2)——配置分布式集群中的YARN ResourceManager 的HA
<?xml version="1.0"?> <!-- Licensed under the Apache License, Version 2.0 (the &q ...
- SQL数据同步到ELK(二)- Elastic Search 安装
开篇废话 没错,前面扯了一堆SQL SERVER,其实我连Elastic Search根本没动手玩过(是不是与时代有点脱节了?),那今天我就准备尝试安装一个ELK的简单集群出来(这个集群是使用我的小米 ...
- Elastic Search快速上手(1):简介及安装配置
前言 最近开始尝试学习Elastic Search,因此决定做一些简单的整理,以供后续参考,快速上手使用ES. 简介 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多 ...
- AWS EC2笔记
朋友想搭一个境外网站,找我帮忙,希望服务器.域名都在境外.我没有在境外建站的经历,只能先尝试.于是上网搜索了一下境外服务器,大家比较常用的是Digital Ocean和AWS,我索性打开这两家的官网, ...
随机推荐
- 110-PHP类成员属性赋值
<?php class mao{ //定义猫类 public $age=0; //定义多个属性并初始化 public $weight=50; public $color='white'; } $ ...
- SQL分组后获取其中一个字段最大值的整条记录
SELECT * FROM( SELECT id,name,counts,createDate,row_number() OVER(partition BY name ORDER BY createD ...
- Node.js 文件系统模块
章节 Node.js 介绍 Node.js 入门 Node.js 模块 Node.js HTTP模块 Node.js 文件系统模块 Node.js URL模块 Node.js NPM Node.js ...
- ES6模块化深入 debug
引子: 2020.2.24.最近刚写完一个vue项目.项目用到ES6的模块化 想到之前写node项目用到过commonjs模块化 就想着把所有用到过的模块化技术 总结学习一下 在看阮一峰老师的 es6 ...
- UVA - 11093 Just Finish it up(环形跑道)(模拟)
题意:环形跑道上有n(n <= 100000)个加油站,编号为1~n.第i个加油站可以加油pi加仑.从加油站i开到下一站需要qi加仑汽油.你可以选择一个加油站作为起点,起始油箱为空(但可以立即加 ...
- 使用Linux系统,是一种什么体验?
导读 同事,从事嵌入式软件开发多年,主要开发环境用的就是linux,最疯狂的一段时间直接把系统装成linux系统,然后在linux下面虚拟一个windows操作系统,主要有些事情必须在windows才 ...
- c++ opencv 动态内存
1.CvMemStorage定义动态内存存储器 内存存储器是一个用来存储诸如序列.轮廓.图形和子划分等动态增长数据结构的底层结构 2.示例 CvMemStorage *mems = cvCreat ...
- 【分布式】流式计算Storm框架
Storm简介: Storm起源Twitter开源的一个类似于Hadoop的实时数据处理框架,不过两则还是有区别的,Hadoop是批量处理数据,而Storm处理的是实时的数据流. Storm应用场景: ...
- ContentProvider ContentResolver ContentObserver 内容:提供、访问、监听
内容提供 public class PersonContentProvider extends ContentProvider{ private static final String AUTHORI ...
- Python Learning Day8
bp4解析库 pip3 install beautifulsoup4 # 安装bs4pip3 install lxml # 下载lxml解析器 html_doc = """ ...