469,362 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

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 #1
17 24331
Now that would be pretty cool...

I haven't seen the API but it must be very low level to support data sync
and load balancing, etc. A managed wrapper may not be possible or
desirable...

But I wonder if one could design a C# clustering api using msmq, sockets,
and wmi? What would go into such a project?

ok,
aq

"Peter Ericsson" <pe**************@ericsson.com> wrote in message
news:1d****************************@phx.gbl...
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 #2
There is a big difference between a wrapper and implementing an API.
The MS cluster API's (cluster resources) are implemented using C/C++ , the
reason is high reliability, efficiency and a low memory footprint, something
that managed code doesn't offer, as it was not designed to be used as a
system level platform.
The cluster management API's are available as native C/C++ API's and a set
of COM interfaces, so if you only need to manage MS cluster server, you
could wrap the COM api.

Willy.

"Peter Ericsson" <pe**************@ericsson.com> wrote in message
news:1d****************************@phx.gbl...
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 #3
OP was talking about MS cluster server API's , not sure what this has to do
with msmq sockets and WMI.

Willy.

"Ahmed Qurashi" <ah**********@gmail.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
Now that would be pretty cool...

I haven't seen the API but it must be very low level to support data sync
and load balancing, etc. A managed wrapper may not be possible or
desirable...

But I wonder if one could design a C# clustering api using msmq, sockets,
and wmi? What would go into such a project?

ok,
aq

"Peter Ericsson" <pe**************@ericsson.com> wrote in message
news:1d****************************@phx.gbl...
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 #4
Yup, a bit offtopic there...just wondering aloud what a c# implementation of
an open source clustering software architecture would look like..

ok,
aq

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:O%******************@TK2MSFTNGP09.phx.gbl...
OP was talking about MS cluster server API's , not sure what this has to do with msmq sockets and WMI.

Willy.

Nov 16 '05 #5
Based on the same "shared clustering" technology used by Windows cluster
server? IMO it would be written in C and C++ and some assembly.
Don't forget that WCS consists of a low level device driver and a filter
driver, a service and a number of resource managers that expose the cluster
API's to consumers.
The driver can't be written in managed code point. The service could be
written in C#, the resource managers also, but the cluster aware resources
(think SQL server, Exchange, the file server service ...) expect a C
function export as API style, that means your resource managers must be
written in C (or C++) too. What's left is your service, but I don't expect
you would implement this one in managed code if all others are unmanaged.

Willy.

"Ahmed Qurashi" <ah**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yup, a bit offtopic there...just wondering aloud what a c# implementation
of
an open source clustering software architecture would look like..

ok,
aq

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:O%******************@TK2MSFTNGP09.phx.gbl...
OP was talking about MS cluster server API's , not sure what this has to

do
with msmq sockets and WMI.

Willy.


Nov 16 '05 #6
My only interest is to manage the cluster. Start and stop
resorces, get notifications when they fail, find out what
kind of resources are available in the cluster and so on.
I mean these kind of methods are available for windows
services but not for clustered resources.

I'm not an COM expert so I'd rather stick to C#.

/Peter
-----Original Message-----
There is a big difference between a wrapper and implementing an API.The MS cluster API's (cluster resources) are implemented using C/C++ , thereason is high reliability, efficiency and a low memory footprint, somethingthat managed code doesn't offer, as it was not designed to be used as asystem level platform.
The cluster management API's are available as native C/C++ API's and a setof COM interfaces, so if you only need to manage MS cluster server, youcould wrap the COM api.

Willy.

"Peter Ericsson" <pe**************@ericsson.com> wrote in messagenews:1d****************************@phx.gbl...
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 #7
The management API's are also available through COM, that doesn't mean you
can't use C# to access them, simply create a interop assembly from the
automation server dll (msclus.dll) and use the API's from C#.
However, the "automation server API's" don't support notifications, a much
better "managed" option is to use System.Management namespace classes and
the WMI cluster classes MSCluster_XXXX to build cluster management
applications using C#.

I can post a sample of the latter if you are interested.

Willy.

