elasticsearch相关安装
elasticsearch安装
- 下载es包
- 新建用户
groupadd es
useradd es -g es -p xxx
chown -R es:es 你的es目录
- su es
如果出现用户创建不成功
mkdir /home/es
cp /etc/skel/.bash_logout /home/es/
cp /etc/skel/.bash_profile /home/es/
cp /etc/skel/.bashrc /home/es/
- ./bin/elasticsearch
问题
- max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
- max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
kibana安装
- 下载kibanna
- 修改配置文件
- ./kibana
安装x-pack
- 在线安装
#elasticsearch安装x-pack ./elasticsearch-plugin install x-pack #kibana安装x-pack ./kibana-plugin install x-pack #logsta
- 离线安装
1. 下载x-pack文件 https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-5.6.10.zip 2. 安装,使用file://协议 ./elasticsearch-plugin install file://yourfilepath/x-pack-5.6.10.zip
安装ik分词器
github:https://github.com/medcl/elasticsearch-analysis-ik
- 离线
- wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.10/elasticsearch-analysis-ik-5.6.10.zip
- ./elasticsearch-plugin install file://ik的文件路径
- 在线
- ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.10/elasticsearch-analysis-ik-5.6.10.zip
重启es
ik的分析器和分词器
ik的Analyzer:ik_smart , ik_max_word
ik的Tokenizer:ik_smart , ik_max_word
区别
-
ik_max_word: 会将文本做最细粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,中华人民,中华,华人,人民共和国,人民,人,民,共和国,共和,和,国国,国歌”,会穷尽各种可能的组合;
-
ik_smart: 会做最粗粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,国歌”。
配置ik
路径:/home/es-fm/elasticsearch-5.6.10/config/analysis-ik
//扩展的词库
extra_main.dic
extra_single_word.dic
extra_single_word_full.dic
extra_single_word_low_freq.dic
extra_stopword.dic
//扩展的配置文件
IKAnalyzer.cfg.xml
//默认加载的词库
main.dic
preposition.dic
quantifier.dic
//英文的停用词库
stopword.dic
suffix.dic
surname.dic
自定义扩展配置
//这里的ik需要配置扩展,至少需要配置扩展的停用词,多个词库以;号隔开
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">extra_main.dic;extra_single_word.dic;extra_single_word_full.dic;extra_single_word_low_freq.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords">extra_stopword.dic</entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>