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,我索性打开这两家的官网, ...
随机推荐
- 第二阶段scrum-10
1.整个团队的任务量: 2.任务看板: 会议照片: 产品状态: 等待发布
- Promise 练习
import { ModelClass } from "engine/injector/Injector"; import { Inject } from "core/i ...
- BZOJ:1878: [SDOI2009]HH的项链
题解:解法一:莫队 解法二:按区间左端点排序,让区间内最左边的贝壳对答案产生贡献,树状数组维护,转移对答案产生贡献的贝壳位置 #include<iostream> #include< ...
- 路由反射器(RR)配置
IBGP与EBGP的区别:是否使用指定源(update-source) 路由反射器(RR)配置: 零:关闭同步,关闭自动汇总. ①:启用BGP ②:在相同BGP-AS下建立邻居. ③:指定路由器及所在 ...
- 【Tensorflow】(tf.Graph)和(tf.session)
图(tf.Graph):计算图,主要用于构建网络,本身不进行任何实际的计算. 会话(tf.session):会话,主要用于执行网络.所有关于神经网络的计算都在这里进行,它执行的依据是计算图或者计算图的 ...
- mariadb主从
实验环境: 两台centos7 master:192.168.1.6 slave:192.168.1.7 一.安装mariadb服务 [root@master ~]# yum -y install m ...
- SASS - 函数
SASS – 简介 SASS – 环境搭建 SASS – 使用Sass程序 SASS – 语法 SASS – 变量 SASS- 局部文件(Partial) SASS – 混合(Mixin) SASS ...
- 使用Docker构建基于centos7镜像的python环境
Dcokerfile配置信息 ############################################## # 基于centos7构建python3运行环境 # 构建命令: 在Dock ...
- jvm调优原则
合理规划jvm性能调优 JVM性能调优涉及到方方面面的取舍,往往是牵一发而动全身,需要全盘考虑各方面的影响.但也有一些基础的理论和原则,理解这些理论并遵循这些原则会让你的性能调优任务将会更加轻松.为了 ...
- iOS 中的延时操作方法
1. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_q ...