centos7安装elasticsearch-head

elasticsearch-head安装前准备

1.操作系统
64位CentOS Linux release 7.2.1511 (Core)
2.git是必需的
elasticsearch-head是一款开源软件,被托管在github上面,所以如果我们要使用它,必须先安装git,通过git获取elasticsearch-head。我一开始在centos上装了git,但是后来仔细一想,我windows上已经装过了,没必要为了获取elasticsearch-head再在centos上装git。不过既然已经装了,那我们就在centos上获取吧。
可参考我的另一片文章安装git:centos7安装git
3.nodejs也是必需的
运行elasticsearch-head会用到grunt,而grunt需要npm包管理器,所以nodejs是必须要安装的。
可参考我的另一片文章安装nodejs:centos7安装nodejs
4.单独部署elasticsearch-head
elasticsearch5.0之后,elasticsearch-head不做为插件放在其plugins目录下了,所以可以单独部署一台服务器,没必要和elasticsearch部署在同一台机器

下载elasticsearch-head

使用git拷贝elasticsearch-head到本地

[root@localhost local]# cd /usr/local/

[root@localhost local]# git clone git://github.com/mobz/elasticsearch-head.git

安装elasticsearch-head依赖包

[root@localhost _site]# cd /usr/local/elasticsearch-head/

[root@localhost local]# cnpm install

如果出现下面的黄色警告,不用管,不影响使用。

npminstall WARN package.json not exists: /usr/local/package.json

修改Gruntfile.js

[root@localhost _site]# cd /usr/local/elasticsearch-head/

[root@localhost elasticsearch-head]# vi Gruntfile.js

在connect-->server-->options下面添加:hostname:’*’,允许所有IP可以访问

修改elasticsearch-head默认连接地址:

[root@localhost elasticsearch-head]# cd /usr/local/elasticsearch-head/_site/

[root@localhost _site]# vi app.js

将this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";中的localhost修改成你es的服务器地址,我的是:192.168.1.60:9200

配置elasticsearch允许跨域访问

进入elasticsearch服务器,打开elasticsearch的配置文件elasticsearch.yml,在文件末尾追加下面两行代码即可:

http.cors.enabled: true

http.cors.allow-origin: "*"

打开9100端口

如果想在别的机器上访问,防火墙必须开启9100端口

永久打开9100端口

[root@localhost elasticsearch-head]# firewall-cmd --zone=public --add-port=9100/tcp --permanent

重启防火墙

[root@localhost elasticsearch-head]# firewall-cmd --reload

启动elasticsearch

这里就不介绍了。

只有启动了elasticsearch,连接的时候才能连接上。

下面是我个人整理的一些笔记,有兴趣可以看下

centos7安装elasticsearch5.2.2

centos7 elasticsearch集群部署

centos7 elasticsearch之kibana安装

启动elasticsearch-head

[root@localhost _site]# cd /usr/local/elasticsearch-head/

[root@localhost elasticsearch-head]# node_modules/grunt/bin/grunt server

[root@localhost elasticsearch-head]# cd /usr/local/elasticsearch-head/
[root@localhost elasticsearch-head]#  node_modules/grunt/bin/grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

如上,表示elasticsearch-head启动成功

访问elasticsearch-head

浏览器输入网址:http://192.168.1.20:9100/

参考网址

http://www.cnblogs.com/valor-xh/p/6293689.html

http://www.cnblogs.com/xing901022/p/6030296.html

 

如有错误,欢迎指正,共同学习。

 

posted @ 2017-10-14 15:38  屌丝大叔的笔记  阅读(3623)  评论(0编辑  收藏  举报