windows 下安装elasticsearch
首先到官网下载:http://www.elastic.co/downloads/past-releases,本文使用5.5.3,因为IK分词器有个5.5.3版本与之对应
确认安装好了Java环境并且配置环境变量
解压下载的elasticsearch zip到文件夹中:D:\elasticsearch-5.5.3
进入bin目录文件夹,双击elasticsearch.bat启动如下图所示:
访问localhost:9200\即可看到启动成功
安装成系统服务运行在bin目录下执行elasticsearch-service.bat install
启动服务elasticsearch-service.bat start
停止服务elasticsearch-service.bat stop
卸载服务elasticsearch-service.bat remove
安装head插件:
先安装node.js:http://nodejs.cn/
命令行输入node -v检查是否安装成功
安装grunt构建工具:npm install -g grunt-cli
把head插件的源码git clone下来:https://github.com/mobz/elasticsearch-head放到elasticsearch中
修改目录:head/Gruntfile.js:
connect: {
server: {
options: {
port: 9100,
hostname: '*',
base: '.',
keepalive: true
}
}
}
修改连接地址目录:head/_site/app.js:
把localhost修改成你es的服务器地址,如:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.10.10.10:9200";
修改elasticsearch的参数
cluster.name: XXXX
node.name: XXXXX
network.host: 0.0.0.0
http.port: 9200
# 增加新的参数,这样head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: "*"
然后启动elasticsearch
然后在head源码目录中,执行npm install 下载的包:npm install
最后,在head源代码目录下启动nodejs:grunt server访问localhost:9100
集成Kibana
安装x-pack
elasticsearch的bin目录下执行elasticsearch-plugin.bat install x-pack(过程较久)
然后到kibana的bin目录下kibana-plugin.bat install x-pack
在elasticsearch.yml加入参数
重新启动Elasticsearch和Kibana,安装完x-pack,登录elasticsearch和kibana会让你输入密码,默认用户名elastic ,其默认密码是changeme。
IK中文分词插件的安装
下载地址:https://github.com/medcl/elasticsearch-analysis-ik
下载时要下载elasticsearch对应的版本:
先停止elasticsearch,在IK目录下运行mvn package(需要maven环境)
打包完成在target\releases找到压缩包解压到elasticsearch-5.5.3\plugins\ik
重新启动elasticsearch即可看到加载ik分词器了
PINYIN分词插件的安装下载地址:
https://github.com/medcl/elasticsearch-analysis-pinyin
安装过程与ik分词器相同,下载、打包、加入elasticsearch、重启elasticsearch。