#一、安装配置head监控插件(Web前端)----只需要在一台上安装
#安装node
[root@hd-kib-3 ~]# tar xzf node-v4.4.7-linux-x64.tar.gz -C /usr/local/
[root@hd-kib-3 ~]# mv /usr/local/node-v4.4.7-linux-x64/ /usr/local/node
[root@hd-kib-3 node]# vim /etc/profile
NODE_HOME=/usr/local/node
PATH=$NODE_HOME/bin:$PATH
export NODE_HOME PATH
[root@hd-kib-3 node]# source /etc/profile
[root@hd-kib-3 node]# node --version
v4.4.7
#配置head插件
[root@hd-kib-3 ~]# cp master.zip /usr/local/
[root@hd-kib-3 ~]# cd /usr/local/
[root@hd-kib-3 local]# unzip master.zip
[root@hd-kib-3 local]# cd elasticsearch-head-master/
[root@hd-kib-3 elasticsearch-head-master]# npm install -g grunt-cli #安装grunt
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN engine [email protected]: wanted: {"node":">= 4.5.0"} (current: {"node":"4.4.7","npm":"2.15.8"})
/usr/local/node/bin/grunt -> /usr/local/node/lib/node_modules/grunt-cli/bin/grunt
[email protected] /usr/local/node/lib/node_modules/grunt-cli
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[root@hd-kib-3 elasticsearch-head-master]# grunt --version
grunt-cli v1.3.2
[root@hd-kib-3 elasticsearch-head-master]# vim Gruntfile.js
connect: {
server: {
options: {
port: 9100,
base: '.',
keepalive: true, #注意这里添加逗号
hostname: '*' #添加此行
}
}
}
#如果head和ES不在同一个节点,注意把localhost修改成ES的IP地址
[root@hd-kib-3 elasticsearch-head-master]# vim _site/app.js
4374 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.1.14:9200";
#安装head必要文件
[root@hd-kib-3 elasticsearch-head-master]# cd
[root@hd-kib-3 ~]# tar xjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /tmp/
#运行head
[root@hd-kib-3 ~]# cd /usr/local/elasticsearch-head-master/
[root@hd-kib-3 elasticsearch-head-master]# npm config set registry https://registry.npm.taobao.org
[root@hd-kib-3 elasticsearch-head-master]# npm install
[root@hd-kib-3 elasticsearch-head-master]# nohup grunt server &
[1] 21403
[root@hd-kib-3 elasticsearch-head-master]# tailf nohup.out
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
###访问测试http://192.168.1.12:9100/
#二、Kibana部署
[root@hd-kib-3 ~]# tar xzf kibana-6.5.4-linux-x86_64.tar.gz -C /usr/local/
[root@hd-kib-3 ~]# cd /usr/local/
[root@hd-kib-3 local]# mv kibana-6.5.4-linux-x86_64/ kibana
[root@hd-kib-3 local]# cd kibana/
[root@hd-kib-3 kibana]# vim config/kibana.yml
server.port: 5601 #服务端口,默认5601
server.host: "192.168.1.12" #主机IP地址,默认localhost
elasticsearch.url: "http://192.168.1.14:9200" #用来做查询的ES节点的URL,默认http://localhost:9200
kibana.index: ".kibana" #kibana在Elasticsearch中使用索引来存储保存的searches, visualizations和dashboards,默认.kibana
[root@hd-kib-3 kibana]# nohup ./bin/kibana &
[2] 21536
[root@hd-kib-3 kibana]# tail -f nohup.out
#配置反向代理
[root@hd-kib-3 kibana]# vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[root@hd-kib-3 kibana]# yum -y install nginx
[root@hd-kib-3 kibana]# vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name 192.168.1.12;
#charset koi8-r;
# access_log /var/log/nginx/host.access.log main;
# access_log off;
location / {
proxy_pass http://192.168.1.12:5601;
proxy_set_header Host $host:5601;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Via "nginx";
}
location /status {
stub_status on; #开启网站监控状态
access_log /var/log/nginx/kibana_status.log; #监控日志
auth_basic "NginxStatus"; }
location /head/{
proxy_pass http://192.168.1.12:9100;
proxy_set_header Host $host:9100;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Via "nginx";
}
}
[root@hd-kib-3 kibana]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@hd-kib-3 kibana]# nginx
###访问测试http://192.168.1.12/