原文地址:http://www.niu12.com/article/18node
1.安装好Java1.8以上环境并配置好JAVA_HOME(elasticsearch运行环境) 2.node环境6.5以上(插件须要)
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.zip $ unzip elasticsearch-5.5.1.zip $ cd elasticsearch-5.5.1/ $ ./bin/elasticsearch 若是遇到相关错误请上网自行查询
$ curl localhost:9200 // 返回 { "name" : "atntrTf", "cluster_name" : "elasticsearch", "cluster_uuid" : "tf9250XhQ6ee4h7YI11anA", "version" : { "number" : "5.5.1", "build_hash" : "19c13d0", "build_date" : "2017-07-18T20:44:24.823Z", "build_snapshot" : false, "lucene_version" : "6.6.0" }, "tagline" : "You Know, for Search" }
由于我是在虚拟机里跑,因此须要宿主机访问,默认状况下,Elastic 只容许本机访问,若是须要远程访问,能够修改 Elastic 安装目录的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改为0.0.0.0,而后从新启动 Elastic。git
$ git clone https://github.com/mobz/elasticsearch-head.git $ cd elasticsearch-head $ sudo npm install -g grunt -cli $ npm run start
出现Started connect web server on http://localhost:9100便可在宿主机访问 个人虚拟机地址是192.168.10.10,访问结果以下图github
记得修改ip地址,es-head链接的是localhostweb
发现状态未链接,由于es和es-head属于两个不一样的进程,他们之间的访问是有跨域问题,因此须要配置./config/elasticsearch.ymlnpm
# 在末尾添加配置 $ vim ./config/elasticsearch.yml http.cors.enabled: true http.cors.allow-origin: *
重启es和es-head,访问结果以下图vim