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部署在同一台机器html

下载elasticsearch-head

使用git拷贝elasticsearch-head到本地node

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

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

安装elasticsearch-head依赖包

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

[root@localhost local]# cnpm installnpm

若是出现下面的黄色警告,不用管,不影响使用。json

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

修改Gruntfile.js

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

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

在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

 

若有错误,欢迎指正,共同窗习。

相关文章
相关标签/搜索