Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to Riak KV cluster through Nginx Reverse Proxy #385

Closed
SserwangaV opened this issue Oct 14, 2019 · 5 comments
Closed

Connecting to Riak KV cluster through Nginx Reverse Proxy #385

SserwangaV opened this issue Oct 14, 2019 · 5 comments

Comments

@SserwangaV
Copy link

SserwangaV commented Oct 14, 2019

I'm trying to connect to the Riak cluster through reverse proxy to leverage load balancing and abstract the applications from the cluster configurations. I succeed to open up a socket connection, but the connection is not persistent, that is, I get a response {error,disconnected} immediately. This is unlike the case when I connect to a Riak node directly where the connections stay as long as they are not closed or interrupted externally.

Here below is the snippet of the configuration

upstream riak_cluster_servers { least_conn; keepalive 32; server riak1.example.com:8087; server riak2.example.com:8087; server riak3.example.com:8087; server riak4.example.com:8087; server riak5.example.com:8087; }

The server block is setup as below

server { listen 0.0.0.0:80; listen [::]:80; server_name riak.example.com; location / { proxy_pass http://riak_cluster_servers; proxy_http_version 1.1; proxy_set_header Connection ""; } }

What could be causing this issue?

@aboroska
Copy link

@dotsiadia Did you set the tuple {keepalive, true} in riakc_pb_socket options? Setting keepalive as atom means false unintuitively. See: #383

@SserwangaV
Copy link
Author

SserwangaV commented Oct 14, 2019

@aboroska I set {keepalive, true} like this,
{ok, Pid} = riakc_pb_socket:start('riak.example.com', 80, [{keepalive, true}]).. I immediately run riakc_pb_socket:ping(Pid). and get {error,disconnected}

@SserwangaV
Copy link
Author

It seems Nginx can only proxy HTTP (Layer 7) protocols not TCP (Layer 4) protocols that are used by the protocol buffer. Thus, Nginx is likely to be useful when connecting to Riak using REST methods.

@martinsumner
Copy link
Contributor

Not sure if you still have this as a problem. The repo issues aren't tracked by many people, but you can try the slack channel instead at postriak.slack.com

I know that using NGiNX as a proxy to the HTTP should work fine, as there are many users connecting this way.

@SserwangaV
Copy link
Author

@martinsumner send me an in from postriak.slack.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants