forked from veepee-oss/influxdb-relay
-
Notifications
You must be signed in to change notification settings - Fork 26
/
rwha-sample.influxdb-srelay.conf
187 lines (167 loc) · 6.56 KB
/
rwha-sample.influxdb-srelay.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
###############################
##
## InfluxDB Single instances Config
##
###############################
# InfluxDB Backend InfluxDB01
[[influxdb]]
name = "myinfluxdb01"
location = "http://myinfluxdb01_server:8086/"
timeout = "10s"
# InfluxDB Backend InfluxDB02
[[influxdb]]
name = "myinfluxdb02"
location = "http://myinfluxdb02_server:8086/"
timeout = "10s"
#################################
##
## InfluxDB Cluster Configs as a set
## of influxdb Single Instances
##
#################################
# Cluster for linux Metrics
[[influxcluster]]
# name = cluster id for route configs and logs
name = "ha_cluster"
# members = array of influxdb backends
members = ["myinfluxdb01","myinfluxdb02"]
# where to write logs for all operations in the cluster
log-file = "ha_cluster.log"
# log level could be
# "panic","fatal","Error","warn","info","debug"
log-level = "info"
# mode = of query and send data
# * HA :
# input write data will be sent to all members
# queries will be sent on the active node with
# data if query-router-endpoint-api config exist, else the first
# * Single:
# input write data will be sent on the first member ( should be only one)
# query will be sent on the only first member (should be only one)
# * LB: // NOT IMPLEMENTED YET //
type = "HA"
# query-router-endpoint-api:
# List of API url which give us the name of the influxdb backend available with all available data (when recovery process)
# use any available sync tool as in https://github.com/toni-moreno/syncflux if needed
#
query-router-endpoint-api = ["http://myinfluxdb01_server:4090/api/queryactive","http://myinfluxdb02_server:4090/api/queryactive"]
# HTTP Server
[[http]]
name = "ha-relay"
bind-addr = "0.0.0.0:9096"
log-file = "http_harelay_9096.log"
log-level = "info"
access-log = "ha_access.log"
rate-limit = 1000000
burst-limit = 2000000
## Define endpoints base config
## endpoints can have read and write properties
## Example: /query endpoint
## There are 2 routes that must do a read query against a cluster
## It expects that each HTTP request tries each route. If it fits the filter it will be enrouted
## All requests that doesn't pass through the filter tries the next route
#
# IQL /query Endpoint
#
[[http.endpoint]]
uri=["/query"]
# type
# * RD = http for query db
# * WR = http for send data to the db
type="RD"
# source_format
# Supported formats
# * ILP = influxdb-line-protocol
# * prom-write = prometheus write format
# * IQL = Influx Query Language
source_format="IQL"
## READ request - linux_METRICS
[[http.endpoint.route]]
name="any_read"
# level:
# * http => all following rules will work only with http params
# * data => any of the following rules will need data inspection
level="http" # http or data
# true => will use the endpoint log as this route log
# false => will use its own log file , if not set the name <logdir>/http_route_<route_name>.log
log-inherit = false
#log-file = "query_route_linux_metrics.log"
log-level = "info"
## Filter only the request with db param = linux_metrics
[[http.endpoint.route.filter]]
name="pass_all"
#------------------------------------------------------------------------------------
# Key for filter usage could be only at http level parameters (header/query)
# Header based
# -------------
# * authorization: Authorization Header
# * remote-address: Remote Address Header
# * referer: Referer Header
# * user-agent: User-Agent Header
# Query Based
# -------------
# (https://docs.influxdata.com/influxdb/v1.7/guides/querying_data/)
# (https://docs.influxdata.com/influxdb/v1.7/tools/api/#write-http-endpoint)
# * db [r/w]: InfluxDB to read / Write
# * q [r]: InfluxQL query
# * epoch [r]: precision on read queries
# * precision [w] : precision on write queries
# * chunked [r]: (see referenced doc)
# * chunksize[r]: (see referenced doc)
# * pretty[r]:(see referenced doc)
# * u [r/w]: read/write user
# * p [r/w]: read/write password
# * rp[w]: retention policy
# * consistency[w]: (see referenced doc)
# Computed
# * username: computed from authorization header or u parameters
# Key for Rule Usage (not this level) could be also data level parameters
# * measurement: match the measurement name
# * tag: match the tag value with tag key in key_aux
# * field: match the field value with field key in key_aux (always as string!!!! at this level)
# ----------------------------------------------------------------------------------------------
key="db" #availabe http params
match=".*"
## Rule to route to cluster_linux
[[http.endpoint.route.rule]]
name="route_all"
# Action Route
# * route:
# If key value (usually http level key) match with match parameter, The complete
# request will be sent to the cluster configured in to_cluster param
# Next rule step will have untouched data available for any other process
# * route_db_from_data (enable multitenancy)
# Will rename de db parameter depending for each point in data depending on
# the matching with one point parameter , by example one tag, enable write data
# to several databases (split data) from the same source.
# with this rule 1 HTTP request will become N HTTP request to our backends
# HTTP response will be logged without feedback with the original request
# Next rule step will have untouched data available for any other process
# * rename_http
# * rename_data
# * drop_data
# * break"
action="route"
# See
key="db"
match=".*"
to_cluster="ha_cluster"
[[http.endpoint]]
uri=["/write"]
source_format="ILP"
type = "WR"
## WRITE request - windows
[[http.endpoint.route]]
name="any_write"
level="http"
[[http.endpoint.route.filter]]
name="pass_all"
key="db"
match=".*"
## Send to PMEREASP15 cluster
[[http.endpoint.route.rule]]
name="route_all"
action="route"
key="db"
match=".*"
to_cluster="ha_cluster"