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

Node failover is not working [JIRA: CLIENTS-700] #113

Closed
mansoorghori opened this issue Jan 8, 2016 · 8 comments
Closed

Node failover is not working [JIRA: CLIENTS-700] #113

mansoorghori opened this issue Jan 8, 2016 · 8 comments

Comments

@mansoorghori
Copy link

When there is multiple nodes configured for the client and one of the nodes is down the client does not appear to failover to a different node.

The code used to initialize the client is:

$nodes = array();
$riak_hosts_ports = explode(',', $riak_hosts);
foreach($riak_hosts_ports as $riak_host_port) {
  $single_riak_host_port = explode(':', $riak_host_port);
  $riak_host = $single_riak_host_port[0];
  $riak_port = $single_riak_host_port[1];
  // define the connection info to our Riak nodes
  $nodes[] = (new Node\Builder)->atHost($riak_host)->onPort($riak_port)->build();
}

// instantiate the Riak client
$riak_client = new Riak($nodes);

$riak_hosts is a comma-separated list, e.g. riak-host-1:8091,riak-host-2:8092,riak-host-3:8093

Now if one of these nodes is down and the client picks the node that is down, on connection failure it doesn't try another host to fulfil the request

@Basho-JIRA Basho-JIRA changed the title Node failover is not working Node failover is not working [JIRA: CLIENTS-700] Jan 8, 2016
@christophermancini
Copy link
Contributor

@mansoorghori I will look into this and get it resolved in the next few days. Thanks for bringing it to my attention.

@christophermancini
Copy link
Contributor

@mansoorghori I completed a fix for v3 of the client, can you take a look and see if it fixes your needs. #114

@mansoorghori
Copy link
Author

@christophermancini Thanks for the update. I had a brief look at the pull request and it seems it might be what I need. I need to try it out. How do I get this WIP code?

@christophermancini
Copy link
Contributor

You should be able to check it out via composer by using the branch name
instead of the release version. Just prefix it with "dev-", e. g.
dev-issue/113

The other options are to clone the repo and checkout the branch or navigate
to the branch on GitHub and download a zip file of the code.

@mansoorghori
Copy link
Author

@christophermancini, I've checked the code fix and it works as expected. It tries all the nodes until it get's a response. Thanks.

@christophermancini
Copy link
Contributor

Great! I am off the next few days, I will get a colleague to merge the PR and cut a release.

@mansoorghori
Copy link
Author

Hi

Trying to find out if it is possible to get all the keys for the stored
objects within a bucket using the PHP client?

Regards

Mansoor Ghori
On 9 Jan 2016 22:27, "Christopher Mancini" [email protected] wrote:

@mansoorghori https://github.com/mansoorghori I will look into this and
get it resolved in the next few days. Thanks for bringing it to my
attention.


Reply to this email directly or view it on GitHub
#113 (comment)
.

@christophermancini
Copy link
Contributor

Hi @mansoorghori ,

Currently it has not been implemented for PHP but has been for some of our other clients. List keys is an extremely expensive operation on the server side and paging of the result set is not something that has really been implemented Riak side, which is ultimately why I did not implement it in PHP. Some of the other languages can handle the result set a bit easier than PHP could since they are threaded.

I would recommend at least for now, that maybe you try to depend on Yokozuna (solr) to retrieve keys within a bucket as it is a much safer operation and currently supported.

If you truly need a full list keys, you could hit the HTTP interface directly using curl and it returns JSON so it should be fairly trivial to implement as a one off.

With the performance gains of PHP 7, it might be something that gets officially added when our PB dependency library supports PHP 7. Just for now, it doesn't seem like something that would add more value than headaches to support.

Chris

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

No branches or pull requests

4 participants