SqlCmd -Windows Cluster Model

前提条件

1存储lun 划分完毕并且挂载到其中一台机器上

2 需要加入群集的节点机器加入域完毕,并设置好心跳线 .加域部分可以参考 之前 Sqler Cmd 加域部分.

1检查Feature 更新


SqlerCmdWinClusterInstallFeature

再需要按装cluster的 节点机器上面运行 SqlerCmdWinClusterInstallFeature

cat C:\CheckInstallClusterLog.Log

如果节点机器已安装


PS C:\Users\xwj> cat C:\CheckInstallClusterLog.Log

Application-Server,AS-Outgoing-Trans,AS-Incoming-Trans,Failover-clustering Is Exists

如果节点机器没安装


PS C:\Users\xwj> cat C:\CheckInstallClusterLog.Log

3428: 2013-04-09 14:14:25.685 [ServerManagerPS] Complete initializing log file.
3428: 2013-04-09 14:14:25.866 [CBS] IsCacheStillGood: True.
3428: 2013-04-09 14:14:26.540 [ServerManagerPS] 开始安装...
3428: 2013-04-09 14:14:26.541 [ServerManagerPS] 已为安装指定: [应用程序服务器] .NET Framework 3.5.1
3428: 2013-04-09 14:14:26.633 [Sync]
Sync Graph of changed nodes
==========
---------------------------------------------------------------------------
name : 应用程序服务器
state : Changed
rank : 1
sync tech: Unknown
guest[1] : .NET Framework 3.5.1
guest[2] : .NET 4.0 的应用程序服务器扩展
guest[3] : Web 服务器(IIS)支持
guest[4] : COM+ 网络访问
guest[5] : TCP 端口共享
guest[6] : Windows 进程激活服务支持
guest[7] : 分布式事务
ant. : empty
pred. : empty
provider : ApplicationServerRoleProvider
---------------------------------------------------------------------------
name : .NET Framework 3.5.1
state : Changed
rank : 10
sync tech: Unknown
ant. : .NET Framework 3.5.1, 进程模型, .NET 环境, 配置 API
pred. : 应用程序服务器, .NET Framework 3.5.1, 进程模型, .NET 环境, 配置 API
provider : ApplicationServerRoleProvider

3428: 2013-04-09 14:14:26.634 [Sync] Calling sync provider of .NET Framework 3.5.1 ...
3428: 2013-04-09 14:14:26.635 [ApplicationServer] Sync:: guest: ‘.NET Framework 3.5.1‘, guest deleted?: False
3428: 2013-04-09 14:14:26.635 [ApplicationServer] Begin installation of ‘.NET Framework 3.5.1‘...
3428: 2013-04-09 14:14:26.638 [ApplicationServer] Installing: ‘.NET Framework 3.5.1‘
3428: 2013-04-09 14:14:26.649 [ApplicationServer] Writing app server view: C:\ProgramData\Microsoft\Event Viewer\Views\ServerRoles\ApplicationServer.Events.xml
3428: 2013-04-09 14:14:26.651 [ApplicationServer] Skipped configuration of ‘.NET Framework 3.5.1‘ because running in command line mode.
3428: 2013-04-09 14:14:26.651 [ApplicationServer]
[STAT] For ‘.NET Framework 3.5.1‘:
[STAT] Installation took ‘0.0152068‘ second(s) total.
[STAT] Configuration took ‘0‘ second(s) total.
[STAT] Total time: ‘0.0152068‘ second(s).
3428: 2013-04-09 14:14:26.652 [Provider] Sync Result - Success: True, RebootRequired: False, Id: 230
3428: 2013-04-09 14:14:26.656 [Provider] Sync Message - OperationKind: Install, MessageType: Information, MessageCode: 0, Message: <null>, AdditionalMessage: <null>
3428: 2013-04-09 14:14:26.670 [ServerManagerPS] [STAT] Overall Sync Time: ‘0.0421967‘ second(s)
3428: 2013-04-09 14:14:26.732 [ServerManagerPS] [安装] 成功: [应用程序服务器] .NET Framework 3.5.1。

