elasticsearch7 安装 elasticsearch-head
作者:互联网
目的
安装 elasticsearch-head
elasticsearch 7.x 已经无法直接调用 plugin 进行 elasticsearch-head 安装, 参考下面安装步骤
1 下载 git
# git clone https://github.com/mobz/elasticsearch-head
2 添加 yum 源
/etc/yum.repso.d/yarn.repo
[yarn]
name=Yarn Repository
baseurl=https://dl.yarnpkg.com/rpm/
enabled=1
gpgcheck=0
gpgkey=https://dl.yarnpkg.com/rpm/pubkey.gpg
3 下载 nodejs
# curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
## Installing the NodeSource Node.js 10.x repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m
## Confirming "el7-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.sy79c77aLt' 'https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.sy79c77aLt'
## Cleaning up...
+ rm -f '/tmp/tmp.sy79c77aLt'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `sudo yum install -y nodejs` to install Node.js 10.x and npm.
## You may also need development tools to build native addons:
sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
4 按照提示安装 yarn
先安装 gcc-c++ 与 make
[root@ns-yun-020064 git]# yum install gcc-c++ make
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
epel/x86_64/metalink | 2.2 kB 00:00:00
base | 3.6 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
nodesource | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
nodesource/x86_64/primary_db | 49 kB 00:00:01
软件包 gcc-c++-4.8.5-28.el7_5.1.x86_64 已安装并且是最新版本
软件包 1:make-3.82-23.el7.x86_64 已安装并且是最新版本
无须任何处理
5 直接 RPM 方法安装 nodejs
# yum install yarn -y
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
epel/x86_64/metalink | 2.2 kB 00:00:00
base | 3.6 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
nodesource | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
yarn | 2.9 kB 00:00:00
(1/2): yarn/primary_db | 22 kB 00:00:00
(2/2): nodesource/x86_64/primary_db | 49 kB 00:00:02
正在解决依赖关系
--> 正在检查事务
---> 软件包 yarn.noarch.0.1.22.5-1 将被 安装
--> 正在处理依赖关系 nodejs,它被软件包 yarn-1.22.5-1.noarch 需要
--> 正在检查事务
---> 软件包 nodejs.x86_64.2.10.23.0-1nodesource 将被 安装
--> 解决依赖关系完成
依赖关系解决
==============================================================================================================================
Package 架构 版本 源 大小
==============================================================================================================================
正在安装:
yarn noarch 1.22.5-1 yarn 1.2 M
为依赖而安装:
nodejs x86_64 2:10.23.0-1nodesource nodesource 20 M
事务概要
==============================================================================================================================
安装 1 软件包 (+1 依赖软件包)
总下载量:21 M
安装大小:66 M
Downloading packages:
(1/2): yarn-1.22.5-1.noarch.rpm | 1.2 MB 00:00:02
警告:/var/cache/yum/x86_64/7/nodesource/packages/nodejs-10.23.0-1nodesource.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 34fa74dd: NOKEY
nodejs-10.23.0-1nodesource.x86_64.rpm 的公钥尚未安装
(2/2): nodejs-10.23.0-1nodesource.x86_64.rpm | 20 MB 00:00:12
------------------------------------------------------------------------------------------------------------------------------
总计 1.7 MB/s | 21 MB 00:00:12
从 file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL 检索密钥
导入 GPG key 0x34FA74DD:
用户ID : "NodeSource <gpg-rpm@nodesource.com>"
指纹 : 2e55 207a 95d9 944b 0cc9 3261 5ddb e8d4 34fa 74dd
软件包 : nodesource-release-el7-1.noarch (installed)
来自 : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在安装 : 2:nodejs-10.23.0-1nodesource.x86_64 1/2
正在安装 : yarn-1.22.5-1.noarch 2/2
验证中 : yarn-1.22.5-1.noarch 1/2
验证中 : 2:nodejs-10.23.0-1nodesource.x86_64 2/2
已安装:
yarn.noarch 0:1.22.5-1
作为依赖被安装:
nodejs.x86_64 2:10.23.0-1nodesource
完毕!
6 验证 node 版本
# node -v
v10.23.0
# npm -v
6.14.8
7 安装 grunt-cli
# npm install -g grunt-cli
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
/usr/bin/grunt -> /usr/lib/node_modules/grunt-cli/bin/grunt
+ grunt-cli@1.3.2
added 153 packages from 126 contributors in 64.745s
8 安装 elasticsearch-head
# cd /usr/src/git/elasticsearch-head
# npm install
npm WARN deprecated http2@3.3.7: Use the built-in module in node 9.0.0 or newer, instead
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 core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated coffee-script@1.10.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated json3@3.2.6: Please use the native JSON object instead of JSON 3
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
> phantomjs-prebuilt@2.1.16 install /usr/src/git/elasticsearch-head/node_modules/phantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
[========================================] 100%
Received 22866K total.
Extracting tar contents (via spawned process)
Removing /usr/src/git/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1606793124348/phantomjs-2.1.1-linux-x86_64 -> /usr/src/git/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /usr/src/git/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
> core-js@2.6.12 postinstall /usr/src/git/elasticsearch-head/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for karma@1.3.0: wanted: {"node":"0.10 || 0.12 || 4 || 5 || 6"} (current: {"node":"10.23.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: karma@1.3.0
npm WARN notsup Unsupported engine for http2@3.3.7: wanted: {"node":">=0.12.0 <9.0.0"} (current: {"node":"10.23.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: http2@3.3.7
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: 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
added 519 packages from 631 contributors and audited 521 packages in 1182.206s
5 packages are looking for funding
run `npm fund` for details
found 52 vulnerabilities (26 low, 2 moderate, 24 high)
run `npm audit fix` to fix them, or `npm audit` for details
9 修改配置 /etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
10 重启整个 elasticsearch
每次重启一台服务器
# systemctl stop elasticsearch.service
# systemctl start elasticsearch.service
重启后, 监控状态是否会变回去 green , 然后再重启另外一台服务器
监控集群状态方法
while [ 1 ]; do curl 'http://localhost:9200/_cat/health?format=json&pretty' ; sleep 3; done
11 启动 ealsticearch-head 服务
./node_modules/grunt/bin/grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
启动后可以连连接对应机器 9100 端口进行访问
默认 localhost:9200 需要修改为 IP 地址连接
12 grunt.service 启动脚本
[Unit]
Description=elasticsearch head web app
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
WorkingDirectory=/usr/src/git/elasticsearch-head/
ExecStart=/bin/sh -c "/usr/src/git/elasticsearch-head/node_modules/grunt/bin/grunt server &"
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=60
RestartSec=30
KillMode=process
Restart=on-failure
CPUShares=2
MemoryLimit=2G
BlockIOWeight=100
CPUQuota=100%
[Install]
WantedBy=multi-user.target
标签:node,head,x86,00,elasticsearch7,64,elasticsearch,rpm 来源: https://blog.csdn.net/signmem/article/details/110432349