1.下载elasticsearch安装包
2.下载对应版本的IK包,https://github.com/medcl/elasticsearch-analysis-ik/releases
解压后放入elasticsearch 的plugins文件夹下面。
3.配置远程分词过滤
修改配置文件IKAnalyzer.cfg.xml
在IKAnalyzer.cfg.xml添加远程服务配置
<!--用户可以在这里配置远程扩展字典 -->
<entry key="remote_ext_dict">http://10.10.55.49:9088/hotword.dic</entry>
<!--用户可以在这里配置远程扩展停止词字典-->
<entry key="remote_ext_stopwords">http://10.10.55.49:9088/stopword.dic</entry>
修改完成后,重启es服务。
过滤词汇如果有修改,可以直接修改远程字典,es会自动同步远程字典的信息(hotword.dic 与 stopword.dic),不需要重启服务。
4.配置nginx代理
上图配置中http://10.10.55.49:9088/hotword.dic 可以配置为nginx代理。
4.1.添加自定义dic
4.2.添加nginx配置
可以根据具体情况,配置灵活的nginx代理
4.3.启动nginx
nginx -c /home/bigdata01/projects/es_ik_dic/nginx_ik_dic.conf
5.系统设置
5.1 max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
修改/etc/security/limits.conf文件,增加配置,
* soft nofile 65536
* hard nofile 65536
用户退出后重新登录生效
查看命令:
ulimit -Hn
ulimit -Sn
5.2 max number of threads [3818] for user [es] is too low, increase to at least [4096]
最大线程个数太低。修改配置文件/etc/security/limits.conf,增加配置
* soft nproc 4096
* hard nproc 4096
查看命令:
ulimit -Hu
ulimit -Su
5.3 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf文件,增加配置vm.max_map_count=262144
执行命令sysctl -p生效
5.4 max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]
修改 /etc/security/limits.d/90-nproc.conf
原: soft nproc 1024
改为: soft nproc 2048
启动elasticsearch。
后台启动:
./elasticsearch -d
5.5. 修改elasticsearch.yml
cluster.name: elastic
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
6.下载对应版本的Kibana
修改kibana.yml
elasticsearch.url: "http://127.0.0.1:9200"