veepee-oss / influxdb-relay

Service to replicate InfluxDB data for high availability.
MIT License
198 stars 47 forks source link

[bug?] /query endpoint not working #24

Closed toni-moreno closed 5 years ago

toni-moreno commented 5 years ago

Hi@guys, I like a lot this improved version of the influxdata relay. When testing I've found that the query endpoint is not working fine.

image

When reviewing code I've seen that not handled the /query endpoint.

https://github.com/vente-privee/influxdb-relay/blob/ac01d20c93b10ca10c7faf95d73474a2f89a2cca/relay/http.go#L66-L75

Any plans to code it? Any reason to not to do it?

Thank you very much

rockyluke commented 5 years ago

It's on our plan to implement it.

No ETA right now but I'll talk with the team next week.

toni-moreno commented 5 years ago

Hi @rockyluke I'm working in a data syncronization tool ( just today released first release ) to help creating/maintain HA clusters from single db's (https://github.com/toni-moreno/syncflux/blob/master/README.md) In this scenario we will need a relay with full query support.

I'm considering help you as muchas we can beacouse we would like the relay query handler can ask our sync tool where to send queries depending on the data recovering state.

What do you think about ?

toni-moreno commented 5 years ago

Hi @rockyluke I'm working on a PR ( not ready yet ).

Tomorrow I will draw the proposed architecture with influxdb-relay + syncflux

toni-moreno commented 5 years ago

I would like propose this architecture as a full autonomous HA Cluster . What do you think about?

HA_architecture_with_syncflux

toni-moreno commented 5 years ago

On the previously architecture we could add a syncflux-endpoint cluster API config in the influxdb-relay config file, this would be an example


# InfluxDB && Prometheus
[[http]]
name = "example-http-influxdb"
bind-addr = "127.0.0.1:9096"
query-router-endpoint-api = ["http://node1:4090/api/queryactive","http://node2:4090/api/queryactive"] #<----

[[http.output]]
name = "local-influxdb01"
location = "http://127.0.0.1:8086/"
endpoints = {write="/write", write_prom="/api/v1/prom/write", ping="/ping", query="/query"}
timeout = "10s"

[[http.output]]
name = "local-influxdb02"
location = "http://127.0.0.1:8086/"
endpoints = {write="/write", write_prom="/api/v1/prom/write", ping="/ping", query="/query"}
timeout = "10s"

On query the syncflux endpoint this would response all available node names, and the influxdb /query handler shoud route query thougth them.

curl http://node1:4090/api/queryactive
{
  "local-influxdb01",
  "local-influxdb02",
}
curl http://node2:4090/api/queryactive
{
  "local-influxdb02",
  "local-influxdb01",
}
rockyluke commented 5 years ago

Thanks for the head up! I will check that tomorrow.

toni-moreno commented 5 years ago

Hi @rockyluke I've released latest 0.2 version binaries (rpm,deb,docker) for syncflux.

The main goal for the 0.2 release is act as a PoC for the proposed architecture. Obviously it needs more work mainly handling different fault scenarios ( both nodes down, down while recovering, split brain, etc).

I've added in my influxdb-relay branch a generic "query-router-endpoint-api" parameter as an array for several endpoint that can give us info about what node has all available data , ( syncflux could be this tool , but not only could be any other)

https://github.com/toni-moreno/influxdb-relay/blob/2b52be79f85f7ba5f6f3c77479634db769d54b81/config/config.go#L74

Any feedback would be appreciated

toni-moreno commented 5 years ago

Hi @rockyluke next week I should begin a PoC for our proposal, at work.

And I would like to have already idea if you would like add this code your influxdb-relay with my PR ( or your own, if you prefer) or should I work with my own fork?

toni-moreno commented 5 years ago

@rockyluke I've finally began working in a smarter relay from yours , still needs lots of work but now seems a good point to

here the Smart-Relay, https://github.com/toni-moreno/influxdb-srelay 0.2 versión released today

rockyluke commented 5 years ago

Sorry we have bit overwhelmed recently and we didn't take time to look all the issue 😞

toni-moreno commented 5 years ago

@rockyluke Don't worry , I will be happy If we can work together with the new smart relay ( if you can and also wish), I will close this issue , and can continue any discussion in the new project site .