Cenos7安装ES head6.3.1

2.1 Head插件简介

ElasticSearch-head是一个H5编写的ElasticSearch集群操作和管理工具,可以对集群进行傻瓜式操作。

  • 显示集群的拓扑,并且能够执行索引和节点级别操作
  • 搜索接口能够查询集群中原始json或表格格式的检索数据
  • 能够快速访问并显示集群的状态
  • 有一个输入窗口,允许任意调用RESTful API。这个接口包含几个选项,可以组合在一起以产生有趣的结果;
  • 5.0版本之前可以通过plugin名安装,5.0之后可以独立运行。

2.2 Head插件安装

(1)安装NodeJS

[root@node1 ~]# yum install -y nodejs

(2)安装npm

[root@node1 ~]#  npm install -g cnpm --registry=https://registry.npm.taobao.org

(3)使用npm安装grunt

[[email protected] ~]# npm install -g grunt
npm WARN deprecated coffee-[email protected]1.10.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN gentlyRm not removing /usr/bin/grunt as it wasn‘t installed by /usr/lib/node_modules/grunt
/usr/bin/grunt -> /usr/lib/node_modules/grunt/bin/grunt
/usr/lib
└── [email protected]1.0.1 

[[email protected] ~]# 
[root@node1 ~]# npm install -g grunt-cli --registry=https://registry.npm.taobao.org --no-proxy
/usr/bin/grunt -> /usr/lib/node_modules/grunt-cli/bin/grunt
/usr/lib
└─┬ grunt-cli@1.2.0
  ├─┬ findup-sync@0.3.0
  │ └─┬ glob@5.0.15
  │   ├─┬ inflight@1.0.6
  │   │ └── wrappy@1.0.2
  │   ├── inherits@2.0.3
  │   ├─┬ minimatch@3.0.4
  │   │ └─┬ brace-expansion@1.1.8
  │   │   ├── balanced-match@1.0.0
  │   │   └── concat-map@0.0.1
  │   ├── once@1.4.0
  │   └── path-is-absolute@1.0.1
  ├── grunt-known-options@1.1.0
  ├─┬ nopt@3.0.6
  │ └── abbrev@1.1.1
  └── resolve@1.1.7 

[root@node1 ~]# 

(4)版本确认

[es@node1 ~]$ node -v
v6.12.0
[es@node1 ~]$ npm -v
3.10.10
[es@node1 ~]$ grunt -version
grunt-cli v1.2.0
[es@node1 ~]$

(5)下载head插件源码

[[email protected] ~]$ wget https://github.com/mobz/elasticsearch-head/archive/master.zip
--2017-12-18 09:58:08--  https://github.com/mobz/elasticsearch-head/archive/master.zip
Resolving github.com (github.com)... 192.30.255.113, 192.30.255.112
Connecting to github.com (github.com)|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/mobz/elasticsearch-head/zip/master [following]
--2017-12-18 09:58:09--  https://codeload.github.com/mobz/elasticsearch-head/zip/master
Resolving codeload.github.com (codeload.github.com)... 192.30.255.120, 192.30.255.121
Connecting to codeload.github.com (codeload.github.com)|192.30.255.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 921421 (900K) [application/zip]
Saving to: ‘master.zip’

100%[===============================================================>] 921,421     9.64KB/s   in 67s    

2017-12-18 09:59:18 (13.4 KB/s) - ‘master.zip’ saved [921421/921421]

[[email protected] ~]$ ls
master.zip
[[email protected] ~]$ unzip master.zip

(6)下载依赖
进入elasticsearch-head-master目录,执行下面命令

[es@node1 elasticsearch-head-master]$ npm install

> phantomjs-prebuilt@2.1.16 install /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1515165531727/phantomjs-2.1.1-linux-x86_64 -> /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
elasticsearch-head@0.0.0 /home/es/elasticsearch-head-master
└─┬ grunt-contrib-jasmine@1.0.3
  └─┬ grunt-lib-phantomjs@1.1.0
    └── phantomjs-prebuilt@2.1.16 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