3428: 2013-04-09 14:14:27.641 [ServerManagerPS] Complete initializing log file.
3428: 2013-04-09 14:14:27.812 [CBS] IsCacheStillGood: True.
3428: 2013-04-09 14:14:27.890 [ServerManagerPS] 开始安装...
3428: 2013-04-09 14:14:27.891 [ServerManagerPS] 已为安装指定: [故障转移群集] 故障转移群集
3428: 2013-04-09 14:14:28.046 [Sync]
Sync Graph of changed nodes
==========
---------------------------------------------------------------------------
name : 故障转移群集
state : Changed
rank : 1
sync tech: CBS
ant. : empty
pred. : empty
provider : Provider

3428: 2013-04-09 14:14:28.046 [Sync] Calling sync provider of 故障转移群集 ...
3428: 2013-04-09 14:14:28.047 [Provider] Sync:: guest: ‘故障转移群集‘, guest deleted?: False
3428: 2013-04-09 14:14:28.047 [Provider] Begin installation of ‘故障转移群集‘...
3428: 2013-04-09 14:14:28.047 [Provider] Install: Guest: ‘故障转移群集‘, updateElement: ‘FailoverCluster-FullServer‘
3428: 2013-04-09 14:14:28.048 [Provider] Installation queued for ‘故障转移群集‘.
3428: 2013-04-09 14:14:28.049 [CBS] installing ‘FailoverCluster-FullServer ‘ ...
3428: 2013-04-09 14:14:30.351 [CBS] ...parents that will be auto-installed: ‘<none>‘
3428: 2013-04-09 14:14:30.351 [CBS] ...default children to turn-off: ‘<none>‘
3428: 2013-04-09 14:14:30.493 [CBS] ...current state of ‘FailoverCluster-FullServer‘: p: Staged, a: Staged, s: UninstallRequested
3428: 2013-04-09 14:14:30.493 [CBS] ...setting state of ‘FailoverCluster-FullServer‘ to ‘InstallRequested‘
3428: 2013-04-09 14:14:30.531 [CBS] ...‘FailoverCluster-FullServer‘ : applicability: Applicable
3428: 2013-04-09 14:14:32.291 [CbsUIHandler] Initiate:
3428: 2013-04-09 14:15:35.350 [CbsUIHandler] Terminate:
3428: 2013-04-09 14:15:35.854 [CBS] ...done installing ‘FailoverCluster-FullServer ‘. Status: 0 (0)
3428: 2013-04-09 14:15:35.922 [Provider] Skipped configuration of ‘故障转移群集‘ because running in command line mode.
3428: 2013-04-09 14:15:35.923 [Provider]
[STAT] ---- CBS Session Consolidation -----
[STAT] For
‘故障转移群集‘[STAT] installation(s) took ‘67.8737122‘ second(s) total.
[STAT] Configuration(s) took ‘0.0006572‘ second(s) total.
[STAT] Total time: ‘67.8743694‘ second(s).

3428: 2013-04-09 14:15:35.924 [Provider] Sync Result - Success: True, RebootRequired: False, Id: 33
3428: 2013-04-09 14:15:35.924 [Provider] Sync Message - OperationKind: Install, MessageType: Information, MessageCode: 0, Message: <null>, AdditionalMessage: <null>
3428: 2013-04-09 14:15:35.993 [ServerManagerPS] [STAT] Overall Sync Time: ‘67.9480339‘ second(s)
3428: 2013-04-09 14:15:36.067 [ServerManagerPS] [安装] 成功: [故障转移群集] 故障转移群集。

2 Test-Cluster


Import-Module FailoverClusters;

[array] $ClusterNodes=‘db001‘,‘db002‘

SqlerCmdWinClusterTest $ClusterNodes

cmd C:\ClusterReport.Log.mht

你可以在 查看 报告C:\ClusterReport.Log.mht

报告通过,下面正式开始安装

新建群集 配置群集ip 和节点


$DomainName=‘xwjtest‘
$ClusterName=‘ClusterTest‘;
$ClusterIP=‘192.168.1.43‘;
[array] $ClusterNodes=‘db001‘,‘db002‘
[array] $ClusterGroup =‘Test01‘,‘Test02‘;

SqlerCmdCreateWinCluster $DomainName $ClusterName $ClusterIP $ClusterNodes

创建群集资源组