"Peter Ericsson" <pe**************@ericsson.com> wrote in message
news:25****************************@phx.gbl...
My only interest is to manage the cluster. Start and stop
resorces, get notifications when they fail, find out what
kind of resources are available in the cluster and so on.
I mean these kind of methods are available for windows
services but not for clustered resources.

I'm not an COM expert so I'd rather stick to C#.

/Peter
-----Original Message-----
There is a big difference between a wrapper and

implementing an API.
The MS cluster API's (cluster resources) are implemented

using C/C++ , the
reason is high reliability, efficiency and a low memory

footprint, something
that managed code doesn't offer, as it was not designed

to be used as a
system level platform.
The cluster management API's are available as native

C/C++ API's and a set
of COM interfaces, so if you only need to manage MS

cluster server, you
could wrap the COM api.

Willy.

"Peter Ericsson" <pe**************@ericsson.com> wrote

in message
news:1d****************************@phx.gbl...
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 #8
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
"Willy Denoyette [MVP]" wrote:
The management API's are also available through COM, that doesn't mean you
can't use C# to access them, simply create a interop assembly from the
automation server dll (msclus.dll) and use the API's from C#.
However, the "automation server API's" don't support notifications, a much
better "managed" option is to use System.Management namespace classes and
the WMI cluster classes MSCluster_XXXX to build cluster management
applications using C#.

I can post a sample of the latter if you are interested.

Willy.

"Peter Ericsson" <pe**************@ericsson.com> wrote in message
news:25****************************@phx.gbl...
My only interest is to manage the cluster. Start and stop
resorces, get notifications when they fail, find out what
kind of resources are available in the cluster and so on.
I mean these kind of methods are available for windows
services but not for clustered resources.

I'm not an COM expert so I'd rather stick to C#.

/Peter
-----Original Message-----
There is a big difference between a wrapper and

implementing an API.
The MS cluster API's (cluster resources) are implemented

using C/C++ , the
reason is high reliability, efficiency and a low memory

footprint, something
that managed code doesn't offer, as it was not designed

to be used as a
system level platform.
The cluster management API's are available as native

C/C++ API's and a set
of COM interfaces, so if you only need to manage MS

cluster server, you
could wrap the COM api.

Willy.

"Peter Ericsson" <pe**************@ericsson.com> wrote

in message
news:1d****************************@phx.gbl...
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 #9


hi.. i'm a newbie here.. i think i have the same problem with you
peter..

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,server1b
server2a,server2b
server3a,server3b

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.. thanks..

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


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,server1b
server2a,server2b
server3a,server3b

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.microsoft.com> wrote in message
news:A7**********************************@microsof t.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.Management
and WMI to write cluster management application, note that the cluster needs
to run W2K3 for this to work.

