Closed fuzongtang closed 3 years ago
Thanks for posting in our issue tracker. In order to properly assist you, we need additional information:
Thanks!
This is an automated comment, triggered by adding the label status:need more info
.
'elasticsearch' => [
'class' => 'yii\\elasticsearch\\Connection',
'nodes' => [
['http_address' => '172.17.129.190:9200'],
['http_address' => '172.17.129.179:9200'],
// configure more hosts if you have a cluster
],
// set autodetectCluster to false if you don't want to auto detect nodes
'autodetectCluster' => true,
'dslVersion' => 5, // default is 5
],
When the first node hangs up, the system reports an error。
Elasticsearch Database Exception – yii\elasticsearch\Exception
Elasticsearch request failed: 7 - Failed to connect to 172.17.129.190 port 9200: Connection refused
Error Info: Array
(
[requestMethod] => GET
[requestUrl] => http://172.17.129.190:9200/_nodes/_all/http
[requestBody] =>
[responseHeaders] => Array
(
)
[responseBody] =>
)
So have to make sure that the first node works ? Won't the cluster switch automatically?
'elasticsearch' => [ 'class' => 'yii\\elasticsearch\\Connection', 'nodes' => [ ['http_address' => '172.17.129.190:9200'], ['http_address' => '172.17.129.179:9200'], // configure more hosts if you have a cluster ], // set autodetectCluster to false if you don't want to auto detect nodes 'autodetectCluster' => true, 'dslVersion' => 5, // default is 5 ],
When the first node hangs up, the system reports an error。
Elasticsearch Database Exception – yii\elasticsearch\Exception Elasticsearch request failed: 7 - Failed to connect to 172.17.129.190 port 9200: Connection refused Error Info: Array ( [requestMethod] => GET [requestUrl] => http://172.17.129.190:9200/_nodes/_all/http [requestBody] => [responseHeaders] => Array ( ) [responseBody] => )
So have to make sure that the first node works ? Won't the cluster switch automatically?
@knut @samdark @yii-bot @nergal
Please don't call out people like that, it's not Twitter. As far as I can see in the code node must reply with non-500 status to switch to a different one. I'm not sure why it's like that since it would be logical to skip it as well. I'm not expert in ES though.
This is the expected behavior. If the extension retried connections to different nodes, this would be a debugging nightmare. If you need that kind of behavior, set up a coordinator node in your cluster:
This is the expected behavior. If the extension retried connections to different nodes, this would be a debugging nightmare. If you need that kind of behavior, set up a coordinator node in your cluster:
If so, what is the point of cluster configuration?
'nodes' => [
['http_address' => '172.17.129.190:9200'],
['http_address' => '172.17.129.179:9200'],
// configure more hosts if you have a cluster
],
always get first node。。。
What steps will reproduce the problem?
What's expected?
What do you get instead?
Additional info