How to create a Windows Server 2008 cluster from the command line?

Creating a cluster in Server 2008 using the cluster.exe command follows essentially the same process as creating a cluster by using the Microsoft Management Console (MMC) Failover Cluster Management snap-in. The process essentially consists of telling the Create Cluster Wizard the nodes that will be in the cluster and then the network name and static IP address (if dynamic IP isn’t used on the NICs).

Before you attempt to create a Server 2008 cluster, you need to install the Server 2008 Failover Clustering feature. If you’re running Server Core, you’d use the following command to install failover clustering:

start /w ocsetup FailoverCluster-Core

On a full Server 2008 installation, you can install failover clustering by running this command:

servermanagercmd -install Failover-Clustering

(Of course, you can also use the MMC Server Manager snap-in to install features, but here we’re concentrating on the command line.) To create a Server 2008 cluster from the command line, run cluster.exe using the following format:

cluster /cluster: /create /nodes:" " /ipaddress: / 

Here’s a cluster.exe command example and its ouput:

C:\>cluster /cluster:savdalclusfs01 /create /nodes:"savdalclus01 savdalclus02" /ipaddress:192.168.1.105/255.255.255.0

4% Initializing Cluster savdalclusfs01.
9% Validating cluster state on node savdalclus01.
13% Searching the domain for computer object savdalclusfs01
18% Verifying computer object savdalclusfs01 in the domain
22% Configuring computer object savdalclusfs01 as cluster name object
27% Validating installation of the Microsoft Failover Cluster Virtual Adapter o
n node savdalclus01.
31% Validating installation of the Cluster Disk Driver on node savdalclus01.
36% Configuring Cluster Service on node savdalclus01.
40% Validating installation of the Microsoft Failover Cluster Virtual Adapter o
n node savdalclus02.
45% Validating installation of the Cluster Disk Driver on node savdalclus02.
50% Configuring Cluster Service on node savdalclus02.
54% Starting Cluster Service on node savdalclus01.
54% Starting Cluster Service on node savdalclus02.
59% Forming cluster savdalclusfs01.
63% Adding cluster common properties to savdalclusfs01.
68% Creating resource types on cluster savdalclusfs01.
72% Creating group 'Cluster Group'.
72% Creating group 'Available Storage'.
77% Creating IP Address resource 'Cluster IP Address'.
81% Creating Network Name resource 'savdalclusfs01'.
86% Searching the domain for computer object savdalclusfs01
90% Verifying computer object savdalclusfs01 in the domain
95% Configuring computer object savdalclusfs01 as cluster name object
100% Bringing resource group 'Cluster Group' online.

When you create a cluster at the command line, disk resources are not added automatically and Node Majority will be used as the quorum mode.

How to add disk resources to a Windows Server 2008 cluster from the command line?
To add a disk resource, you must first create a resource group for the disk, then add the disk into the new resource group. As you can see in the following sample command, which creates a resource group, I've called my resource Quorum Disk (you can name the new resource whatever you want), and I've added the resource to available storage group.

C:\>cluster res "Quorum Disk" /create /group:"Available Storage" /type:"Physical Disk"

Here’s the command’s output:
Creating resource 'Quorum Disk'...
Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
Quorum Disk          Available Storage    savdalclus01    Offline

The next step is to add one or more disks. Before you do so, you’ll need the disk ID, which you can obtain by using the DiskPart tool, as follows:

C:\>diskpart

You’ll see the following command output and prompts to enter commands (list disk, select disk, and detail disk).

Microsoft DiskPart version 6.0.6001
Copyright (C) 1999-2007 Microsoft Corporation.
On computer: SAVDALCLUS01

DISKPART> list disk
Disk ### Status     Size    Free    Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0   Online     127 GB  0       B
Disk 1   Offline    512 MB  0       B
Disk 2   Offline    20 GB   0       B

DISKPART> select disk 1
Disk 1 is now the selected disk.

DISKPART> detail disk

ROCKET IMAGEFILE SCSI Disk Device
Disk ID: DB2875A4
Type : iSCSI
Bus : 0
Target : 1
LUN ID : 0
Read-only : Yes
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No

There are no volumes.

You can now add a disk by running cluster.exe and specifying either the disk’s GUID (/priv DiskIDGuid) or its signature (/priv DiskSignature), then bring it online. The previous command output shows the signature—DB2875A4—in hexadecimal (a number means that it’s the signature that’s displayed and not the GUID). You’ll need to convert the hex value to a decimal value for use in the cluster.exe command, as follows:

C:\>cluster res "Quorum Disk" /priv DiskSignature=3676861860

Now, to bring the disk online, enter this:

C:\>cluster res "Quorum Disk" /on

You’ll see this output:   
Bringing resource 'Quorum Disk' online...
Resource             Group                Node            Status 
-------------------- -------------------- --------------- ------
Quorum Disk          Available Storage    savdalclus01    Online

The disk will now be available in the available storage area of the Microsoft Management Console (MMC) Failover Cluster Management snap-in and via the cluster res command.

How to change a Windows Server 2008 cluster quorum from the command line?
You can use the cluster.exe command to change a cluster’s quorum mode. To view the existing quorum mode for a cluster, you use the following command (in the format cluster cluster name /quorum), as follows:

C:\>cluster savdalclusfs01 /quorum

You’ll get this output:
Witness Resource Name Path                                       Type
--------------------- --------------------------------------------------
(Node Majority)
Majority

To change the quorum mode, you add a resource for the type of quorum mode you want—for example, a file-share witness—as follows. (Both the commands you enter and their output are shown.)

C:\>cluster /cluster:savdalclusfs01 res "File Share Witness" /create /group:"Cluster Group" /type:"File Share Witness" /priv SharePath=\\savdaldc02\fsw

Creating resource 'File Share Witness'...
Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
File Share Witness   Cluster Group        savdalclus01    Offline

C:\>cluster /cluster:savdalclusfs01 res "File Share Witness" /online

Bringing resource 'File Share Witness' online...

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
File Share Witness   Cluster Group        savdalclus01    Online

C:\>cluster savdalclusfs01 /quorum:"File Share Witness"

Witness Resource Name Path                                       Type
--------------------- --------------------------------------------------
File Share Witness
Majority

Notice we add the file share as a resource, bring the new resource online, then tell the cluster to use that resource for the quorum. Unlike the procedure for changing the cluster quorum via the Microsoft Management Console (MMC) Failover Cluster Management snap-in, you must give the cluster computer object, and not the administrator, full control on the share. That is, for my cluster I must add account savdalclusfs01$ with full control to the share fsw on server savdaldc02.

To change quorum to a disk witness, you need to move a disk resource into the cluster group, like this:

C:\>cluster res "Quorum Disk" /move:"Cluster Group"

Moving resource 'Quorum Disk' to group 'Cluster Group'...
Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
Quorum Disk          Cluster Group        savdalclus01    Online

Now you need to tell the cluster to use the disk for the quorum:

C:\>cluster /quorum:"Quorum Disk"
Witness Resource Name Path                                          Type
--------------------- -----------------------------------------------------
Quorum Disk           F:\Cluster\
Majority

Note that if you add /disk to the end of the command, you tell the cluster to use disk only and not Node and Disk Majority (the normal mode).

C:\>cluster /quorum:"Quorum Disk" /disk

Quorum Resource Name Path                           Type
-------------------- ------------------------------ --------
Quorum Disk          F:\Cluster\                    No Majority--Disk
Only

You can switch to Node Majority only by running the following command:

C:\>cluster /quorum /node

Witness Resource Name Path                                       Type
--------------------- --------------------------------------------------
(Node Majority)
Majority


How 
to move the default Cluster Group in Windows Server 2008?
Microsoft simplified Server 2008 clustering and removed certain features that it deemed nonessential for everyday cluster management, among them the Cluster Group. The Cluster Group should only have three resources in it: the cluster IP address, cluster name, and the witness resources; nothing else should ever be in this group, so it isn’t a feature that administrators typically use.

You can find the Cluster Group’s current location by using either the Microsoft Management Console (MMC) Failover Cluster Management snap-in or the cluster . group command); however, you can move the Cluster Group only by using the command, not the snap-in. In the following command example, I’m moving the group to the savdalclus02 node. Note that if you have only a two-node cluster, you can just use /move without a node name; in that case, the command will simply move the cluster group to the other node in the cluster. (I use the period to show that we’re modifying the local cluster.)

C:\>cluster . group "Cluster Group" /move:savdalclus02

Moving resource group 'Cluster Group'...

Group                Node            Status
-------------------- --------------- ------
Cluster Group        savdalclus02    Online

How to create a new Windows Server 2008 cluster resource group from the command line?
You should never add any resources to the default Cluster Group. Instead, you should create resource groups that you want to use to host resources. When you add a new resource group, at minimum it needs an IP address, a network name, and an instance of a resource type (e.g., file server). Let’s create a new group and a file server resource within it. Note that I use the period (.) to show that we’re modifying the local cluster.

