- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SAS 9.4M7 on four Windows Server 2019 platforms (metadata, compute, mid-tier, LASR)
Does anyone know a way to test from a Windows Powershell command whether the metadata server is started? After applying Windows Updates on our servers they are scheduled to reboot overnight. However, the metadata server is taking significantly longer to restart than the other three and so any SAS services on the other servers which rely on the metadata server are failing to start. I have Powershell scripts on all the servers to start all the SAS services but some won't start properly if there's no metadata (crucially, Object Spawners). So I wanted them to check for the metadata before continuing. The scripts are run by Windows Task Scheduler as internal System accounts so they can't use WMI or CIM to check the metadata service.
Of course, I could simply delay the restarts to a time when the metadata server should have restarted but that has the possibility of failing too if it's not given long enough.
Thanks.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
$rc = Test-NetConnection meta.example.com -port 8561
if ($rc.TcpTestSucceeded) {
echo "Metadata Server Up"
}
You could build this logic into a loop that checks every few seconds and then exits the loop or fails after your max wait time has passed.
Greg Wootton | Principal Systems Technical Support Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think you could run a batch SAS program that does the following:
- set the metadata options
- make sure a semaphore file (for example /opt/sas/ServerIsReady) does not exist
- define a macro to do the following:
- PROC METAOPERATE ACTION=STATUS OUT=WORK.STATOUT; RUN;
- Data step to read WORK.STATOUT
- if it exists and things look good, create /opt/sas/ServerIsReady
- Otherwise, sleep a minute and then jump to the top of the macro again
- Keep track of how many times this jump happens - after 10 tries (or whatever number is acceptable to you) you probably want to abort and toss an error (maybe create /opt/sas/ServerWillNotStart)
Your powershell script could run this batch SAS program, and then wait until it finishes and look for the signal files and proceed accordingly.
Carl Sommer
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
$rc = Test-NetConnection meta.example.com -port 8561
if ($rc.TcpTestSucceeded) {
echo "Metadata Server Up"
}
You could build this logic into a loop that checks every few seconds and then exits the loop or fails after your max wait time has passed.
Greg Wootton | Principal Systems Technical Support Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This looks exactly like what I was wanting. But will it test whether there is a response on the port, or just whether the port is open?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Greg Wootton | Principal Systems Technical Support Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you really wanted to ensure that you were talking to a functional metadata server, then you would want to pursue the PROC METADATA approach. That's more code and coordination than the command @gwootton suggested.
Carl
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That answers my question. I'll give it a try. I don't think there's any data of anything else listening on port 8561. Thanks Greg (and Carl).