Skip to content

ElasticSearch Connection fallback #58

@yii-bot

Description

@yii-bot

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions