一、安装elasticsearch
1.首先需要安装好java,并配置好环境变量,详细教程请看
http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/#
2.安装ElasticSearch,下载rpm包:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.rpm
rpm -ivh elasticsearch-5.1.1.rpm
3.修改elasticsearch的配置文件:
vi /etc/elasticsearch/elasticsearch.yml
修改其中的network.host为本机ip,http.port为9200
4.安装成功后,启动elasticsearch:
systemctl daemon-reload
systemctl enable elasticsearch.service (设置开机自启动)
systemctl start elasticsearch.service (开启服务)
systemctl status elasticsearch.service (查看服务状态)
检查是否成功:curl http://*****:9200
二、安装ik分词器
1、进入https://github.com/medcl/elasticsearch-analysis-ik/,找到ik分词器对应的版本为5.1.1,直接下载其release的版本(避免maven打包);
2、在/usr/share/elasticsearch/plugins下建立ik目录:
mkdir /usr/share/elasticsearch/plugins/ik
3、复制文件至elasticsearch的plugins文件夹的ik文件夹下:
cp elasticsearch-analysis-ik-5.1.1.zip /usr/share/elasticsearch/plugins/ik
4.解压文件:
unzip elasticsearch-analysis-ik-5.1.1.zip