SqlerCmdWinClusterCreateGroup  $ClusterName  $ClusterNodes   $ClusterGroup

创建 资源磁盘并获取磁盘信息


SqlerCmdWinClusterGetDiskResource  $ClusterName  ‘c:\CreateClusterDisk.log‘

cat c:\CreateClusterDisk.log

Name : 群集磁盘 1
Path : T:
FileSystem : NTFS
TotalSize :
2044
FreeSpace : 2006

Name : 群集磁盘 3
Path : Q:
FileSystem : NTFS
TotalSize :
1020
FreeSpace : 987

Name : 群集磁盘 5
Path : H:
FileSystem : NTFS
TotalSize :
1020
FreeSpace : 988

Name : 群集磁盘 2
Path : K:
FileSystem : NTFS
TotalSize :
252
FreeSpace : 230

Name : 群集磁盘 4
Path : M:
FileSystem : NTFS
TotalSize :
1020
FreeSpace : 988



根据需求合理分配磁盘


 $ResourceName="群集磁盘 5" ,"群集磁盘 1"
SqlerCmdWinClusterMoveDiskToGroup $ClusterName $ResourceName ‘Test01‘

$ResourceName="群集磁盘 4"
SqlerCmdWinClusterMoveDiskToGroup $ClusterName $ResourceName ‘Test02‘

创建仲裁盘


SqlerCmdWinClusterCreateQuorum  $ClusterName  "群集磁盘 3" $ClusterNodes

创建 dtc


$DtcDiskName="群集磁盘 2"
$DtcIpAddress=‘192.168.1.44‘
$DtcIpNetSub=‘255.255.255.0‘

SqlerCmdWinClusterCreateDtc $ClusterName $ClusterNodes $DtcDiskName $DtcIpAddress $DtcIpNetSub

流程化的安装大大降低了人为的错误,同时提高了个人效率. 适合大规模 流程化 db运维.

附上sqlerCmd  Create CLuster 模块代码


  1 Function SqlerCmdWinClusterInstallFeature
