473,761 Members | 6,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cluster API

Does anyone know if Microsoft plans to implement an C#
(.net) API for MS Cluster like the one in C++?

Or has someone else written a C# wrapper for the C++ API?
Nov 16 '05
17 25507


i've been researching for almost a month now regarding applications/
example codes for remote cluster administration for windows 2000
advanced server using asp/vb.net.. but unfortunately, i can't see
something that is similar to my project.. hope you can give me some
ideas regarding this..

this is my problem:
we want to display on a webpage the current active nodes of clustered
servers. for ex we have:

server1a,server 1b
server2a,server 2b
server3a,server 3b

and the current active nodes are server1a, server2b, and server2b..

how can i do that in asp/vb.net? i'm developing remotely from the
servers using XP and vs.net..

and also, we want to configure the resources (eg: diskspaces, database,
windows services) from the owner (which is the active node)

anyone? please share your ideas.. i'm really frustrated now.. :sigh:
hope you can help me..

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #11

"Chuck Haeberle" <Ch***********@ discussions.mic rosoft.com> wrote in message
news:A7******** *************** ***********@mic rosoft.com...
Willy,

I would be very interested in seeing such a sample. What are the WMI
Cluster Classes you mention? I have a similar need - to monitor and
restart
if needed a service on a cluster, and have not had much luck to date
finding
manged objects to allow me to perform this simple task. I could always
issue
shell commands, but thats just ... klugy. :)

Your help would be MOST appreciated!
Chuck Haeberle


Herewith a small sample that illustrates how one can use System.Manageme nt
and WMI to write cluster management application, note that the cluster needs
to run W2K3 for this to work.

using System;
using System.Manageme nt;
class App {
[MTAThread]
public static void Main() {
string clusterName = "MyCluster" ; // cluster alias
string custerGroupReso urce = "FS_Resourc e1"; // Cluster group name
ConnectionOptio ns options = new ConnectionOptio ns();
options.Usernam e = "ClusterAdm in"; //could be in domain\user format
options.Passwor d = "HisPasswor d";
// Connect with the mscluster WMI namespace on the cluster named "MyCluster"
ManagementScope s = new ManagementScope ("\\\\" + clusterName +
"\\root\\msclus ter", options);
ManagementPath p = new ManagementPath( "Mscluster_Clus tergroup.Name=' " +
custerGroupReso urce +"'");
using(Managemen tObject clrg = new ManagementObjec t (s, p, null ))
{
// Take clustergroup off line and read its status property when done
TakeOffLine(clr g);
clrg.Get();
Console.WriteLi ne(clrg["Status"]);
System.Threadin g.Thread.Sleep( 3000); // Sleep for a while
// Bring back online and get status.
BringOnLine(clr g);
clrg.Get();
Console.WriteLi ne(clrg["Status"]);

}
}
static voidTakeOffLine (ManagementObje ct resourceGroup)
{
ManagementBaseO bject outParams =
resourceGroup.I nvokeMethod("Ta keoffline", null, null);
}
static void BringOnLine(Man agementObject resourceGroup)
{
ManagementBaseO bject outParams =
resourceGroup.I nvokeMethod("Ta keoffline", null, null);
}
}

Check the MSDN documentation for all other WMI mscluster namespace classes,
and write some small programs to exercize the features offered by the
individual classes.
If in doubt about some property or feature, load wbemtest.exe and connect to
the cluster namespace. Wbemtest allows you to get/change the properties of
cluster resources and execute the methods exposed by the mscluster classes.

Willy.
Nov 16 '05 #12
rWilly - thank you very much! Very interesting.

However I have in the meantime, managed to find another solution using
msclus.dll which we copied to my XP dev machine from a Server 2003 machine.

First I registered msclus.dll using regsvr32
I added msclus.dll as a reference to my project, allowing .NET to build a
standard com interop layer for me.

It's a little more brute force but it is working for us:

using MSClusterLib;
...//..
static void Main(string[] args)
{
ClusterClass cluster = new ClusterClass();

cluster.Open("M DSQLDEV");

Console.WriteLi ne(cluster.Name );
Console.WriteLi ne(cluster.Vers ion);
ClusResourcesCl ass resources = (ClusResourcesC lass)cluster.Re sources;

for(int i=0; i< resources.Count ; i++)
{
ClusResourceCla ss resource = (ClusResourceCl ass)resources[i+1];
if(resource.Nam e == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLi ne(resource.Onl ine(30).ToStrin g());
break;
}
}

for(int i=0; i< resources.Count ; i++)
{
ClusResourceCla ss resource = (ClusResourceCl ass)resources[i+1];
if(resource.Nam e == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLi ne(resource.Off line(30).ToStri ng());
break;
}
}
}

"Willy Denoyette [MVP]" wrote:

"Chuck Haeberle" <Ch***********@ discussions.mic rosoft.com> wrote in message
news:A7******** *************** ***********@mic rosoft.com...
Willy,