C:\>cluster . group "file server" /create

Creating resource group 'file server'...
Group                Node            Status
-------------------- --------------- ------
file server          savdalclus01    Offline

C:\>cluster . res "File Server" /create /group:"file server" /type:"File Server"

Creating resource 'File Server'...

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
File Server          file server          savdalclus01    Offline

You can use the cluster restype command to display a full list of resource types, as follows:

C:\>cluster restype

Listing all available resource types:

Display Name                         Resource Type Name
------------------------------------------------------------------------
DHCP Service                         DHCP Service
Distributed File System              Distributed File System
Distributed Transaction Coordinator  Distributed Transaction Coordinator
File Server                          File Server
File Share Quorum Witness            File Share Witness
Generic Application                  Generic Application
Generic Script                       Generic Script
Generic Service                      Generic Service
IP Address                           IP Address
IPv6 Address                         IPv6 Address
IPv6 Tunnel Address                  IPv6 Tunnel Address
iSNSClusRes                          Microsoft iSNS
(Resource Type Unavailable)          MSMQ
(Resource Type Unavailable)          MSMQTriggers
Network Name                         Network Name
NFS Share                            NFS Share
Physical Disk                        Physical Disk
Print Spooler                        Print Spooler
Volume Shadow Copy Service Task      Volume Shadow Copy Service Task
WINS Service                         WINS Service

Now you add the IP address and network name. Note that I created an IPv4 address, but you can also add an IPv6 address if you’re using IPv6.

C:\>cluster . res "FS IP Address" /create /group:"file server" /type:"IP Address" /priv address=192.168.1.106 subnetmask=255.255.255.0

Creating resource 'FS IP Address'...
Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
FS IP Address        file server          savdalclus01    Offline

C:\>cluster . res "FS Name" /create /group:"file server" /type:"Network Name" /priv name="savdalclusfsfs01" dnsname="savdalclusfsfs01"

Creating resource 'FS Name'...
Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
FS Name              file server          savdalclus01    Offline

Now you need to create a dependency between the IP address and the name, like this:

C:\>cluster . res "FS Name" /adddep:"FS IP Address"

Making resource 'FS Name' depend on resource 'FS IP Address'...

C:\>cluster . res "FS Name" /listdep

Listing resource dependency expression for 'FS Name':
----------------------------------------------------------------
([FS IP Address])

Listing resource dependencies for 'FS Name':

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
FS IP Address        file server          savdalclus02    Online

We can now bring the resources online by using the cluster .res "resource name" /on command.

For most resource group types, you also need some shared storage to actually do anything useful. So let’s move some available storage into the new resource group:

C:\>cluster res "Data Disk" /move:"file server"

Moving resource 'Data Disk' to group 'file server'...
Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
Data Disk            file server          savdalclus01    Online

Now you set the network name and the storage as dependencies for the resource group to be online, like this:

C:\>cluster . res "file server" /adddep:"FS Name"

Making resource 'file server' depend on resource 'FS Name'...

C:\>cluster . res "file server" /adddep:"Data Disk"

Making resource 'file server' depend on resource 'Data Disk'...

C:\>cluster . res "file server" /listdep

Listing resource dependency expression for 'file server':

----------------------------------------------------------------

([Data Disk]) and ([FS Name])

Listing resource dependencies for 'file server':

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
Data Disk            file server          savdalclus01    Online
FS Name             file server          savdalclus01    Online

You can bring up the resource group by using the cluster .group group name /on command. Finally, you can actually add items to the resource group as you’d do with a share using typical methods, for example

net share data=e:\data /remark:"Data Share"v

Create Windows Server 2008 cluster from the command line的更多相关文章

  1. Windows Server 2008 - How to Move the Quorum Disk Group

    I received this question from a friend the other day - asking how on a Windows Server 2008 cluster y ...

  2. 基于Windows Server 2008 R2的Failover Cluster

    转载一下别人的文章吧,写的不错 基于Windows Server 2008 R2的Failover Cluster(故障转移群集)部署Sql Server 2008 AA(主主) 模式群集(第一部分) ...

  3. Xen虚拟机磁盘镜像模板制作(二)—Windows Server 2008(2012)

    在<Xen虚拟机磁盘镜像模板制作(一)—Windows Server 2008(2012)>一文中,我们已经成功制作出了Windows Server磁盘镜像.下面我们说明下如何通过它来生成 ...

  4. Xen虚拟机磁盘镜像模板制作(一)—Windows Server 2008(2012)

    这段时间一直在研究如何制作一个适合Xen虚拟化的Windows Server 2008(2012)磁盘镜像,中间虽然遇到了一些阻挠,不过最终还是顺利解决,成功制作出了Xen Windows Serve ...

  5. Windows Server 2008 Workstation Converter优化设置

    http://www.win2008workstation.com/windows-server-2008-workstation-converter/ If you don’t want to co ...

  6. 开启Windows Server 2008 R2上帝模式

    TAG标签: 摘要:这个“God Mode” 应该大部分的网友都听过了,只是在 Windows Server 2008 R2 上也支持此一功能.启用方式非常简单,在桌面新建一个文件夹,命名为: God ...

  7. 烂泥:KVM安装Windows Server 2008 R2使用virtio硬盘

    本文首发于烂泥行天下. 在上一篇文章中,我们介绍了使用IDE硬盘来安装Windows Server 2008 R2,这篇文章我们来介绍使用virtio硬盘来安装Windows Server 2008 ...

  8. 烂泥:KVM中安装Windows Server 2008 R2系统

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 在前一篇文章中,我介绍了有关在KVM中的安装Centos系统.接下来,就来介绍如何在KVM中安装Windows系统. 注意:在此我安装的是windows ...

  9. 使用LVS实现负载平衡之Windows Server 2008配置

    LVS是Linux Virtual Server的简写,意即Linux虚拟服务器,是一个虚拟的服务器集群系统.本项目在1998年5月由章文嵩博士成立,是中国国内最早出现的自由软件项目之一.承载于 II ...

随机推荐

  1. java 基础面试

    1. &和&&的区别 答: &是位运算符,表示按位与运算,&&是逻辑运算符,表示逻辑与(and) 2.int 和 Integer 有什么区别 答: Ja ...

  2. 22.1 高级函数【JavaScript高级程序设计第三版】

    函数是JavaScript 中最有趣的部分之一.它们本质上是十分简单和过程化的,但也可以是非常复杂和动态的.一些额外的功能可以通过使用闭包来实现.此外,由于所有的函数都是对象,所以使用函数指针非常简单 ...

  3. pytorch中torch.nn构建神经网络的不同层的含义

    主要是参考这里,写的很好PyTorch 入门实战(四)--利用Torch.nn构建卷积神经网络 卷积层nn.Con2d() 常用参数 in_channels:输入通道数 out_channels:输出 ...

  4. SVN 的基本用法

    克隆远程库 # svn checkout $URL --username=$userName 显示库信息 # svn info 显示库状态 # svn status 将文件纳入版本管理 # svn a ...

  5. Spring---单例模式(Singleton)的6种实现

    1.1.1 摘要 在我们日常的工作中经常需要在应用程序中保持一个唯一的实例,如:IO处理,数据库操作等,由于这些对象都要占用重要的系统资源,所以我们必须限制这些实例的创建或始终使用一个公用的实例,这就 ...

  6. linux中如何解决克隆后的电脑的问题

    1.如何解决克隆后的电脑的网络问题 克隆出来的电脑,IP地址,网卡都是重复的,不能直接使用,需要修改 1)vim  /etc/udev/rules.d/70-persistent-net.rules ...

  7. web项目中获取spring的bean对象

    Spring是一个轻量级的控制反转(IoC)和面向切面(AOP)的容器框架,如何在程序中不通过注解的形式(@Resource.@Autowired)获取Spring配置的bean呢? Bean工厂(c ...

  8. BP神经网络的手写数字识别

    BP神经网络的手写数字识别 ANN 人工神经网络算法在实践中往往给人难以琢磨的印象,有句老话叫“出来混总是要还的”,大概是由于具有很强的非线性模拟和处理能力,因此作为代价上帝让它“黑盒”化了.作为一种 ...

  9. 使用Subversion进行源代码管理(二):创建和发布版本库[转]

    原文出处: http://www.blogjava.net/youxia/archive/2007/10/23/155372.html 我的上一篇随笔讲了怎么使用Subversion客户端去连接服务器 ...

  10. 19、AngularJs知识点总结 part-1

    1.AngularJs AngularJs是一款JavaScript开源库,由Google维护,用来协助单一页面应用程序: AngularJs的目标是通过MVC模式增强基于浏览器的应用,使开发和测试变 ...