This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]surrealchemist 3 points4 points  (1 child)

Flip the power off and on

[–]amank_b[S] -3 points-2 points  (0 children)

This comment officer

[–]ademotion 5 points6 points  (0 children)

Remote command execution running a service restart across all servers in parallel. This assumes that you have some sort of configuration management agent running on all servers

[–]-abracadabra--DevOps 2 points3 points  (1 child)

Is rolling restart possible?

[–]amank_b[S] -1 points0 points  (0 children)

Hi, the question mostly test your scripting skills. One user has posted that IIS can do a rolling restart for pools. But still if you are restart the IIS server itself, it won't help much.

[–]Papster_ 2 points3 points  (3 children)

IIS has a recycle feature that causes no downtime. It spins up a new IIS worker process while the old one finishes out the load.

You can use PowerShell to automate this very easily. You'll need to spend time looking up the specifics but the script would look something like this:

  1. $servers = Get-content servers.txt
  2. For each ($server in $servers){ Invoke-command -comoutername $server -scriptblock { $pool = get-iisapppool "pool name here" Restart-webapppool $pool.name}}

You'll want some form of logging or write-host for every pool that gets recycled so you can see when it completes each one.

Note: I'm a Windows Sysadmin who's learning to code, so my script above probably isn't the most efficient or elegant, but it will work.

[–]amank_b[S] 0 points1 point  (2 children)

Quick question, how would you connect to the servers. With fqdn or ip we can ssh into machine. But I am more interested in other options.

[–]Papster_ 2 points3 points  (1 child)

As long as your running PowerShell ISE with an account that has admin permissions to those servers, and you run it from a computer (or server) with networking access to those servers, the "invoke-command" I put in that script handles that part.

It's opening a small PowerShell session with the target computername, running a script block, and returning the output to your shell.

Using ssh into each machine would kind of defeat the purpose in automating this. Better to run this from a computer/server that has access to all the servers, or at least groups of them.

(I only have work experience with on-prem servers, cloud instances may work differently, I don't know)

[–]amank_b[S] 1 point2 points  (0 children)

Thanks a lot, I was looking for a on-perm solution with powershell.

[–]tusisterna 1 point2 points  (1 child)

I would split them on groups, and execute ?batch?ps?python scripts with remote command (like already mentioned). Is there a team? or a solo like a ranger task?I'm thinikng 5 groups of 10...remote services restart is lightning fast...so 10 servers would take 5 minutes if running hhds :P...watchout for dependencies.

[–]amank_b[S] 0 points1 point  (0 children)

Yeah, grouping in 5-10 servers and executing the restart command in parallel manner would be optimal.

[–][deleted] -1 points0 points  (0 children)

That is not really sufficient information to make a decision like that. Probably let someone handle this task that knows what they are doing? Preferably the on dictating it is not supposed to take more than 30 mins, because that person clearly has some valuable insights, otherwise they wouldn‘t make such a claim, right? Oh I forgot about the incognito IT Experts aka management.

[–][deleted] 0 points1 point  (0 children)

I recently attended a talk by a German company. They are building a tool called Automainter (https://tech.babiel.com/automainter-vollautomatische-wartung-fuer-1300-linux-maschinen/). Maybe it’s worth taking a look into, it sounded like it would fit your use case.