Server draining was a new feature introduced in Lync Server 2010 that allows administrators to gracefully take a server offline for maintenance. What this means is that it ensures that existing client connections to/through the server are allowed to continue, but all new connections are refused. Once the server is completely “drained” of connections, the services are stopped and the administrator can then patch, restart or reconfigure the server without impacting users.
In this example, I’m draining connections on a Lync Server 2010 Mediation Server in preparation for maintenance.
The first cmdlet I run in Lync Server Management Shell on the server I want to drain is Get-CsWindowsService. This returns a list of all the Lync services running on the server:
To drain this Mediation Server, I want to stop the RTCMEDSRV service only (side note: for a Front End server the main service I’d be looking to stop to ensure no more clients logged on would be RTCSRV). I can leave the REPLICA service running as this doesn’t affect client connections and ensures CMS changes are still replicated to this server.
Next I run the cmdlet Stop-CsWindowsService –Name RTCMEDSRV -Graceful. Specifying the -Graceful switch ensures the service is drained and existing client connections are allowed to continue like I mentioned above.
Once I’ve run the above cmdlet, in the Services MMC snap-in I see that the Lync Server Mediation service status is listed as Paused. In the Lync Server event log, I also see event ID 25049 informing me that the service has started to drain:
The service may stay in a Paused status for a while, depending on how long users stay on the phone for. 🙂
Once all connections have completed and disconnected, I see Event ID 25050 informing me that the service has completed draining:
Finally, Event ID 25003 is logged informing me that the service has now stopped:
This feature is really useful in resilient environments for diagnosing problems, taking servers offline for cumulative update patching, reconfiguring certificates or restarting the server completely. It can be used for any Lync Server role and gives you the flexibility to keep the lights on for users and not interrupt service but still perform maintenance during business hours.
If you’ve any questions about how this works or you’d like more information, drop me a line in the comments below.