[es@node1 elasticsearch-head-master]$ 

如果上面命令安装较慢或失败,可以尝试国内镜像安装

[es@node1 elasticsearch-head-master]$ sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
[sudo] password for es:
/usr/bin/cnpm -> /usr/lib/node_modules/cnpm/bin/cnpm
/usr/lib
└─┬ cnpm@5.1.1
  ├─┬ npminstall@3.3.0
  │ ├── binary-mirror-config@1.7.3
  │ ├── moment@2.20.1
  │ └─┬ tar@4.2.0
  │   └── minizlib@1.1.0
  └─┬ urllib@2.25.3
    └─┬ proxy-agent@2.1.0
      └─┬ pac-proxy-agent@2.0.0
        └─┬ socks-proxy-agent@3.0.1
          └─┬ agent-base@4.1.2
            └─┬ es6-promisify@5.0.0
              └── es6-promise@4.2.2 

[es@node1 elasticsearch-head-master]$ cnpm install
? [6/10] Installing json-schema-traverse@^0.3.0platform unsupported karma@1.3.0 › chokidar@1.7.0 › fsevents@^1.0.0 Package require os(darwin) not compatible with your platform(linux)
[fsevents@^1.0.0] optional install error: Package require os(darwin) not compatible with your platform(linux)
? Installed 10 packages
? Linked 313 latest versions
PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /home/es/elasticsearch-head-master/node_modules/_phantomjs-prebuilt@2.1.16@phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1515223629881/phantomjs-2.1.1-linux-x86_64 -> /home/es/elasticsearch-head-master/node_modules/_phantomjs-prebuilt@2.1.16@phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/es/elasticsearch-head-master/node_modules/_phantomjs-prebuilt@2.1.16@phantomjs-prebuilt/lib/phantom/bin/phantomjs
? Run 1 scripts
deprecate grunt-contrib-connect@1.0.2 › http2@^3.3.4 Use the built-in module in node 9.0.0 or newer, instead
deprecate grunt@1.0.1 › coffee-script@~1.10.0 CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
anti semver karma@1.3.0 › useragent@2.2.1 › tmp@0.0.x delcares tmp@0.0.x(resolved as 0.0.33) but using ancestor(karma)‘s dependency [email protected](resolved as 0.0.28)
? All packages installed (365 packages installed from npm registry, used 17s, speed 497.82kB/s, json 323(581.43kB), tarball 7.64MB)
[[email protected] elasticsearch-head-master]$ 

2.3 配置

(0)停止ElasticSearch
如果ElasticSearch已经启动,需要先停止

[es@node1 ~]$ jps
3261 Elasticsearch
3375 Jps
[es@node1 ~]$ kill 3261

(1)配置 ElasticSearch,使得HTTP对外提供服务

[es@node1 elasticsearch-6.1.1]$ vi config/elasticsearch.yml

添加如下内容

# 增加新的参数,这样head插件可以访问es。设置参数的时候:后面要有空格
http.cors.enabled: true
http.cors.allow-origin: "*"

(2)修改Head插件配置文件

[es@node1 elasticsearch-head-master]$ vi Gruntfile.js

找到connect:server,添加hostname一项,如下

connect: {
                        server: {
                                options: {
                                        hostname: ‘node1‘,
                                        port: 9100,
                                        base: ‘.‘,
                                        keepalive: true
                                }
                        }
                }

2.4 启动

(1)启动elasticsearch
首先确认elasticsearch已经启动

[es@node1 elasticsearch-6.1.1]$ bin/elasticsearch -d
[es@node1 elasticsearch-6.1.1]$ jps
3451 Jps
3436 Elasticsearch
[es@node1 elasticsearch-6.1.1]$

(2)启动head
通过命令grunt server启动head

[[email protected] elasticsearch-head-master]$ grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://node1:9100

或者通过命令npm run start也可以启动head

[[email protected] elasticsearch-head-master]$ npm run start

> [email protected]0.0.0 start /home/es/elasticsearch-head-master
> grunt server

Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://node1:9100

