Duplicating proxy

25 views
Skip to first unread message

Peter Booth

unread,
Sep 21, 2016, 8:59:30 AM9/21/16
to openre...@googlegroups.com
I have a weird use case that I'm hoping I can use openresty for:

I'd like to create a proxy that sends duplicate requests to duplicate back-ends. Specifically I'd like to register three end points that represent the HTTP port on three Influxdb instances and have my proxy POST a request to all three, returning the status of, say, the first request.

The rationale for this is to write data to all three influxdb instances
Can anyone suggest how I could best do this?

Peter

Sent from my iPhone

Robert Paprocki

unread,
Sep 21, 2016, 10:04:17 AM9/21/16
to openre...@googlegroups.com
Hi,

On Wed, Sep 21, 2016 at 5:59 AM, Peter Booth <peter...@me.com> wrote:
I have a weird use case that I'm hoping I can use openresty for:

This is actually not that weird, it's a great use case for OpenResty. Far weirder things have been done ;)
 
I'd like to create a proxy that sends duplicate requests to duplicate back-ends. Specifically I'd  like to register three end points that represent the HTTP port on three Influxdb instances and have my proxy POST a request to all three, returning the status of, say, the first request.

The rationale for this is to write data to all three influxdb  instances
Can anyone suggest how I could best do this

It sounds like you'll want to write a wrapper function (or class) to send data to Influx, and then call that multiple times via ngx.thread. Have a look at https://github.com/openresty/lua-nginx-module#ngxthreadspawn, even the example sounds pretty similar to what you want to do. iirc influx wire protocol is pretty simple so you should be able to get away with some easy ngx.socket.tcp calls (https://github.com/openresty/lua-nginx-module#ngxsockettcp).

Reply all
Reply to author
Forward
0 new messages