ansible-elk-deploy: 运用 Ansible 部署 ELK 的集群。按照官方生产环境架构说明而设计。

[](#deploy-elk-stack-ready-for-production)Deploy ELK stack, ready for production.

[](#note)Note

All settings are use default value. I re-command you to have at least 3 nodes(8CPUs, 16GB memory, 128GB free disk space) to deploy your ELK cluster.

It's not ready for huge business before doing some tune up.

For test only, you can run vagrant up. You need vagrant, 22GB RAM and 22 CPUs on your single host.

[](#what-we-have-in-here)What we have in here?

  1. Easy scale and rolling upgrade for ELK stack.
  2. Consul as internal DNS service. Scale your ELK without updating the beats output configuration.
  3. Monit as monitoring service. Auto fix common issue, free you hands.

[](#tested-on-these-os-with-ansible-251)Tested on these OS with ansible 2.5.1

  • Ubuntu 16.04 LTS(xenial)
  • CentOS 7

[](#requirements)Requirements

  1. At least 4 CPUs, 8GB ram, 148G free disk space.

[](#steps)Steps

  1. Copy hosts.ini.sample to hosts.ini, and edit it base on your real environment.
  2. Run ansible-playbook 00-download.yml if you haven't got any packages.
  3. Run ansible-playbook play-all.yml to start fresh deploy.

[](#how-to-send-data-to-elk-from-outside-hosts)How to send data to ELK from outside hosts

  1. Make sure outside hosts can access the ELK network.
  2. Assume you are using beats as data collect client, use the logstash hosts' IP in output section, or you can use logstash.service.consul after you setup the [nameservers]

[](#maintain)Maintain

[](#upgrade)Upgrade

  1. Set the value of 'elk_version' in group_vars/all.yml, then run ansible-playbook 98-upgrade_elk_cluster.yml will rolling upgrade your services to the new version.

[](#read-more-in-handbook)Read more in handbook

    • *

[](#%E7%A6%BB%E7%BA%BF%E9%83%A8%E7%BD%B2-elk-%E6%9C%8D%E5%8A%A1)离线部署 ELK 服务。

[](#%E6%B3%A8%E6%84%8F)注意

本项目适用于中型生产应用,建议在 3 个节点(至少 8 CPUs,16GB 内存,128GB 可用磁盘空间)上部署。

如果需要适配更高的业务需求,请联系 新致云市场部

测试本架构,运行vagrant up(你需要 vagrant)。这将会消耗 22GB 内存和 22 个 CPU 线程。

[](#%E6%9C%AC%E9%A1%B9%E7%9B%AE%E5%9F%BA%E4%BA%8E-ansible-251-%E5%9C%A8%E4%BB%A5%E4%B8%8B%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E6%B5%8B%E8%AF%95%E9%80%9A%E8%BF%87)本项目基于 ansible 2.5.1 在以下操作系统测试通过。

  • Ubuntu 16.04 LTS(xenial)
  • CentOS 7

[](#%E5%89%8D%E6%8F%90%E6%9D%A1%E4%BB%B6)前提条件

  1. 最小配置:4 CPUs, 8GB 内存, 148G 空闲磁盘空间.

[](#%E6%89%A7%E8%A1%8C%E6%AD%A5%E9%AA%A4)执行步骤

  1. 按照 hosts.ini.sample 模板,同目录新建一个 hosts.ini 文件, 根据实际环境填写机器信息。
  2. 执行 ansible-playbook 00-download.yml 确认安装所需的文件都已经下载好。
  3. 执行 ansible-playbook play-all.yml 进行全新部署。

[](#%E8%AF%A6%E7%BB%86%E6%AD%A5%E9%AA%A4%E5%9C%A8-handbook)详细步骤在 handbook

[](#elk-%E9%9B%86%E7%BE%A4%E4%B9%8B%E5%A4%96%E7%9A%84%E6%9C%BA%E5%99%A8%E5%A6%82%E6%9E%9C%E9%9C%80%E8%A6%81%E6%8E%A8%E9%80%81%E6%95%B0%E6%8D%AE%E9%9C%80%E8%A6%81%E6%BB%A1%E8%B6%B3%E4%BB%A5%E4%B8%8B%E6%9D%A1%E4%BB%B6)ELK 集群之外的机器,如果需要推送数据,需要满足以下条件:

  1. 可访问本次部署的 ELK 集群网络。
  2. 以 beats 为例,output 可以直接使用多个 logstash 节点的 IP。也可以在配置内部 DNS 后,使用 logstash.service.consul 来访问。

[](#%E7%BB%B4%E6%8A%A4%E6%9B%B4%E6%96%B0)维护更新

[](#%E5%8D%87%E7%BA%A7)升级

  1. 修改 group_vars/all.yml 里的 elk_version 值,执行 ansible-playbook 98-upgrade_elk_cluster.yml 即可滚动升级到最新版本。

[](#%E9%B8%A3%E8%B0%A2)鸣谢

本脚本在“新致云”提供的云主机上测试通过。新致云,助你真正用好云计算。


原网址: 访问
创建于: 2018-11-07 02:21:05
目录: default
标签: 无

请先后发表评论
  • 最新评论
  • 总共0条评论