I would be very interested in seeing such a sample. What are the WMI
Cluster Classes you mention? I have a similar need - to monitor and
restart
if needed a service on a cluster, and have not had much luck to date
finding
manged objects to allow me to perform this simple task. I could always
issue
shell commands, but thats just ... klugy. :)

Your help would be MOST appreciated!
Chuck Haeberle


Herewith a small sample that illustrates how one can use System.Manageme nt
and WMI to write cluster management application, note that the cluster needs
to run W2K3 for this to work.

using System;
using System.Manageme nt;
class App {
[MTAThread]
public static void Main() {
string clusterName = "MyCluster" ; // cluster alias
string custerGroupReso urce = "FS_Resourc e1"; // Cluster group name
ConnectionOptio ns options = new ConnectionOptio ns();
options.Usernam e = "ClusterAdm in"; //could be in domain\user format
options.Passwor d = "HisPasswor d";
// Connect with the mscluster WMI namespace on the cluster named "MyCluster"
ManagementScope s = new ManagementScope ("\\\\" + clusterName +
"\\root\\msclus ter", options);
ManagementPath p = new ManagementPath( "Mscluster_Clus tergroup.Name=' " +
custerGroupReso urce +"'");
using(Managemen tObject clrg = new ManagementObjec t (s, p, null ))
{
// Take clustergroup off line and read its status property when done
TakeOffLine(clr g);
clrg.Get();
Console.WriteLi ne(clrg["Status"]);
System.Threadin g.Thread.Sleep( 3000); // Sleep for a while
// Bring back online and get status.
BringOnLine(clr g);
clrg.Get();
Console.WriteLi ne(clrg["Status"]);

}
}
static voidTakeOffLine (ManagementObje ct resourceGroup)
{
ManagementBaseO bject outParams =
resourceGroup.I nvokeMethod("Ta keoffline", null, null);
}
static void BringOnLine(Man agementObject resourceGroup)
{
ManagementBaseO bject outParams =
resourceGroup.I nvokeMethod("Ta keoffline", null, null);
}
}

Check the MSDN documentation for all other WMI mscluster namespace classes,
and write some small programs to exercize the features offered by the
individual classes.
If in doubt about some property or feature, load wbemtest.exe and connect to
the cluster namespace. Wbemtest allows you to get/change the properties of
cluster resources and execute the methods exposed by the mscluster classes.

Willy.

Nov 16 '05 #13
"Chuck Haeberle" <Ch***********@ discussions.mic rosoft.com> wrote in message
news:DD******** *************** ***********@mic rosoft.com...
rWilly - thank you very much! Very interesting.

However I have in the meantime, managed to find another solution using
msclus.dll which we copied to my XP dev machine from a Server 2003
machine.

First I registered msclus.dll using regsvr32
I added msclus.dll as a reference to my project, allowing .NET to build a
standard com interop layer for me.

It's a little more brute force but it is working for us:

using MSClusterLib;
..//..
static void Main(string[] args)
{
ClusterClass cluster = new ClusterClass();

cluster.Open("M DSQLDEV");

Console.WriteLi ne(cluster.Name );
Console.WriteLi ne(cluster.Vers ion);
ClusResourcesCl ass resources = (ClusResourcesC lass)cluster.Re sources;

for(int i=0; i< resources.Count ; i++)
{
ClusResourceCla ss resource = (ClusResourceCl ass)resources[i+1];
if(resource.Nam e == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLi ne(resource.Onl ine(30).ToStrin g());
break;
}
}

for(int i=0; i< resources.Count ; i++)
{
ClusResourceCla ss resource = (ClusResourceCl ass)resources[i+1];
if(resource.Nam e == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLi ne(resource.Off line(30).ToStri ng());
break;
}
}
}

Chuck ,

Right, this is the way to go when you have W2K based clusters. The only
problem here is that you can't handle cluster event notifications.
Note that the mscluster WMI stuff is only available on W2K3 and the
documentation is a bit lacking but the provider seems to do it's job pretty
well.

Willy.
Nov 16 '05 #14


i've used this code in vb.net and added msclus.dll
_______________ _______________ _______________ _______

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim objcluster, colResTypes, colResType, colResTypeResou rces,
clusResource, colClusProperti es
objcluster = CreateObject("M SCluster.Cluste r")
colResTypes = CreateObject("M SCluster.ClusRe sTypes")
colResType = CreateObject("M SCluster.ClusRe sType")
colResTypeResou rces =
CreateObject("M SCluster.ClusRe sTypeResources" )
clusResource = CreateObject("M SCluster.clusRe source")
colClusProperti es = CreateObject("M SCluster.ClusPr operties")

objCluster.Open ("CVSPWCLSTR ")

colResTypes = objCluster.Reso urceTypes
colResType = colResTypes.Ite m("TextBox1.Tex t")
colResTypeResou rces = colResType.Reso urces
For Each clusResource In colResTypeResou rces
colClusProperti es = clusResource.Co mmonProperties
MsgBox(TextBox1 .text & " resource name: " & "
clusResource.Na me ")
Next
it says RPC not available..
pointing to objCluster.Open ("CVSPWCLSTR ")

does it means access denied? i'm executing remotely from the cluster and
i'm using xp with vb.. i don't have enought administrative rights but i
can use some admin account if i'll use the Remote desktop
connection..how to access that with using remote desktop connection? any
ideas? thanks..

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #15

hi willy,
I tried your code snippet but it does not seem to work with my clusters.
Is this supposed to work if i run it from a remote machine.
My cluster is on an IA64 win2k3 machine and i am running this program
from a 32 bit machine.
Also i could not find 'Mscluster_Clus tergroup' on msdn?
thanks


*** Sent via Developersdex http://www.developersdex.com ***
Feb 4 '06 #16

"sarita" <an*******@devd ex.com> wrote in message
news:ez******** ********@TK2MSF TNGP10.phx.gbl. ..
|
| hi willy,
| I tried your code snippet but it does not seem to work with my clusters.
| Is this supposed to work if i run it from a remote machine.
| My cluster is on an IA64 win2k3 machine and i am running this program
| from a 32 bit machine.
| Also i could not find 'Mscluster_Clus tergroup' on msdn?
| thanks
|

Not sure what code you are talking about, do you mind posting what you have
and doesn't seem to work.
It should work from a remote machine, and that's the only way you should
ever use it.
MSCluster_Resou rceGroup is probably what you are looking for.

Willy.
Feb 6 '06 #17

hi willy,
As per my understanding i have two choices for writing a C# cluster
management application.
1. Use msclus.dll
does not support event notification??
2. use system management with WMI.

What are the advantages/disadvantages of both methods?
My requirement is that the application would run on a remote machine and
may have a different platform than the cluster nodes. Authentication
would be windows auth.

thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Feb 6 '06 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1630
by: Leonardo C | last post by:
Hi: I'm trying to setup a MS Cluster but I don't know if it is feasible to configure it in the way I think. I have two machines with win2k server and MSSQL-2000 one of them is currently performing as the production database and the other one is the backup. The secondary one is keeping updated via the "Log Shipping" technic.
0
1441
by: williams | last post by:
I am trying to encrypt data in a SQLServer 2000 Cluster using Microsoft EFS. I have successfully encrypted a standalone DB but we are having difficulty with the Cluster. I am only encrypting the datafile.mdf. Has anyone implemented Microsoft EFS in a SQL Server 2000 cluster (all servers run Win2003EntEd)? All the Microsoft documentation describes how to enable EFS for a File Share Resource in the cluster. However, for a sqlserver...
1
4952
by: richardshen | last post by:
DB2 V8 on windows 2003 cluster server. DB2MSCS -f:db2.cfg DB2 instance is in the cluster now. DB2MSCS -u:db2 DB2 instance is in the local node now. I want to cluster the instance again DB2MSCS -f:db2.cfg This is the error msg:
0
1460
by: Pankajdynamic | last post by:
Hi, I've gone through couple of articles on conguring the NLB cluster using NLB Manager.Below are my queries: 1. In NLB Manager, Cluster Parameter tab, - Can I give any IP address for Cluster IP address. If No, from where/how do I obtained this IP? 2. After configuring the Cluster IP address, can I expect Reply if I ping to this IP address? (I'm not getting reply)
4
8595
by: ThunderMusic | last post by:
Hi, We have many servers setup as a cluster. When one server crashes, another one take the relay... We want to know if it's possible (I suppose it is) to make a Windows service developed with .NET 2.0 work in a cluster environment. I mean, how to make sure the service will take the relay if one server fails. Is there something special to do or it will work by itself? (I'm not personally used to clusters, we need it at my office and they...
3
5429
by: Simon | last post by:
Hi All, I'm hoping someone will have some words of wisdom for me regarding MS Clustering on Windows 2003. I have a service that runs on a cluster. During invocation it's supposed to determine from the cluster which node is active (this is a active/standby configuration) and either proceed or sleep depending on the status. The interface to the cluster is that advertised by the standard interop layer built by Visual Studio for the...
2
4783
by: dunleav1 | last post by:
I have a many row and many column table that is in a 16K page size. I have four indexes on the table. I am running row compression on the table. The table does not have a primary key. The table does not have a clustered index. I ran a reorg on the table and the indexes. I ran runstats on the table and the indexes after the reorg. Three indexes on the table have an index cluster ratios of 99,99,100 respectively. The fourth index has a...
1
3585
by: =?Utf-8?B?S2Vubnk=?= | last post by:
I have one bat file that contains a command to startup Java Program. Then, I would like to create a cluster job to call the bat file. In case of one computer is down, another computer can also call the bat file and startup my Java Program. For this purpose, I have tried to place the bat file into share drive of two computers which are cluster machine. Also, I used Generic Application to create a job to call my bat file and this job is...
10
3161
by: Ian | last post by:
Henry J. wrote: MDC *guarantees* clustering, whereas a table with a clustering index will eventually require maintenance (a.k.a. reorg) to maintain the cluster ratio. That's not to say that a clustering index isn't still valuable (especially for high cardinality columns that aren't a reasonable candidate as an MDC dimension).
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.