第一步:必须要有jre支持

elasticsearch是用Java实现的,跑elasticsearch必须要有jre支持,所以必须先安装jre

可以参考 我前面的教程


第二步:下载elasticsearch

进入官方下载 https://www.elastic.co/downloads/elasticsearch

因为是centos中运行 所以我们选 tar.gz压缩包;

下载后上传到/developer/setup下

Centos7.3安装elasticsearch5.5


第三步:配置elasticsearch

 解压

Centos7.3安装elasticsearch5.5

 剪切文件到/developer目录

Centos7.3安装elasticsearch5.5Centos7.3安装elasticsearch5.5


启动 elasticsearch   

Centos7.3安装elasticsearch5.5

由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配

[[email protected] developer]# cd elasticsearch-5.5.2/

[[email protected] elasticsearch-5.5.2]# cd config

[[email protected] config]# vim jvm.options 

修改为Centos7.3安装elasticsearch5.5

再次启动出现

Centos7.3安装elasticsearch5.5

意思是不能用root用户来启动,那我们新建一个用户来启动

[[email protected] ~]# useradd elastic

[[email protected] ~]# chown -R elastic:elastic /home/es/elasticsearch-5.5.2/

新建elastic用户 并且把目录权限赋予给elastic 

我们切换成elastic用户,然后执行

[[email protected] ~]# su elastic

[[email protected] root]$ sh /home/es/elasticsearch-5.5.2/bin/elasticsearch

如果出现
Centos7.3安装elasticsearch5.5

可以参考https://blog.csdn.net/odeng888/article/details/76380832 


最后启动可以我们可以验证 curl http://localhost:9200

[[email protected] root]$ curl http://localhost:9200

{

  "name" : "K22mJd5",

  "cluster_name" : "elasticsearch",

  "cluster_uuid" : "R2qfXKtrQl2PwKdJMmPuMA",

  "version" : {

    "number" : "5.5.2",

    "build_hash" : "b2f0c09",

    "build_date" : "2017-08-14T12:33:14.154Z",

    "build_snapshot" : false,

    "lucene_version" : "6.6.0"

  },

  "tagline" : "You Know, for Search"

}


出来这个 说明配置OK。


第四步:允许外网连接配置

前面我们配置的仅仅是本机使用 但是我们比如集群以及其他机器连接 ,则需要配置下。

可以修改 /developer/elasticsearch/config/elasticsearch.yml 文件

network.host: 0.0.0.0

http.port: 9200

修改后 保存退出

再启动下elasticsearch

我们用谷歌浏览器请求下 http://192.168.1.108:9200/

Centos7.3安装elasticsearch5.5


OK 出现这东西 才算配置完成;

相关文章: