设为首页 收藏本站
查看: 711|回复: 0

Create Windows Server 2008 cluster from the command line

[复制链接]

尚未签到

发表于 2015-4-30 11:30:12 | 显示全部楼层 |阅读模式
  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

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-62235-1-1.html 上篇帖子: Codename.Windows.Input — 让Silverlight使用右键和滚轮事件更简单[2008-12-12更新] 下篇帖子: Visual C# 2008+SQL Server 2005 数据库与网络开发-- 14.1 Windows Presentation Foundation(
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表