High Availability Questions

Product: PowerShell Universal
Version: 5.6.4

We have PSU running on a Windows Server 2022 VM and want to set up a second node for high availability, as it’s currently running a lot of critical Identity Access Management scripts.

We are not using IIS, but we have a separate SQL instance we can point both nodes to for the database, as well as a git repository for the code which the first node is already pointed to.

We just had some questions that don’t seem to be addressed in the documentation:

  1. How do the two nodes handle things like scheduled jobs? Will both nodes just execute the same job at the same time? I only see how the load balancer would help with things like endpoint requests, but not scheduled scripts. Does it have the ability to evaluate race conditions across the cluster, etc?

  2. What limitations in the PSU cache do we need to prepare for?

Thanks!

You can set persistence in your appsettings and choose whether certain resources such as schedules end up in a ps1 file or in your database. For high availability you’ll likley want to push schedules to your sql database, see: Repository | PowerShell Universal

When I did this, it was pretty seamless, I updated my appsettings, restarted PSU and the schedules.ps1 actually ran/evaluated and then recreated all my schedules in the database, after that point I just removed the file.

Since both nodes can now see it, depending on where your scripts are configured to run (computers/tags), the relevant device will pick up and execute it, if you set your script to run on a pool of multiple computers, it’ll balance depending on which one has the most availability to run the job.

My actual setup isnt true HA, but I have two nodes pointing to the same SQL db, one that servers as a web node for web apps, another that serves as the job runner, I just set my default node to my job runner and scripts execute against that automatically if nothing is specified.

For 2. See: High Availability | PowerShell Universal it may explain the caching limitations, and some additional info about web sockets when using a HA setup

2 Likes

Dude! You saved my bacon.

Thanks for the very thorough explanation. The links you provided also helped me understand a great deal more about how to configure the appsettings.json file. You just opened up the world of PSU a little bit more to me.

Thanks again!

1 Like