1
- # lua-resty- influxdb-relay
1
+ # lua-influxdb-relay
2
2
A Lua resty service to replicate InfluxDB data for high availability
3
3
4
4
Table of Contents
@@ -19,27 +19,19 @@ Synopsis
19
19
========
20
20
``` lua
21
21
# ---- ----- copy relay configuration file -----------
22
- cp - av / path / to / lua - resty - influxdb - relay / lib / relay / lua - resty - influxdb - relay .ini .demo / tmp / lua - resty - influxdb - relay .ini
22
+ cp - av / path / to / lua - influxdb - relay / lib / relay / lua - influxdb - relay .ini .demo / tmp / lua - influxdb - relay .ini
23
23
24
24
# ---- ----- relay config begin --------------
25
25
lua_code_cache on ;
26
- lua_package_path " /path/to/openresty/lualib/?.lua;/path/to/lua-resty- influxdb-relay/lib/?.lua;;" ;
26
+ lua_package_path " /path/to/openresty/lualib/?.lua;/path/to/lua-influxdb-relay/lib/?.lua;;" ;
27
27
lua_package_cpath " /path/to/openresty/lualib/?.so;;" ;
28
28
lua_shared_dict relay 1 m;
29
- init_by_lua_file ' /path/to/lua-resty- influxdb-relay/lib/relay/init.lua' ;
29
+ init_by_lua_file ' /path/to/lua-influxdb-relay/lib/relay/init.lua' ;
30
30
# ---- ----- relay config end ----------------
31
31
32
- upstream backend_master {
33
- server 127.0 .0.1: 8086 ;
34
- }
35
-
36
- upstream backend_slave {
37
- server 127.0 .0.1: 18086 ;
38
- }
39
-
40
- upstream backend_relay {
41
- server 127.0 .0.1: 8086 ;
42
- server 127.0 .0.1: 18086 ;
32
+ upstream backend_query {
33
+ server 127.0 .0.1:8086 ;
34
+ server 127.0 .0.1:8087 ;
43
35
}
44
36
45
37
server {
@@ -48,44 +40,44 @@ Synopsis
48
40
49
41
location = / write {
50
42
set $backend_uri_args ' ' ;
51
- rewrite_by_lua_file ' /path/to/lua-resty- influxdb-relay/lib/relay/rewrite.lua' ;
43
+ rewrite_by_lua_file ' /path/to/lua-influxdb-relay/lib/relay/rewrite.lua' ;
52
44
}
53
45
54
46
location = / query {
55
- proxy_pass http :// backend_relay ;
47
+ proxy_pass http :// backend_query ;
56
48
proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for ;
57
49
proxy_set_header Host $http_host ;
58
50
proxy_set_header X - Real - IP $remote_addr ;
59
51
proxy_set_header Connection " " ;
60
52
proxy_http_version 1.1 ;
61
53
62
- rewrite_by_lua_file ' /path/to/lua-resty- influxdb-relay/lib/relay/rewrite_query.lua' ;
54
+ rewrite_by_lua_file ' /path/to/lua-influxdb-relay/lib/relay/rewrite_query.lua' ;
63
55
}
64
56
65
- location = / relay_master {
57
+ location = / relay1 {
66
58
internal ;
67
59
68
- proxy_pass http :// backend_master ;
60
+ proxy_pass http :// 127.0 .0.1: 8086 ;
69
61
proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for ;
70
62
proxy_set_header Host $http_host ;
71
63
proxy_set_header X - Real - IP $remote_addr ;
72
64
proxy_set_header Connection " " ;
73
65
proxy_http_version 1.1 ;
74
66
75
- rewrite_by_lua_file ' /path/to/lua-resty- influxdb-relay/lib/relay/rewrite_relay.lua' ;
67
+ rewrite_by_lua_file ' /path/to/lua-influxdb-relay/lib/relay/rewrite_relay.lua' ;
76
68
}
77
69
78
- location = / relay_slave {
70
+ location = / relay2 {
79
71
internal ;
80
72
81
- proxy_pass http :// backend_slave ;
73
+ proxy_pass http :// 127.0 .0.1: 8087 ;
82
74
proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for ;
83
75
proxy_set_header Host $http_host ;
84
76
proxy_set_header X - Real - IP $remote_addr ;
85
77
proxy_set_header Connection " " ;
86
78
proxy_http_version 1.1 ;
87
79
88
- rewrite_by_lua_file ' /path/to/lua-resty- influxdb-relay/lib/relay/rewrite_relay.lua' ;
80
+ rewrite_by_lua_file ' /path/to/lua-influxdb-relay/lib/relay/rewrite_relay.lua' ;
89
81
}
90
82
91
83
}
@@ -96,7 +88,7 @@ Synopsis
96
88
Installation
97
89
============
98
90
99
- lua-resty- influxdb-relay use [ lua-resty-ini] ( https://github.com/doujiang24/lua-resty-ini ) to parse the ini configuration.
91
+ lua-influxdb-relay use [ lua-resty-ini] ( https://github.com/doujiang24/lua-resty-ini ) to parse the ini configuration.
100
92
And you should install it with [ opm] ( https://github.com/openresty/opm#readme ) just like that: opm install doujiang24/lua-resty-ini
101
93
102
94
[ Back to TOC] ( #table-of-contents )
0 commit comments