由于项目需求,需要在linux平台搭建一套ES服务,记录下搭建过程。
一、环境配置
操作系统:Cent OS 6.5
ElasticSearch版本:2.4.4
JDK版本:1.8
二、操作过程
1、首先去官网下载elasticsearch的tar包
https://www.elastic.co/downloads/past-releases/elasticsearch-2-4-4
2、新建一个es用户(elasticsearch不允许root用户启动服务)
groupadd elasticsearch
useradd -g elasticsearch elasticsearch
passwd elasticsearch
输入两边密码(自定义:111111)
3、登录elasticsearch用户,并安装elasticsearch
su elasticsearch
cd
tar -zxvf elasticsearch-2.4.4.tar.gz
vim elasticsearch-2.4.4/config/elasticsearch.yml
修改 network.host: 0.0.0.0 (局域网其他用户可以访问该地址)
保存
./elasticsearch-2.4.4/bin/elasticsearch &
即可以访问http://127.0.0.1:9300
4、安装head插件
cd /elasticsearch-2.4.4/bin
./plugin install mobz/elasticsearch-head
重启es
5、安装ik分词插件
下载ik分词https://github.com/medcl/elasticsearch-analysis-ik/tree/2.x
可以下载zip,也可以直接用git下载
git clone https://github.com/medcl/elasticsearch-analysis-ik
checkout 2.x分支
mv elasticsearch-analysis-ik-2.x elasticsearch-analysis-ik
cd elasticsearch-analysis-ik
mvn clean
mvn compile
mvn package
拷贝和解压release下的文件: #{project_path}/elasticsearch-analysis-ik/target/releases/elasticsearch-analysis-ik-*.zip 到你的 elasticsearch 插件目录, 如: plugins/ik 重启elasticsearch
6、安装kibana
下载地址 https://www.elastic.co/downloads/past-releases
(1)Download and unzip Kibana
(2)目录自己定
- Open config/kibana.yml in an editor
- Set
elasticsearch.url
to point at your Elasticsearch instance
(3)Run bin/kibana
(or bin\kibana.bat
on Windows)
(4)Point your browser at http://localhost:5601