使用cluster.exe为MS SQL故障转移AOAG创建批处理脚本

问题描述

我想使用cluster.exe创建批处理脚本

我的初始批处理脚本( FAIlovER_TO_DRDB01.BAT )是:

ECHO ON
cluster.exe node DRDB01 /status  -o  C:\FAIlovER_TO_DRDB01_LOG.txt

当我尝试运行它时,没有创建任何输出

我的主要目标是它将输出以下内容

Listing status for node 'DRDB01':

Node           Node ID Status
-------------- ------- ---------------------
DRDB01               3 Joining

一旦看到状态为加入,它将运行以下脚本:

net.exe stop clussvc  
net.exe start clussvc /forcequorum  

故障转移后,它将运行以下脚本:

cluster.exe node DRDB01 /prop nodeweight=1 /prop:NodeWeight /status
cluster.exe node PDCDB01 /prop nodeweight=0 /prop:NodeWeight /status
cluster.exe node PDCDB02 /prop nodeweight=0 /prop:NodeWeight /status

解决方法

我假设您想在末尾找到节点

import matplotlib.pyplot as plt