1 直接去官网下载rpm包安装或者下载tar包
2 服务启动后,发现打不开页面,修改yml文件即可
用rpm包安装的软件有一个特点就是不同的目录在不同文件夹,比如config文件夹根据下面进程信息查到
找到yml文件后,去掉注释并将ip修改为虚机ip
访问chrome即可
3 安装elasticsearch-head插件
按照慕课网上的教程下载master包和安装nodejs后,
[root@localhost elasticsearch-head-master]# yum install nodejs
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.njupt.edu.cn
* updates: mirrors.cn99.com
没有可用软件包 nodejs。
错误:无须任何处理
[root@localhost elasticsearch-head-master]# curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
## Installing the NodeSource Node.js 8.x LTS Carbon 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_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.pdvh1ov1pt' 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.pdvh1ov1pt'
## Cleaning up...
+ rm -f '/tmp/tmp.pdvh1ov1pt'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `sudo yum install -y nodejs` to install Node.js 8.x LTS Carbon 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
[root@localhost elasticsearch-head-master]# sudo yum install -y nodejs
已加载插件:fastestmirror
nodesource | 2.5 kB 00:00:00
nodesource/x86_64/primary_db | 39 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.njupt.edu.cn
* updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 nodejs.x86_64.2.8.12.0-1nodesource 将被 安装
--> 解决依赖关系完成
依赖关系解决
======================================================================================================================================================================================
Package 架构 版本 源 大小
======================================================================================================================================================================================
正在安装:
nodejs x86_64 2:8.12.0-1nodesource nodesource 16 M
事务概要
======================================================================================================================================================================================
安装 1 软件包
总下载量:16 M
安装大小:49 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/nodesource/packages/nodejs-8.12.0-1nodesource.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 34fa74dd: NOKEY= ] 3.4 MB/s | 14 MB 00:00:00 ETA
nodejs-8.12.0-1nodesource.x86_64.rpm 的公钥尚未安装
nodejs-8.12.0-1nodesource.x86_64.rpm | 16 MB 00:00:04
从 file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL 检索密钥
导入 GPG key 0x34FA74DD:
用户ID : "NodeSource <[email protected]>"
指纹 : 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-8.12.0-1nodesource.x86_64 1/1
验证中 : 2:nodejs-8.12.0-1nodesource.x86_64 1/1
已安装:
nodejs.x86_64 2:8.12.0-1nodesource
完毕!
[root@localhost elasticsearch-head-master]# node -v
v8.12.0
[root@localhost elasticsearch-head-master]# npm install
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: Use the built-in module in node 9.0.0 or newer, instead
> [email protected] install /root/elasticsearch-head/elasticsearch-head-master/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...
[==--------------------------------------] 4%
^C
[root@localhost elasticsearch-head-master]# npm install
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] license should be a valid SPDX license expression
audited 1750 packages in 7.391s
found 23 vulnerabilities (17 low, 6 high)
run `npm audit fix` to fix them, or `npm audit` for details
[root@localhost elasticsearch-head-master]#
[root@localhost elasticsearch-head-master]# npm run start
> [email protected] start /root/elasticsearch-head/elasticsearch-head-master
> grunt server
(node:25855) ExperimentalWarning: The http2 module is an experimental API.
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
^C
[root@localhost elasticsearch-head-master]# ps -ef|grep java
elastic+ 26668 1 9 16:11 ? 00:00:53 /bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.acV6mTPj -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/elasticsearch -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:/var/log/elasticsearch/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.distribution.flavor=default -Des.distribution.type=rpm -cp /usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid --quiet
root 27538 3767 0 16:20 pts/1 00:00:00 grep --color=auto java
[root@localhost elasticsearch-head-master]#
[root@localhost elasticsearch-head-master]#
[root@localhost elasticsearch-head-master]#
[root@localhost elasticsearch-head-master]# npm run start
发现存在跨域问题,在elasticsearch.yaml中增加一下两行,注意冒号后要有空格。
修改完后,关闭到head进程和elasticsearch进程,分别启动head进程和elasticsearch进程。访问head进程,如下, 集群健康值green