2 {param([string] $LogPath=‘C:\CheckInstallClusterLog.Log‘)
3 try
4 {
5 Import-Module ServerManager;
6 $Array= ‘Application-Server‘,‘AS-Outgoing-Trans‘,‘AS-Incoming-Trans‘,‘Failover-clustering‘
7 $Feature=$Array| %{$f=$_; Get-WindowsFeature |where {$f -eq $_.Name -and $_.Installed -eq $False }|select-object Name,FeatureType,Installed};
8 if((Test-Path -Path $LogPath )){Remove-Item -Path $LogPath};
9 if($Feature -ne $Nul)
10 {
11 $Feature|foreach-object{ Add-WindowsFeature -Name $_.Name -logPath $LogPath }
12 Restart-computer -force
13
14 }
15 Else
16 {
17 "Application-Server,AS-Outgoing-Trans,AS-Incoming-Trans,Failover-clustering Is Exists "|out-file -FilePath $LogPath -Append
18 }
19 }
20 catch
21 {
22 $_.Exception.Message|out-file -FilePath $LogPath -Append
23 }
24 }
25
26
27
28 Function SqlerCmdWinClusterTest
29 {param([array] $Nodes,[string] $LogPath=‘C:\ClusterReport.Log‘)
30 try
31 {
32 if((Test-Path -Path $LogPath )){Remove-Item -Path $LogPath};
33 Test-Cluster -Node $Nodes -reportname $LogPath
34 }
35 catch [Exception]
36 {
37 $_.Exception.Message|out-file -FilePath $LogPath -Append
38 }
39 }
40
41
42
43 Function SqlerCmdWinClusterCreate
44 {param
45 ([string] $DomainName
46 ,[string] $ClusterName
47 ,[string] $ClusterIP
48 ,[array] $ClusterNodes
49 )
50 try
51 {
52 if( (Get-Cluster -domain $DomainName |where {$_.Name -eq $ClusterName }) -eq $Null)
53 {
54 New-Cluster -Name $ClusterName -StaticAddress $ClusterIP -Node $ClusterNodes -NoStorage -ErrorAction Stop;
55 $Return=‘OK‘
56 }
57 else
58 {
59 $Return= ‘Exists Cluster : ‘+$ClusterName
60 }
61 }
62 catch
63 {
64 $Return=$_.Exception.Message
65 }
66 Return $Return
67 }
68
69
70
71
72 Function SqlerCmdWinClusterCreateGroup
73 {param
74 (
75 [string] $ClusterName
76 ,[array] $ClusterNodes
77 ,[array] $ClusterGroup
78 )
79 try
80 {
81 Foreach($GroupName in $ClusterGroup)
82 {
83 Add-ClusterGroup -Name $GroupName -Cluster $ClusterName -ErrorAction Stop ;
84 Set-ClusterOwnerNode -Group $GroupName -Owners $ClusterNodes -Cluster $ClusterName -ErrorAction Stop;
85 }
86 $Return=‘OK‘
87 }
88 catch
89 {
90 $Return=$_.Exception.Message
91 }
92 Return $Return
93 }
94
95
96
97
98 Function SqlerCmdWinClusterGetDiskResource
99 {param
100 ([string] $ClusterName
101 ,[string] $LogPath=‘c:\CreateClusterDisk.log‘
102 )
103 try
104 {
105 Get-ClusterAvailableDisk -cluster $ClusterName | Add-ClusterDisk -ErrorAction Stop;
106 $MSCluster_DiskPartition=gwmi -Namespace root/MSCluster -class MSCluster_DiskPartition| select-object @{n=‘PartComponent‘;e={$_.__RELPATH}},FileSystem,TotalSize,FreeSpace,Path -ErrorAction Stop ;
107 $MSCluster_DiskToDiskPartition=gwmi -Namespace root/MSCluster -class MSCluster_DiskToDiskPartition |select-object PartComponent,GroupComponent -ErrorAction Stop ;
108 $MSCluster_ResourceToDisk=gwmi -Namespace root/MSCluster -class MSCluster_ResourceToDisk |select-object PartComponent,GroupComponent -ErrorAction Stop ;
109 $MSCluster_Resource=gwmi -Namespace root/MSCluster -class MSCluster_Resource | where {$_.type -replace ‘ ‘,‘‘ -eq ‘PhysicalDisk‘} |Select-object Name,@{n=‘GroupComponent‘;e={$_.__RELPATH}} -ErrorAction Stop ;
110 $ClusterDisk=$MSCluster_DiskPartition | % { $f = $_; $MSCluster_DiskToDiskPartition `
111 | where { $_.PartComponent -eq $f.PartComponent } `
112 | Select GroupComponent,PartComponent,@{n=‘Path‘;e={$f.path}},@{n=‘FileSystem‘;e={$f.FileSystem}},@{n=‘TotalSize‘;e={$f.TotalSize}},@{n=‘FreeSpace‘;e={$f.FreeSpace}}} `
113 | % { $e=$_; $MSCluster_ResourceToDisk |where { $_.PartComponent -eq $e.GroupComponent } `
114 | Select GroupComponent,PartComponent, @{n=‘Path‘;e={$e.path}},@{n=‘FileSystem‘;e={$e.FileSystem}},@{n=‘TotalSize‘;e={$e.TotalSize}},@{n=‘FreeSpace‘;e={$e.FreeSpace}}} `
115 | % { $d = $_; $MSCluster_Resource| where { $d.GroupComponent -eq $_.GroupComponent } `
116 | Select Name, @{n=‘Path‘;e={$d.path}},@{n=‘FileSystem‘;e={$d.FileSystem}},@{n=‘TotalSize‘;e={$d.TotalSize}},@{n=‘FreeSpace‘;e={$d.FreeSpace}}};
117 if((Test-Path -Path $LogPath )){Remove-Item -Path $LogPath};
118 $ClusterDisk|out-file -FilePath $LogPath -Append
119 $Return=‘OK‘
120 }
121 catch
122 {
123 $Return=$_.Exception.Message
124 }
125 Return $Return
126 }
127
128
129
130

SqlCmd -Windows Cluster Model,布布扣,bubuko.com

时间: 2024-10-09 10:14:53

SqlCmd -Windows Cluster Model的相关文章

如何收集Windows cluster日志

