Symptoms
- The TeamCity multinode setup consists of the main node and a secondary one.
- The main node is stopped by stopping the TeamCity Server Windows service for a disaster recovery test.
- After some time, the
/app/rest/server/nodesendpoint is still returning two nodes. The main node's state isstopping.
As per the documentation, the MAIN_NODE responsibility can be reassigned only if the current main node is offline. Otherwise, the request will fail. How can the MAIN_NODE responsibility be reassigned in this case, when the main node is clearly offline, but its state remains stopping?
Cause
This is expected behavior in some cases. What happens is:
- The TeamCity server Windows service is stopped.
- This initiated the shutdown sequence.
- The main node changed its
startupStagetoSHUTTING_DOWN. - The node was unable to complete the shutdown sequence before Windows killed the process.
- The
startupStageis persistent. Meaning, it will continue to beSHUTTING_DOWNuntil the node is back online and changes it.
Resolution
It doesn't affect the reassignment of the MAIN_NODE responsibility.
Instead of using the /app/rest/server/nodes endpoint, the recommended in the documentation /app/rest/server/nodes?locator=state:online endpoint should be used to check whether the main node is offline:
- The main node writes
SHUTTING_DOWNand dies. - After it stops heartbeating for a few minutes (3 by default), other nodes will mark it offline and show the “main node is inactive” health report.
- At this point, the
/app/rest/server/nodes?locator=state:onlinewill not show the main node. - The
MAIN_NODEresponsibility is considered vacant and can be given to the secondary node.
Comments
0 comments
Please sign in to leave a comment.