NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Fail over
editFail over
editWhen using a connection pool with more than one node, a request will be retried if the call to a node throws an exception or returns a 502, 503 or 504 response
var audit = new Auditor(() => Framework.Cluster .Nodes(10) .ClientCalls(r => r.FailAlways()) .ClientCalls(r => r.OnPort(9201).SucceedAlways()) .StaticConnectionPool() .Settings(s => s.DisablePing()) ); audit = await audit.TraceCall( new ClientCall { { BadResponse, 9200 }, { HealthyResponse, 9201 }, } );
502 Bad Gateway
editWill be treated as an error that requires retrying
var audit = new Auditor(() => Framework.Cluster .Nodes(10) .ClientCalls(r => r.FailAlways(502)) .ClientCalls(r => r.OnPort(9201).SucceedAlways()) .StaticConnectionPool() .Settings(s => s.DisablePing()) ); audit = await audit.TraceCall( new ClientCall { { BadResponse, 9200 }, { HealthyResponse, 9201 }, } );
503 Service Unavailable
editWill be treated as an error that requires retrying
var audit = new Auditor(() => Framework.Cluster .Nodes(10) .ClientCalls(r => r.FailAlways(503)) .ClientCalls(r => r.OnPort(9201).SucceedAlways()) .StaticConnectionPool() .Settings(s => s.DisablePing()) ); audit = await audit.TraceCall( new ClientCall { { BadResponse, 9200 }, { HealthyResponse, 9201 }, } );
504 Gateway Timeout
editWill be treated as an error that requires retrying
var audit = new Auditor(() => Framework.Cluster .Nodes(10) .ClientCalls(r => r.FailAlways(504)) .ClientCalls(r => r.OnPort(9201).SucceedAlways()) .StaticConnectionPool() .Settings(s => s.DisablePing()) ); audit = await audit.TraceCall( new ClientCall { { BadResponse, 9200 }, { HealthyResponse, 9201 }, } );
If a call returns a valid HTTP status code other than 502 or 503, the request won’t be retried.
Different requests may have different status codes that are deemed valid. For example, a 404 Not Found response is a valid status code for an index exists request
var audit = new Auditor(() => Framework.Cluster .Nodes(10) .ClientCalls(r => r.FailAlways(418)) .ClientCalls(r => r.OnPort(9201).SucceedAlways()) .StaticConnectionPool() .Settings(s => s.DisablePing()) ); audit = await audit.TraceCall( new ClientCall { { BadResponse, 9200 }, } );