Cluster日志收集: 登录到任意一个群集的节点,在命令提示符下执行:cluster  log  /g ,之后会在节点主机生成cluster.log ,路径为:C:\Windows\cluster\reports\cluster.log 执行命令后,会在群集的所有节点上自动收集日志.

Windows Driver Model

http://en.wikipedia.org/wiki/Windows_Driver_Model In computing, the Windows Driver Model (WDM) — also known at one point as the Win32 Driver Model — is a framework for device drivers that was introduced with Windows 98 and Windows 2000 to replace VxD

windows cluster 心跳检测阀值优化

通过cmd命令Cluster.exe /prop查看当前群集的属性信息,其中心跳阀值相关属性: SameSubnetDelay:同一子网中的节点的测信号频率 SameSubnetThreshold: 同一子网中的节点的延迟的阈值 CrossSubnetDelay: 不同的子网中的节点的检测信号频率 CrossSubnetThreshold: 在不同的子网中的节点的延迟的阈值 SameSubnetDelay 默认代表每1秒执行一次Windows群集心跳检测,SameSubnetThreshold

SharePoint 排错:添加Windows Cluster节点异常排错

Blog链接:https://blog.51cto.com/13969817 AlwaysOn是SQL Server 2012开始发布的一个很棒的新特性,大家都知道 SharePoint 的数据是存储在SQL Server里的,它依赖于可靠的连接来运行.如果SQL宕机了,SharePoint也会宕机,所以一般中大型企业,我都会推荐考虑部署故障转移数据库解决方案,最低性减少终端用户读取数据失败的可能性. 但近期有小伙伴在部署SQL Server Always On for SharePoint 2

windows cluster常见命令

◆查看指定群集中指定节点状态cluster /cluster:gdlxcluster node test001 /status ◆查看指定群集中指定节点属性cluster /cluster:gdlxcluster node test001 /prop ◆指定群集中指定节点暂停cluster /cluster:gdlxcluster node test001 /pause ◆指定群集中指定节点暂停恢复cluster /cluster:gdlxcluster node test001 /resume

sbt assembly a fat jar for spark-submit cluster model

在用spark-submit提交作业时,用sbt package打包好的jar程序,可以很好的运行在client模式,当在cluster模式, 一直报错:Exception in thread "main" java.lang.ClassNotFoundException.决定利用sbt assembly插件把所有的依赖打成一个jar. 我的工程结构: myProject/build.sbt myProject/project/assembly.sbt myProject/src/ma

windows 用户变量和系统变量的区别

点击"我的电脑→属性→高级系统设置"标签的"环境变量"按钮,出现"环境变量"对话框,如果当前是以Administrator登录系统的用户,对话框的上面为Administrator的用户变量,对话框的下面为系统变量(即相当于系统中所有用户的用户变量).有的时候我们会看到在用户变量和系统变量中都存在某一个环境变量,比如path,那么path的值到底是用户变量中的值还是系统变量中的值,或者两者都不是呢?答案是两者都不是.path变量的值是用户变量中的值

windows 用户变量和系统变量的差别

点击"我的电脑→属性→高级系统设置"标签的"环境变量"button,出现"环境变量"对话框,假设当前是以Administrator登录系统的用户.对话框的上面为Administrator的用户变量,对话框的以下为系统变量(即相当于系统中全部用户的用户变量). 有的时候我们会看到在用户变量和系统变量中都存在某一个环境变量.比方path,那么path的值究竟是用户变量中的值还是系统变量中的值,或者两者都不是呢?答案是两者都不是.path变量的值是用户

PCI/PCIe接口卡Windows驱动程序(1)-WDF概述及开发环境搭建

本科毕业设计是这方面的工作,所以想开几篇博客来介绍使用WDF开发PCI/PCIe接口卡的驱动程序方法. 这个系列的博客将首先用一个篇幅为不懂Windows 下PCI/PCIe驱动开发的介绍WDF和开发环境搭建,接下来几篇将直接讲述程序编写, 看完这几篇后,希望能够帮助读者了解如何通过500行左右的代码实现一个标准的PCIe接口卡驱动程序. 毕设题目的PCIe板卡是BAR0下映射两个5K的内存,偏移地址为0x20000和0x22000,源代码在: https://github.com/luluji