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

ElasticSearch Connection fallback #58

Open
yii-bot opened this issue Jan 24, 2016 · 3 comments
Open

ElasticSearch Connection fallback #58

yii-bot opened this issue Jan 24, 2016 · 3 comments
Labels
type:enhancement Enhancement

Comments

@yii-bot
Copy link

yii-bot commented Jan 24, 2016

This issue has originally been reported by @chuntley at yiisoft/yii2#6377.
Moved here by @cebe.


With ElasticSearch you can connect to any query against any node on the cluster. The way the Yii's ElasticSearch connection is setup you set an array of IP addresses of the nodes in your cluster, then Yii randomly chooses a server to connect to then begins running commands against it.

          'nodes' => [
                ['http_address' => '10.111.55.50:9200'],
                ['http_address' => '10.111.55.51:9200'],
                ['http_address' => '10.111.55.52:9200'],
                ['http_address' => '10.111.55.53:9200'],
                ['http_address' => '10.111.55.54:9200'],
                ['http_address' => '10.111.55.55:9200'],
                ['http_address' => '10.111.55.56:9200'],
            ]

This is great, however ElasticSearch is designed to allow servers to fail on the cluster gracefully while others take over that server's responsibilities. Yii could randomly select a failed server, then report back that it is unable to connect to ElasticSearch. However this is not true, as any of the other servers in the connection string would be alive and active.

It would be a great addition to have Yii continue to try all nodes in the connection string before sending back a failure.

@beowulfenator
Copy link
Collaborator

This is not the typical use case.

Generally, a new node is set up at localhost. This node is part of the cluster, but does not store any data and never appoints itself master (the so-called client node). This local node forwards all requests to the cluster. The cluster is smart enough to handle failures of its data nodes.

@chuntley
Copy link

Default Elasticsearch nodes are setup to act as data, master-eligible, and client nodes. Smaller clusters are not likely to dedicate a machine as a client node, that generally happens when traffic and data needs get much larger. Even at that point, it is likely that several client nodes will be setup to handle the incoming traffic / result parsing. which this enhancement would solve for.

@beowulfenator
Copy link
Collaborator

This will hopefully be fixed by PR #104

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

No branches or pull requests

4 participants