(3)访问9100端口
http://node1:9100/


如果出现“未连接”,请修改localhost为node1,然后单击“连接”按钮

2.5 简单应用

(1)创建索引

[root@node1 ~]# curl -XPUT node1:9200/test
{"acknowledged":true,"shards_acknowledged":true,"index":"test"}[root@node1 ~]# 

(2)查看head变化

原文地址:https://www.cnblogs.com/wangzhuxing/p/9352258.html

时间: 2024-11-12 15:08:34

Cenos7安装ES head6.3.1的相关文章

elasticsearch安装, es插件安装, http接口调用

1,elasticsearch的安装 1,es启动时需要使用非root用户,所有创建一个bigdata用户(如果是root用户安装的话,启动时会有提示 elastic could not run a root的报错): #创建用户 useradd bigdata #为hadoop用户添加密码: echo 123456 | passwd --stdin bigdata #将bigdata添加到sudoers echo "bigdata ALL = (root) NOPASSWD:ALL"

centos安装ES(elasticsearch)

1.下载(版本为elasticsearch-6.5.4): https://www.elastic.co/downloads/elasticsearch 2.上传至服务/user/local目录 3.解压 tar -zxf elasticsearch-6.5.4.tar.gz mv elasticsearch-6.5.4 elasticsearch cd elasticsearch 4.创建Elasticsearch用户和所在组 Elasticsearch默认是不允许root用户运行的,不管是E

Elasticsearch --- 01 java , elasticsearch, kibana 的下载安装,es初识

一java 的安装下载 1.下载 官网地址 2.安装(进行默认安装,都选下一步) 3.配置环境变量 4.添加path (可不加) 5.测试 二.  elasticsearch 的安装下载 1. 下载 2.安装,启动 3.测试 4.可能出现的问题 三.  kibana 安装,下载 1.下载 2.安装,启动 3.测试 4.可能出现的问题 四.es初识 1.基本概念 文档的特性:自我包含,层次型.结构灵活.无模式 类型:在es6.x版本开始,一个索引下面只能有一个类型,类型是是文档的容器,并且,类型记

linux 安装 es

创建用户 从5.0开始,ElasticSearch 安全级别提高了,不允许采用root帐号启动,所以我们要添加一个用户 1 创建 elasticsearch 用户组 [email protected] ~]# groupadd elasticsearch 2 创建用户 es 并设置密码为es [[email protected] ~]# useradd es [[email protected] ~]# passwd es 3 用户es 添加到 elasticsearch 用户组 [[email

centos 安装es

第一步:必须要有jre支持 elasticsearch是用Java实现的,跑elasticsearch必须要有jre支持,所以必须先安装jre 第二步:下载elasticsearch 进入官方下载 https://www.elastic.co/downloads/elasticsearch 因为是centos中运行 所以我们选 tar.gz压缩包:下载后 用finalshell上传到centos里 我们把这个文件上传到 /home/es/下 上传成功 解压: 这里启动的报错,不能用root权限

【linux系列】cenos7安装jdk

一.下载jdk,我采用的jdk.tar.gz的安装包 二.创建jdk安装目录 三.安装包解压 四.jdk环境变量配置 五.使配置的环境变量生效 六.检查jdk是否安装成功

CenOs7安装oracle图文详细过程(01)

1.检查必要的安装包是否安装 命令脚本: rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat  unixODBC unix

centos7 在docker下安装es Elasticsearch

首先安装docker 我就不多说了 如果不会按  自己百度一下 很多  这里有个官网的 可以一步一步来 传送 我安装的是 6.8.1 1. docker pull elasticsearch:6.8.1 2. docker images 3. docker run --name elasticsearch -d -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -p 9200:9200 -p 9300:9300 elasticsearch:6.8.1 哈哈 当然这

centos7使用docker安装es(elasticsearch)

1.安装docker依赖(已安装可以不用安装) yum install -y docker 2.搜索镜像 docker search elasticsearch 如果出现以下报错 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 执行以下代码 systemctl daemon-reload sudo service docker restart 3.拉