1、操作系统基本信息
[root@elasticsearch ~]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@elasticsearch ~]# uname -r
2.6.32-696.el6.x86_64
[root@elasticsearch ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0|grep IPADDR
IPADDR=10.0.0.11 #外网地址
[root@elasticsearch ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1|grep IPADDR
IPADDR=172.16.1.11 #内网地址
#elasticsearch版本6.1.4
#必须安装JDK,对应JDK8-64,安装JDK略
#下述内容都是在同一台虚拟机中安装的
#下述都是在CentOS release 6.9 (Final)中操作的,centos7没尝试过。
安装elasticsearch6.1.4
1、安装
在https://github.com/elastic/elasticsearch中下载elasticsearch-6.1.4.tar.gz
2、配置elasticsearch.yml
[root@elasticsearch config]# pwd
/application/elastic/elasticsearch/elasticsearch/config
[root@elasticsearch config]# cat elasticsearch.yml
network.host: 0.0.0.0
http.port: 9200
3、修改启动elasticsearch时必要的系统文件参数(先执行下述“4和5”这两个步骤,如果启动有类似异常再执行这个。)
#注意下述参数值的修改是根据启动elasticsearch时抛出的异常来配置的(!!记得备份!!)
[root@elasticsearch ~]# cat /etc/security/limits.d/90-nproc.conf|grep nproc
- soft nproc 4096
root soft nproc unlimited
[root@elasticsearch ~]# cat /etc/sysctl.conf|grep vm.max_map_count
vm.max_map_count=262144
[root@elasticsearch ~]# cat /etc/security/limits.conf|grep nofile - – nofile 65536
#修改下述elasticsearch.yml参数同上述原因
[root@elasticsearch config]# pwd
/application/elastic/elasticsearch/elasticsearch/config
[root@elasticsearch config]# cat elasticsearch.yml
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
4、创建elasticsearch操作系统用户并对elasticsearch赋予elasticsearch用户权限(!!不能用root用户启动!!)
[root@elasticsearch ~]# useradd elasticsearch
[root@elasticsearch ~]# echo “123456”|passwd –stdin elasticsearch
[root@elasticsearch elasticsearch]# chown -R elasticsearch:elasticsearch elasticsearch/
5、切换elasticsearch用户并启动elasticsearch
[root@elasticsearch elasticsearch]# su elasticsearch
[elasticsearch@elasticsearch elasticsearch]$ pwd
/application/elastic/elasticsearch
[elasticsearch@elasticsearch elasticsearch]$ cd elasticsearch/bin/
[elasticsearch@elasticsearch bin]$ ./elasticsearch &
安装elasticsearch-head
1、配置node环境
[root@elasticsearch nodejs]# pwd
/application/nodejs
wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz
xz -d node-v6.9.2-linux-x64.tar.xz
tar -xf node-v6.9.2-linux-x64.tar
ln -s node-v6.9.2-linux-x64 nodejs
[root@elasticsearch ~]# cat /etc/profile
NODEJS_HOME=/application/nodejs/nodejs
PATH=$NODEJS_HOME/bin:$PATH
export NODEJS_HOME
export PATH
[root@elasticsearch ~]# source /etc/profile
[root@elasticsearch ~]# npm -v
3.10.9
[root@elasticsearch ~]# node -v
v6.9.2
2、配置grunt环境
[root@elasticsearch elasticsearch-head]# pwd
/application/elastic/elasticsearch-head
[root@elasticsearch elasticsearch-head]#unzip elasticsearch-head-master.zip
[root@elasticsearch elasticsearch-head]# cd elasticsearch-head-master
[root@elasticsearch elasticsearch-head-master]# sudo npm install grunt-contrib-concat –registry=https://registry.npm.taobao.org
[root@elasticsearch elasticsearch-head-master]# grunt -version
grunt-cli v1.2.0
grunt v1.0.1
3、修改elasticsearch配置文件
[root@elasticsearch elasticsearch]# pwd
/application/elastic/elasticsearch/elasticsearch
[root@elasticsearch elasticsearch]# vim config/elasticsearch.yml
#最后加入
http.cors.enabled: true
http.cors.allow-origin: “*”
4、下载elasticsearch-head
https://github.com/mobz/elasticsearch-head
这里就一个版本,直接git clone或到release中下载即可。
elasticsearch-head-master.zip
5、 修改elasticsearch-head配置文件
[root@elasticsearch elasticsearch-head-master]# cp Gruntfile.js Gruntfile.js.ori.20190219
[root@elasticsearch elasticsearch-head-master]# cat Gruntfile.js
connect: {
server: {
options: {
hostname: ‘10.0.0.11’, #加入这一行
port: 9100,
base: ‘.’,
keepalive: true
}
}
}
6、启动elasticsearch-head
问题列表
6、1
[root@elasticsearch elasticsearch-head-master]# grunt server &
Fatal error: Unable to find local grunt.
这个目录下执行
[root@elasticsearch elasticsearch-head-master]# npm install grunt –save-dev
6、2
[root@elasticsearch elasticsearch-head-master]# grunt server &
[root@elasticsearch elasticsearch-head-master]# >> Local Npm module “grunt-contrib-clean” not found. Is it installed?
Local Npm module “grunt-contrib-concat” not found. Is it installed?
Local Npm module “grunt-contrib-watch” not found. Is it installed?
Local Npm module “grunt-contrib-connect” not found. Is it installed?
Local Npm module “grunt-contrib-copy” not found. Is it installed?
Local Npm module “grunt-contrib-jasmine” not found. Is it installed?
Warning: Task “connect:server” not found. Use –force to continue. 这个忽略,不是错误
Aborted due to warnings.
这个目录下分别执行
[root@elasticsearch elasticsearch-head-master]#
#下面运行的时候可能会有问题,切换个网络试试
npm install grunt-contrib-clean –registry=https://registry.npm.taobao.org
npm install grunt-contrib-concat –registry=https://registry.npm.taobao.org
npm install grunt-contrib-watch –registry=https://registry.npm.taobao.org
npm install grunt-contrib-connect –registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy –registry=https://registry.npm.taobao.org
npm install grunt-contrib-jasmine –registry=https://registry.npm.taobao.org
#npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression 这个忽略,不是错误
最终运行成功标识:
[root@elasticsearch elasticsearch-head-master]# grunt server &
[1] 2964
[root@elasticsearch elasticsearch-head-master]# Running “connect:server” (connect) task
Waiting forever…
Started connect web server on http://10.0.0.11:9100
安装kibana
1、下载elasticsearch对应的的kibana版本
https://github.com/elastic/kibana/releases
这里下载的是64位的.1.4版本kibana-6.1.4-linux-x86_64.tar.gz
2、运行kibana
[root@elasticsearch bin]# ./kibana &
log [07:14:00.339] [error][admin][elasticsearch] Request error, retrying
HEAD http://127.0.0.1:9300/ => Parse Error
log [07:14:00.356] [warning][admin][elasticsearch] Unable to revive connection: http://127.0.0.1:9300/
log [07:14:00.386] [warning][admin][elasticsearch] No living connections
log [07:14:00.387] [error][status][plugin:elasticsearch@6.1.4] Status changed from red to red - Unable to connect to Elasticsear at http://127.0.0.1:9300.
log [07:14:02.912] [warning][admin][elasticsearch] Unable to revive connection: http://127.0.0.1:9300/
log [07:14:02.922] [warning][admin][elasticsearch] No living connections
#上述问题需修改kibana.yml
修改server.host: "10.0.0.11",而不是server.host: "localhost"
修改elasticsearch.url: "http://127.0.0.1:9200" 而不是elasticsearch.url: "http://localhost:9200"
重新启动访问http://10.0.0.11:5601
标题:安装elasticsearch、elasticsearch-head和kibana插件
作者:yazong
地址:https://blog.llyweb.com/articles/2019/02/25/1578152899250.html