using System;
using System.Management;
class App {
[MTAThread]
public static void Main() {
string clusterName = "MyCluster"; // cluster alias
string custerGroupResource = "FS_Resource1"; // Cluster group name
ConnectionOptions options = new ConnectionOptions();
options.Username = "ClusterAdmin"; //could be in domain\user format
options.Password = "HisPassword";
// Connect with the mscluster WMI namespace on the cluster named "MyCluster"
ManagementScope s = new ManagementScope("\\\\" + clusterName +
"\\root\\mscluster", options);
ManagementPath p = new ManagementPath("Mscluster_Clustergroup.Name='" +
custerGroupResource +"'");
using(ManagementObject clrg = new ManagementObject (s, p, null ))
{
// Take clustergroup off line and read its status property when done
TakeOffLine(clrg);
clrg.Get();
Console.WriteLine(clrg["Status"]);
System.Threading.Thread.Sleep(3000); // Sleep for a while
// Bring back online and get status.
BringOnLine(clrg);
clrg.Get();
Console.WriteLine(clrg["Status"]);

}
}
static voidTakeOffLine(ManagementObject resourceGroup)
{
ManagementBaseObject outParams =
resourceGroup.InvokeMethod("Takeoffline", null, null);
}
static void BringOnLine(ManagementObject resourceGroup)
{
ManagementBaseObject outParams =
resourceGroup.InvokeMethod("Takeoffline", 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("MDSQLDEV");

Console.WriteLine(cluster.Name);
Console.WriteLine(cluster.Version);
ClusResourcesClass resources = (ClusResourcesClass)cluster.Resources;

for(int i=0; i< resources.Count; i++)
{
ClusResourceClass resource = (ClusResourceClass)resources[i+1];
if(resource.Name == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLine(resource.Online(30).ToString());
break;
}
}

for(int i=0; i< resources.Count; i++)
{
ClusResourceClass resource = (ClusResourceClass)resources[i+1];
if(resource.Name == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLine(resource.Offline(30).ToString()) ;
break;
}
}
}

"Willy Denoyette [MVP]" wrote:

"Chuck Haeberle" <Ch***********@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.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.Management
and WMI to write cluster management application, note that the cluster needs
to run W2K3 for this to work.

using System;
using System.Management;
class App {
[MTAThread]
public static void Main() {
string clusterName = "MyCluster"; // cluster alias
string custerGroupResource = "FS_Resource1"; // Cluster group name
ConnectionOptions options = new ConnectionOptions();
options.Username = "ClusterAdmin"; //could be in domain\user format
options.Password = "HisPassword";
// Connect with the mscluster WMI namespace on the cluster named "MyCluster"
ManagementScope s = new ManagementScope("\\\\" + clusterName +
"\\root\\mscluster", options);
ManagementPath p = new ManagementPath("Mscluster_Clustergroup.Name='" +
custerGroupResource +"'");
using(ManagementObject clrg = new ManagementObject (s, p, null ))
{
// Take clustergroup off line and read its status property when done
TakeOffLine(clrg);
clrg.Get();
Console.WriteLine(clrg["Status"]);
System.Threading.Thread.Sleep(3000); // Sleep for a while
// Bring back online and get status.
BringOnLine(clrg);
clrg.Get();
Console.WriteLine(clrg["Status"]);

}
}
static voidTakeOffLine(ManagementObject resourceGroup)
{
ManagementBaseObject outParams =
resourceGroup.InvokeMethod("Takeoffline", null, null);
}
static void BringOnLine(ManagementObject resourceGroup)
{
ManagementBaseObject outParams =
resourceGroup.InvokeMethod("Takeoffline", 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.microsoft.com> wrote in message
news:DD**********************************@microsof t.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("MDSQLDEV");

Console.WriteLine(cluster.Name);
Console.WriteLine(cluster.Version);
ClusResourcesClass resources = (ClusResourcesClass)cluster.Resources;

for(int i=0; i< resources.Count; i++)
{
ClusResourceClass resource = (ClusResourceClass)resources[i+1];
if(resource.Name == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLine(resource.Online(30).ToString());
break;
}
}

for(int i=0; i< resources.Count; i++)
{
ClusResourceClass resource = (ClusResourceClass)resources[i+1];
if(resource.Name == "Ciena NetworkTracker Escalation Manager")
{
Console.WriteLine(resource.Offline(30).ToString()) ;
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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim objcluster, colResTypes, colResType, colResTypeResources,
clusResource, colClusProperties
objcluster = CreateObject("MSCluster.Cluster")
colResTypes = CreateObject("MSCluster.ClusResTypes")
colResType = CreateObject("MSCluster.ClusResType")
colResTypeResources =
CreateObject("MSCluster.ClusResTypeResources")
clusResource = CreateObject("MSCluster.clusResource")
colClusProperties = CreateObject("MSCluster.ClusProperties")

objCluster.Open("CVSPWCLSTR")

colResTypes = objCluster.ResourceTypes
colResType = colResTypes.Item("TextBox1.Text")
colResTypeResources = colResType.Resources
For Each clusResource In colResTypeResources
colClusProperties = clusResource.CommonProperties
MsgBox(TextBox1.text & " resource name: " & "
clusResource.Name ")
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_Clustergroup' on msdn?
thanks


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

"sarita" <an*******@devdex.com> wrote in message
news:ez****************@TK2MSFTNGP10.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_Clustergroup' 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_ResourceGroup 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Leonardo C | last post: by
1 post views Thread by richardshen | last post: by
reply views Thread by Pankajdynamic | last post: by
4 posts views Thread by ThunderMusic | last post: by
1 post views Thread by =?Utf-8?B?S2Vubnk=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.