openstack-ansible-ops/cluster_metrics/playbook-metrics-lb.yml
Nish Patwa 17450f35f3 Adding influx relay to make the existing monitoring stack highly available
Added Influxdb relay to make the existing monitoring stack highly
available. Relay replicates the data to multiple database instances.
Also added configutation in HAProxy that load balances the read queries
to influxdb instances and write queries to influxdb relays

        ┌─────────────────┐
        │writes & queries │
        └─────────────────┘
                 │
                 ▼
         ┌───────────────┐
         │               │
┌────────│ Load Balancer │─────────┐
│        │               │         │
│        └──────┬─┬──────┘         │
│               │ │                │
│               │ │                │
│        ┌──────┘ └────────┐       │
│        │ ┌─────────────┐ │       │┌──────┐
│        │ │/write or UDP│ │       ││/query│
│        ▼ └─────────────┘ ▼       │└──────┘
│  ┌──────────┐      ┌──────────┐  │
│  │ InfluxDB │      │ InfluxDB │  │
│  │ Relay    │      │ Relay    │  │
│  └──┬────┬──┘      └────┬──┬──┘  │
│     │    |              |  │     │
│     |  ┌─┼──────────────┘  |     │
│     │  │ └──────────────┐  │     │
│     ▼  ▼                ▼  ▼     │
│  ┌──────────┐      ┌──────────┐  │
│  │          │      │          │  │
└─▶│ InfluxDB │      │ InfluxDB │◀─┘
   │          │      │          │
   └──────────┘      └──────────┘

This patch is dependent on this patch:
https://review.openstack.org/#/c/392328/

Change-Id: I05bdaa0e2fb251b48df1d26d09ad63942872293a
2016-11-10 15:54:56 +00:00

82 lines
2.9 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Add haproxy config
hosts: haproxy
gather_facts: true
user: root
roles:
- role: "haproxy_server"
haproxy_service_configs:
- service:
haproxy_service_name: influxdb_admin
haproxy_backend_nodes: "{{ groups['cluster-metrics'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 8083
haproxy_balance_type: tcp
haproxy_backend_options:
- tcp-check
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
- service:
haproxy_service_name: influxdb
haproxy_backend_nodes: "{{ groups['cluster-metrics'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 8086
haproxy_backend_port: 8086
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /ping"
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
haproxy_acls:
read_queries:
rule: "path_sub -i query"
write_queries:
rule: "path_sub -i write"
backend_name: "influxdb_relay"
- service:
haproxy_service_name: influxdb_relay
haproxy_backend_nodes: "{{ groups['cluster-metrics'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 8086
haproxy_backend_port: 9096
haproxy_balance_type: http
haproxy_backend_options:
- tcp-check
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
haproxy_acls:
write_queries:
rule: "path_sub -i write"
read_queries:
rule: "path_sub -i query"
backend_name: "influxdb"
- service:
haproxy_service_name: grafana
haproxy_backend_nodes: "{{ groups['cluster-metrics'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 8089
haproxy_balance_type: tcp
haproxy_backend_options:
- tcp-check