荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Jobs (温少), 信区: WinNT
标  题: Appendix C: Command-Line Administration
发信站: BBS 荔园晨风站 (Sun Nov 28 12:58:44 1999), 站内信件



Appendix C: Command-Line Administration
You can perform many of the administrative tasks for MSCS from the Windows NT
command prompt, without using the provided graphical interface. While the
graphical method provides easier administration and status of cluster resources
at a glance, MSCS does provide the capability to issue most administrative
commands without the graphical interface. This ability opens up interesting
possibilities for batch files, scheduled commands, and other techniques, in
which many tasks may be automated.

Using Cluster.exe
Cluster.exe is a companion program and is installed with Cluster Administrator.
While the Microsoft Cluster Server Administrator's Guide details basic syntax
for this utility, the intention of this section is to complement the existing
documentation and to offer examples. All examples in this section assume a
cluster name of MYCLUSTER, installed in the domain called MYDOMAIN, with NODEA
and NODEB as servers in the cluster. All examples are given as a single command
line.

Note   Specify any names that contain spaces within quotation marks.

Basic Syntax
With the exception of the cluster /? command, which returns basic syntax for
the command, every command line uses the syntax:

CLUSTER [cluster name] /option

To test connectivity with a cluster, or to ensure you can use Cluster.exe, try
the simple command in the next section to check the version name (/version).

Cluster Commands
Version number
To check the version number of your cluster, use a command similar to the
following:

CLUSTER mycluster /version

If your cluster were named MYCLUSTER, the above command would return the
version information for the product.

Listing clusters in the domain
To list all clusters within a single domain, use a command including the /list
option like this:

CLUSTER mycluster /LIST:mydomain

Node Commands
All commands directed toward a specific cluster node must use the following
syntax:

CLUSTER [cluster name] NODE [node name] /option

Node status
To obtain the status of a particular cluster node, use the /status command. For
example:

CLUSTER mycluster NODE NodeA /Status

The node name is optional only for the /status command, so the following
command will report the status of all nodes in the cluster:

CLUSTER mycluster NODE /Status

Pause or resume
The pause option allows the cluster service to continue running and
communicating in the cluster. However, the paused node may not own groups or
resources. For example, to pause a node, use the /pause switch:

CLUSTER mycluster NODE NodeB /Pause

An example of the use of this command might be to transfer groups to another
node while you perform some other kind of task, such as with a backup or disk
defrag utility. To resume the node, simply use the /resume switch instead:

CLUSTER mycluster NODE NodeB /Resume

Evict a node
The evict option removes the ability of a node to participate in the cluster.
In other words, the cluster node loses membership rights in the cluster. The
only way to grant membership rights again to the evicted node is to do the
following.

To grant membership rights:

Remove the cluster software from the evicted node through Add/Remove Programs
in Control Panel.


Restart the node.


Reinstall MSCS on the previously evicted node through the MSCS Setup program.
To perform this action, use a command similar to the following:

CLUSTER mycluster NODE NodeB /Evict

Changing node properties
While the cluster node only has one property that may be changed by Cluster.exe,
 this example illustrates how to change a property of a cluster resource. The
node description is the only property that may be changed. For example:

CLUSTER mycluster NODE NodeA /Properties Description="The best node in
MyCluster."

A good use for this node changing property might be in the case of multiple
administrators. For example, you pause a node to run a large application on the
designated node, and want to change the node description to reflect this. The
field could serve as a reminder to yourself and to other administrators as to
why it was paused ? and that someone may want to /resume the node later. It
might be good to include /resume in a batch file that might pause a node while
setting up for the designated task.

Group Commands
All group commands use the syntax:

CLUSTER [cluster name] GROUP [group name] /option

Group status
To obtain the status of a group, you may use the /status option. This option is
the only group option in which the group name is optional. Therefore, if you
omit the group name, the status of all groups will be displayed. Another status
option (/node) will display group status by node.

Example 1: Status of all groups:

CLUSTER mycluster GROUP /Status

Example 2: Status of all groups owned by a specific node:

CLUSTER mycluster GROUP /Status /Node:nodea

Example 3: Status of a specific group:

CLUSTER mycluster GROUP "Cluster Group"

Create a new group
It is easy to create a new group from the command line.

Note   The following example creates a group called mygroup:

CLUSTER mycluster GROUP mygroup /create

Delete a group
Equally as simple as the /create option, you may delete groups from the command
line. However, the group must be empty before it can be deleted.

CLUSTER mycluster GROUP mygroup /delete

