前提条件

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的更多相关文章

  1. 和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧。因为,很多PCI的例子都是对S5933,就连微软出版的《Programming the Microsoft Windows Driver Model》都提供了一个完整的S5933的例子。 在这篇有关DDK的开发论文里。

    和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧.因为,很多PCI的例子都是对S5933,就连微软出版的<Programming the Microsoft Wi ...

  2. Windows Cluster 添加新节点--验证报错

    今天给既有Windows Cluster 添加节点时,验证总是不通过.报错信息为 防火墙未正确配置为故障转移群集.现将处理步骤汇总如下. 1.错误具体信息 报错的位置 --[验证警告] 的步骤中发现错 ...

  3. WINDOWS CLUSTER -- 时间不同步导致的群集问题

    故障描述,重启服务器后,发现该重启节点未成功加入到Windows群集中,导致该节点上的Alwayson服务也受影响处于“正在解析”状态,尝试重启cluster服务,发现无效,查看windows日志,发 ...

  4. Windows Cluster失败后,AlwaysOn在残存Server节点上快速恢复DB的详细步骤

    AlwaysOn是一种集合了高可用和灾难恢复两种功能的技术,它支持一个或多个数据库整体的发生故障转移,它实现了一定程度上的负载均衡,减轻了主服务器的压力,是目前最好的一种选择.那么当极端情况发生时,集 ...

  5. Windows Cluster 在群集管理器下 集群或可用性组 都不显示的问题

    作为一个IT成员,特别是偏支持的.很多时候就是和各种异常打交道,总会碰到一些奇奇怪怪的问题.很多时候,可能是一个小小的异常都需要花费很长时间去解决. SQL Server AlwaysOn 是建立在W ...

  6. sbt assembly a fat jar for spark-submit cluster model

    在用spark-submit提交作业时,用sbt package打包好的jar程序,可以很好的运行在client模式,当在cluster模式, 一直报错:Exception in thread &qu ...

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

    点击"我的电脑→属性→高级系统设置"标签的"环境变量"button,出现"环境变量"对话框,假设当前是以Administrator登录系统的 ...

  8. [AlwaysOn Availability Groups]CLUSTER.LOG(AG)

    CLUSTER.LOG(AG) 作为故障转移资源,在SQL Server和windows故障转移集群服务的资源DLL(hadrres.dll)之间有额外的内部交流,DLL无法被SQL Server监控 ...

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

    原文出处:http://www.cnblogs.com/jacklu/p/4619110.html 本科毕业设计是这方面的工作,所以想开几篇博客来介绍使用WDF开发PCI/PCIe接口卡的驱动程序方法 ...

随机推荐

  1. 微软开源rDSN分布式系统开发框架

    摘要:微软亚洲研究院系统组开发的分布式系统开发框架——Robust Distributed System Nucleus(rDSN)正式在GitHub平台开源.据悉,rDSN是一个旨在为广大分布式系统 ...

  2. 管理Linux服务器的用户和组

    管理Linux服务器的用户和组 Linux操作系统是一个多用户多任务的操作系统,允许多个用户同时登录到系统,使用系统资源. 为了使所有用户的工作顺利进行,保护每个用户的文件和进程,规范每个用户的权限, ...

  3. HttpContext.Current并非无处不在

    阅读目录 开始 无处不在的HttpContext HttpContext.Current到底保存在哪里? HttpContext并非无处不在! 如何获取文件绝对路径? 异步调用中如何访问HttpCon ...

  4. bootstrap的引入和使用

    Bootstrap的下载 一. 使用Bootstrap第一步,先将生成环境的Bootstrap下载下来.然后将下载,然后引入到自己建好的当前目录中 二.点到起步中的基本模板 将看到的整段代码复制粘贴到 ...

  5. servlet笔记1

    Myeclipse关于Servlet项目文件的组织方面,如下: WEB-INF:这个目录名称和位置是固定的,放置在该目录下的文件或目录,对外界来说的封闭的,也就是客户端无法用http的任何方式访问到其 ...

  6. go run helper

    # go run helper -a :强制编译相关代码,不论编译代码是否最新 -n :打印编译过程需要用到的命令,但不真正执行他们 -p n :并行编译,n为并行的数量 -v :列出被编译的代码包的 ...

  7. epoll用法【整理】

    l  epoll是什么? epoll是当前在Linux下开发大规模并发网络程序的热门人选,epoll 在Linux2.6内核中正式引入,和select相似,都是I/O多路复用(IO multiplex ...

  8. 如何使用find命令在Linux中查找文件

    Linux Find命令是Linux系统管理员工具库中最强大的工具之一. Find是一个命令行实用程序,它允许您根据用户给定的表达式搜索目录层次结构中的文件和目录,并对每个匹配的文件应用用户指定的操作 ...

  9. grep 过滤.svn文件

    [grep 过滤.svn文件] 问题: 在repository搜索代码时,常常会搜索到.svn的代码,如果不想搜索.svn目录下的相关代码怎么办?    1.使用管道进行双层“过滤”,其中第二次gre ...

  10. 16.3Sum Closest (Two-Pointers)

    Given an array S of n integers, find three integers in S such that the sum is closest to a given num ...