IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> elasticsearch-head插件基于elasticsearch-7.13.4安装 -> 正文阅读

[大数据]elasticsearch-head插件基于elasticsearch-7.13.4安装


对于head插件,由于现在我们的es版本为7.13.4,在之前5以下的版本安装的时候只需要通过插件就能安装。而大于5的版本,则需要安装node,并需要提前安装grunt,之后通过npm的方式才能安装。

1.安装node.js

nodejs的最新版本下载路径https://nodejs.org/en/download/current/。
image.png

选择对应的操作系统即可。我们采用的是centos7,x64操作系统,因此我们选择linux 的x64二进制版本下载即可。
下载的最新版本文件为:
node-v16.5.0-linux-x64.tar.xz
将上述文件上传到/opt/software目录。

由于采用的是xz压缩,因此先要通过xz解压
xz -d node-v16.5.0-linux-x64.tar.xz 
mkdir /opt/node 
cd /opt/node
tar -xvf /opt/software/node-v16.5.0-linux-x64.tar

最终得到的node_home为/opt/node/node-v16.5.0-linux-x64

环境变量配置,由于我们目前只需要在elastic中使用nodejs,因此我们只在elastic用户下面来配置环境变量:

NODE_HOME=/opt/node/node-v16.5.0-linux-x64
export PATH=.:$NODE_HOME/bin:$PATH
export NODE_PATH=/home/elastic/node_modules

此时nodejs安装的modules目录为/home/elastic/nodejs_modules,读者可以根据自己的需要自行决定安装目录。
检查一下安装情况:

[elastic@m162p201 ~]$ node -v
v16.5.0
[elastic@m162p201 ~]$ npm -v
7.19.1

2.安装依赖的npm包

cd /home/elastic
git clone https://github.com/mobz/elasticsearch-head.git

cd elasticsearch-head

npm install  grunt --registry=https://registry.npm.taobao.org

上述执行完成之后,在elasticsearch-head中运行install

[elastic@m162p201 elasticsearch-head]$ npm install
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'karma@1.3.0',
npm WARN EBADENGINE   required: { node: '0.10 || 0.12 || 4 || 5 || 6' },
npm WARN EBADENGINE   current: { node: 'v16.5.0', npm: '7.19.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'http2@3.3.7',
npm WARN EBADENGINE   required: { node: '>=0.12.0 <9.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.5.0', npm: '7.19.1' }
npm WARN EBADENGINE }
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated json3@3.2.6: Please use the native JSON object instead of JSON 3
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated http2@3.3.7: Use the built-in module in node 9.0.0 or newer, instead
npm WARN deprecated coffee-script@1.10.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)

added 525 packages, and audited 526 packages in 2m

5 packages are looking for funding
  run `npm fund` for details

39 vulnerabilities (6 low, 7 moderate, 25 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

安装过程中提示版本过低,需要升级:

[elastic@m162p201 elasticsearch-head]$  npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm WARN audit Updating http-proxy to 1.18.1,which is outside your stated dependency range.
npm WARN audit Updating grunt to 1.4.1,which is outside your stated dependency range.
npm WARN audit Updating grunt-contrib-watch to 1.1.0,which is outside your stated dependency range.
npm WARN audit Updating grunt-karma to 4.0.2,which is a SemVer major change.
npm WARN audit Updating karma to 6.3.4,which is a SemVer major change.
npm WARN audit Updating grunt-contrib-jasmine to 3.0.0,which is a SemVer major change.

added 312 packages, removed 307 packages, changed 75 packages, and audited 531 packages in 2m

26 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

3.elasticsearch-head 配置

Gruntfile.js中修改为如下配置:

connect: {
                    server: {
                            options: {
                                    hostname: "192.168.162.201",
                                    port: 9100,
                                    base: '.',
                                    keepalive: true
                            }
                    }
            }

这是head插件的监听IP和端口。
之后修改:
/home/elastic/elasticsearch-head/_site/app.js

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.162.201:9200";

这个配置就完成了。

4.elasticsearch的跨域问题

此外还需要在elasticsearch中增加支持跨域访问的配置,否则,head插件将无法连接到es。
image.png

我们修改跨域配置之后再连接:
在/home/elastic/node201/config/elasticsearch.yml中增加如下内容:

# 是否支持跨域
http.cors.enabled: true

# *表示支持所有域名
http.cors.allow-origin: "*"

重启elasticsearch。

4.启动head插件

nohup /home/elastic/elasticsearch-head/node_modules/grunt/bin/grunt server &

启动之后访问http://192.168.162.201:9100/效果如下图:
image.png

  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2021-07-30 22:44:58  更:2021-07-30 22:45:15 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/4 10:52:04-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码