Rename a group
To rename a group, use the following syntax:

CLUSTER mycluster GROUP mygroup /rename:yourgroup

Move, Online, and Offline group commands
The move group command may be used to transfer ownership of a group and its
resources to another node. By design, the move command must take the group
offline and bring it online on the other node. Further, a timeout value (number
of seconds) may be supplied to specify the time to wait before cancellation of
the move request. By default, Cluster.exe waits indefinitely until the state of
the group changes to the desired state.

Examples:

CLUSTER mycluster GROUP mygroup /MoveTo:Nodeb /wait:120
CLUSTER mycluster GROUP mygroup /Offline
CLUSTER mycluster GROUP mygroup /Online

Group properties
Use the /property option to display or set group properties. Documentation on
common properties for groups may be found in the Microsoft Cluster Server
Administrator's Guide. One additional property not documented is LoadBalState.
This property is not used in MSCS version 1.0, and is reserved for future use.

Examples:

CLUSTER mycluster GROUP mygroup /Properties
CLUSTER mygroup GROUP mygroup /Properties Description="My favorite group"

Preferred owner
You may specify a preferred owner for a group. The preferred owner is the node
you prefer each group to run. If a node fails, the remaining node takes over
the groups from the failed node. By setting the fail back option at the group
level, groups may fail back to their preferred server when the node becomes
available. A group does not fail back if a preferred owner is not specified.
MSCS version 1.0 is limited to two nodes in a cluster. For best results,
specify no more than one preferred owner. In future releases, this property may
use a list of more than one preferred owner.

Example: To list the preferred owner for a group, type:

CLUSTER mycluster GROUP mygroup /Listowner

Example: To specify the preferred owner list, type:

CLUSTER mycluster GROUP mygroup /Setowners:Nodea

Resource Commands
Resource status
To list the status of resources or a particular resource, you can use the
/status option. Note the following examples:

CLUSTER mycluster RESOURCE /Status
CLUSTER mycluster RESOURCE myshare /Status

Creating a new resource
To create a new resource, use the /create option.

Note   To avoid error, you must specify all required parameters for the
resource. The /create option allows creation of resources in an incomplete
state. Make sure to set additional resource properties as appropriate with
subsequent commands.

Example: Command sequence to add a file share resource

CLUSTER mycluster RESOURCE myshare /Create /Group:mygroup /Type:"File
Share"
CLUSTER mycluster RESOURCE myshare /PrivProp ShareName="myshare"
CLUSTER mycluster RESOURCE myshare /PrivProp Path="w:\myshare"
CLUSTER mycluster RESOURCE myshare /PrivProp Maxusers=-1
CLUSTER mycluster RESOURCE myshare /AddDependency:"Disk W"

Note   Log entry lines in the sections above have been wrapped for space
constraints in this document. The lines do not normally wrap.

Simulating resource failure
You can simulate resource failure in a cluster from the command line by using
the /fail option for a resource. This option is similar to using the Initiate
Failure command from Cluster Administrator. The command assumes that the
resource is already online.

Example:

CLUSTER mycluster RESOURCE myshare /Fail

Online/offline resource commands
The /online and /offline resource commands work very much the same way as the
corresponding group commands, and also may use the /wait option to specify a
time limit (in seconds) for the operation to complete.

Examples:

CLUSTER mycluster RESOURCE myshare /Offline
CLUSTER mycluster RESOURCE myshare /Online

Dependencies
Resource dependency relationships may be listed or changed from the command
line. To add or remove a dependency, you must know the name of the resource to
be added or removed as a dependency.

Examples:

CLUSTER mycluster RESOURCE myshare /ListDependencies
CLUSTER mycluster RESOURCE myshare /AddDependency:"Disk W:"
CLUSTER mycluster RESOURCE myshare /RemoveDependency:"Disk W:"

Note   Log entry lines in the sections above have been wrapped for space
constraints in this document. The lines do not normally wrap.

Example Batch Job
The following example takes an existing group, Mygroup, and creates resources
within the group. The example creates a network name resource, and initiates
failures to test failover. During the process, it uses various reporting
commands to obtain the status of the group and resources. This example shows
the output from all commands given. The commands in this example work, but may
require minor alteration depending on configured cluster, group, resource,
network, and IP addresses in your environment ? if you choose to use them.

Note   The LoadBal properties reported in the example are reserved for future
use. The EnableNetBIOS property for the IP address resource is a Service Pack 4
addition, and must be set to 1, for the resource to be a valid dependency for a
network name resource.

C:\>REM Get group status
C:\>CLUSTER mycluster GROUP mygroup /status
Listing status for resource group 'mygroup':

Group                Node            Status
-------------------- --------------- ------
mygroup              NodeA           Online

C:\>REM Create the IP Address resource: myip
C:\>CLUSTER mycluster RESOURCE myip /create /Group:mygroup /Type:"Ip Address"
Creating resource 'myip'...

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
myip                 mygroup              NodeA           Offline

C:\>REM Define the IP Address parameters
C:\>CLUSTER mycluster RESOURCE myip /priv network:client
C:\>CLUSTER mycluster RESOURCE myip /priv address:157.57.152.23

C:\>REM Redundant. Subnet mask should already be same as network uses.
C:\>CLUSTER mycluster RESOURCE myip /priv subnetmask:255.255.252.0
C:\>CLUSTER mycluster RESOURCE myip /priv EnableNetBIOS:1
C:\>REM Check the status
C:\>CLUSTER mycluster RESOURCE myip /Stat
Listing status for resource 'myip':

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
myip                 mygroup              NodeA           Offline

C:\>REM View the properties
C:\>CLUSTER mycluster RESOURCE myip /prop
Listing properties for 'myip':

R Name                             Value
--------------------------------- -------------------------------
R Name                             myip
  Type                             IP Address
  Description
  DebugPrefix
  SeparateMonitor                  0 (0x0)
  PersistentState                  0 (0x0)
  LooksAlivePollInterval           5000 (0x1388)
  IsAlivePollInterval              60000 (0xea60)
  RestartAction                    2 (0x2)
  RestartThreshold                 3 (0x3)
  RestartPeriod                    900000 (0xdbba0)
  PendingTimeout                   180000 (0x2bf20)
  LoadBalStartupInterval           300000 (0x493e0)
  LoadBalSampleInterval            10000 (0x2710)
  LoadBalAnalysisInterval          300000 (0x493e0)
  LoadBalMinProcessorUnits         0 (0x0)
  LoadBalMinMemoryUnits            0 (0x0)


C:\>REM View the private properties
C:\>CLUSTER mycluster RESOURCE myip /priv
Listing private properties for 'myip':

R Name                             Value
--------------------------------- -------------------------------
  Network                          Client
  Address                          157.57.152.23
  SubnetMask                       255.255.252.0
  EnableNetBIOS                    1 (0x1)

C:\>REM Bring online and wait 60 sec. for completion
C:\>CLUSTER mycluster RESOURCE myip /Online /Wait:60
Bringing resource 'myip' online...

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
myip                 mygroup              NodeA           Online

C:\>REM Check the status again.
C:\>CLUSTER mycluster RESOURCE myip /Stat
Listing status for resource 'myip':

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
myip                 mygroup              NodeA           Online

C:\>REM Define a network name resource
C:\>CLUSTER mycluster RESOURCE mynetname /Create /Group:mygroup /Type:"Network
Name"
Creating resource 'mynetname'...

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
mynetname            mygroup              NodeA           Offline

C:\>CLUSTER mycluster RESOURCE mynetname /priv Name:"mynetname"
C:\>CLUSTER mycluster RESOURCE mynetname /Adddependency:myip
Making resource 'mynetname' depend on resource 'myip'...


C:\>REM Status check
C:\>CLUSTER mycluster RESOURCE mynetname /Stat
Listing status for resource 'mynetname':

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
mynetname            mygroup              NodeA           Offline

C:\>REM Bring the network name online
C:\>CLUSTER mycluster RESOURCE mynetname /Online /Wait:60
Bringing resource 'mynetname' online...

Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
mynetname            mygroup              NodeA           Online

C:\>REM Status check
C:\>CLUSTER mycluster Group mygroup /stat
Listing status for resource group 'mygroup':

Group                Node            Status
-------------------- --------------- ------
mygroup              NodeA           Online

C:\>REM Let's simulate a failure of the IP address
C:\>CLUSTER mycluster RESOURCE myip /Fail
Failing resource 'myip'...


Resource             Group                Node            Status
-------------------- -------------------- --------------- ------
myip                 mygroup              NodeA           Online Pending

C:\>REM Get group status
C:\>CLUSTER mycluster GROUP mygroup /status
Listing status for resource group 'mygroup':

Group                Node            Status
-------------------- --------------- ------
mygroup              NodeA           Online

? 1999 Microsoft Corporation. All rights reserved. Terms of use.

--
☆ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: bbs@192.168.11.73]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店