分布式ELK平台 、 ES集群安装及其扩展插件、 Kibana安装与使用 、 Logstash配置扩展插件

ELK整体工作流程

在这里插入图片描述
ELK是一套解决方案,是三个软件产品的首字母的缩写
ELK分别代表
Elasticsearch:负责日志检索和储存
Logstash:负责日志的收集和分析、处理
Kibana:负责日志的可视化

ELK组件在海量日志系统的运维中,可用于解决:
分布式日志数据集中式查询和管理
系统监控,包含系统硬件和应用各个组件的监控
故障排查
安全信息和事件管理
报表功能

搭建ELK如下:

一、安装ES集群(跳板机上操作)

操作环境,一台跳板机和五台elasticsearch集群机器
前提是已经有ansible、有elasticsearch.yml文件,否则只能手动安装
1.修改/etc/hosts文件,使其能够ping主机名
2.编写ansible剧本

[root@ecs-mao1 ~]# cat eess.yml 
---
- hosts: eess   //节点
  tasks: 
    - name: copy
      copy:
        src: /etc/hosts
        dest: /etc/hosts
        owner: root
        group: root
        mode: 0644
    - name: install
      yum:
        name: java-1.8.0-openjdk.x86_64,elasticsearch
        state: latest
    - name: es版本
      template:
        src: elasticsearch.yml
        dest: /etc/elasticsearch/elasticsearch.yml
        owner: bin
        group: wheel
        mode: 0644
      notify:
        - re 
  handlers:
    - name: re
      service:
        name: elasticsearch
        state: started
        enabled: yes

template模块能够复制带有变量的文本

[root@ecs-mao1 ~]# cat elasticsearch.yml  | grep hostname
node.name: {
   {
    ansible_hostname  }}

ansible_hostname是setup模块里面的,显示主机名

[root@ecs-mao1 ~]# ansible eess -m setup | grep hostname
        "ansible_hostname": "eess-0001", 
        "ansible_hostname": "eess-0002",

3.运行剧本

[root@ecs-mao1 ~]# ansible-playbook eess.yml

其结果显示成功

4.测试结果(es集群操作)

[root@eess-0001 ~]# curl  http://192.168.1.111:9200/_cluster/health?pretty  //任意节点都可以

”status”: ”green“ 集群状态:绿色为正常、黄色表示有问题但不是很严重、红色表示严重故障
”number_of_nodes”: 5, 表示集群中节点的数量

二、安装HEAD等插件

所有的插件都在跳板机的ftp文件里面
插件装在哪一台机器上,只能在哪台机器上使用
安装插件

[root@ecs-mao1 ~]# cat es1.yml 
---
- hosts: eess   //节点
  tasks: 
   - name: XX
     shell: /usr/share/elasticsearch/bin/plugin install ftp://192.168.1.252/public/elasticsearch-head-master.zip
   - name: xx1
     shell: /usr/share/elasticsearch/bin/plugin install ftp://192.168.1.252/public/elasticsearch-kopf-master.zip
   - name: xx2
     shell: /usr/share/elasticsearch/bin/plugin install ftp://192.168.1.252/public/bigdesk-master.zip
[root@ecs-mao1 ~]# ansible-playbook es1.yml  //运行剧本

验证操作

[root@eess-0001 bin]# ./plugin  list    //查看安装的插件
Installed plugins in /usr/share/elasticsearch/plugins:
    - head
    - kopf
    - bigdesk

访问三个插件网页

[root@eess-0001 bin]$ firefox http://192.168.1.55:9200/_plugin/head
[root@eess-0001 bin]$ firefox   http://192.168.1.55:9200/_plugin/kopf
[root@eess-0001 bin]$ firefox  http://192.168.1.55:9200/_plugin/bigdesk

用命令建立索引
1.建立索引文件

[root@eess-0001 ~
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值