Skip to content

Commit 994112f

Browse files
committed
update rename lua-influxdb-relay
1 parent 5f49661 commit 994112f

File tree

5 files changed

+29
-41
lines changed

5 files changed

+29
-41
lines changed

README.md

+17-25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lua-resty-influxdb-relay
1+
# lua-influxdb-relay
22
A Lua resty service to replicate InfluxDB data for high availability
33

44
Table of Contents
@@ -19,27 +19,19 @@ Synopsis
1919
========
2020
```lua
2121
# --------- 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
2323

2424
# --------- relay config begin --------------
2525
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;;";
2727
lua_package_cpath "/path/to/openresty/lualib/?.so;;";
2828
lua_shared_dict relay 1m;
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';
3030
# --------- relay config end ----------------
3131

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;
4335
}
4436

4537
server {
@@ -48,44 +40,44 @@ Synopsis
4840

4941
location = /write {
5042
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';
5244
}
5345

5446
location = /query {
55-
proxy_pass http://backend_relay;
47+
proxy_pass http://backend_query;
5648
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
5749
proxy_set_header Host $http_host;
5850
proxy_set_header X-Real-IP $remote_addr;
5951
proxy_set_header Connection "";
6052
proxy_http_version 1.1;
6153

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';
6355
}
6456

65-
location = /relay_master {
57+
location = /relay1 {
6658
internal;
6759

68-
proxy_pass http://backend_master;
60+
proxy_pass http://127.0.0.1:8086;
6961
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
7062
proxy_set_header Host $http_host;
7163
proxy_set_header X-Real-IP $remote_addr;
7264
proxy_set_header Connection "";
7365
proxy_http_version 1.1;
7466

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';
7668
}
7769

78-
location = /relay_slave {
70+
location = /relay2 {
7971
internal;
8072

81-
proxy_pass http://backend_slave;
73+
proxy_pass http://127.0.0.1:8087;
8274
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
8375
proxy_set_header Host $http_host;
8476
proxy_set_header X-Real-IP $remote_addr;
8577
proxy_set_header Connection "";
8678
proxy_http_version 1.1;
8779

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';
8981
}
9082

9183
}
@@ -96,7 +88,7 @@ Synopsis
9688
Installation
9789
============
9890

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.
10092
And you should install it with [opm](https://github.com/openresty/opm#readme) just like that: opm install doujiang24/lua-resty-ini
10193

10294
[Back to TOC](#table-of-contents)

example/conf/nginx.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ http {
2424

2525
# --------- relay config begin --------------
2626
lua_code_cache on;
27-
lua_package_path "/usr/local/openresty/lualib/?.lua;/path/to/lua-resty-influxdb-relay/lib/?.lua;;";
27+
lua_package_path "/usr/local/openresty/lualib/?.lua;/path/to/luay-influxdb-relay/lib/?.lua;;";
2828
lua_package_cpath "/usr/local/openresty/lualib/?.so;;";
2929
lua_need_request_body on;
3030
lua_shared_dict relay 1m;
31-
init_by_lua_file '/path/to/lua-resty-influxdb-relay/lib/relay/init.lua';
31+
init_by_lua_file '/path/to/lua-influxdb-relay/lib/relay/init.lua';
3232

3333
# --------- relay config end ----------------
3434
include vhosts/influxdb-relay.conf;

example/conf/vhosts/influxdb-relay.conf

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
upstream backend_master {
2-
server 127.0.0.1: 8086;
3-
}
4-
5-
upstream backend_slave {
6-
server 127.0.0.1: 18086;
7-
}
8-
91
upstream backend_relay {
102
server 127.0.0.1: 8086;
113
server 127.0.0.1: 18086;
@@ -20,7 +12,7 @@ server {
2012

2113
location = /write {
2214
set $backend_uri_args '';
23-
rewrite_by_lua_file '/path/to/lua-resty-influxdb-relay/lib/relay/rewrite.lua';
15+
rewrite_by_lua_file '/path/to/lua-influxdb-relay/lib/relay/rewrite.lua';
2416
}
2517

2618
location = /query {
@@ -30,11 +22,13 @@ server {
3022
proxy_set_header X-Real-IP $remote_addr;
3123
proxy_set_header Connection "";
3224
proxy_http_version 1.1;
33-
rewrite_by_lua_file '/path/to/lua-resty-influxdb-relay/lib/relay/rewrite_query.lua';
25+
rewrite_by_lua_file '/path/to/lua-influxdb-relay/lib/relay/rewrite_query.lua';
3426
}
3527

3628
location = /relay_master {
37-
proxy_pass http://backend_master;
29+
internal;
30+
31+
proxy_pass http://127.0.0.1:8086;
3832
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3933
proxy_set_header Host $http_host;
4034
proxy_set_header X-Real-IP $remote_addr;
@@ -44,7 +38,9 @@ server {
4438
}
4539

4640
location = /relay_slave {
47-
proxy_pass http://backend_slave;
41+
internal;
42+
43+
proxy_pass http://127.0.0.1:8087;
4844
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
4945
proxy_set_header Host $http_host;
5046
proxy_set_header X-Real-IP $remote_addr;

lib/relay/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
local ini = require("resty.ini")
66
local stringUtil = require("relay.utils.strings")
77

8-
local configPath = '/tmp/lua-resty-influxdb-relay.ini'
8+
local configPath = '/tmp/lua-influxdb-relay.ini'
99

1010
local relayURIKey = 'relay:uri'
1111
local relayWriteURIKey = 'relay:write:uri'
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[relay]
2-
relayURI = /relay_master,/relay_slave
2+
relayURI = /relay1,/relay2
33
relayWriteURI = /write
44
relayAction = CREATE,ALTER,DROP

0 commit comments

Comments
 (0)