If another computer Wake up, it checks if the cluster exists, and if it does, it adds itself to the cluster.
I’m having trouble trying to get a reference to the cluster object from the cluster IP address. Each node knows its address and cluster address. I want to avoid that each node has a list of all the other nodes in its cluster.
I found that I need to look at the non-cluster IP address to work with -nlbcluster .Specifying the cluster IP address is just an error.
Is there any way to do this, I don’t have to update this list on every node every time I add or remove a node from the cluster. I think I also You want to avoid the situation where the node wakes up, and you must poll each machine in the “main” list to find a machine to add yourself to the cluster.
Import-Module ServerManager
# Interface cards should be named the same and have a fixed IP
$interfaceName = "NLB"
$clusterName = "NLB-Cluster"
$clusterIpAddress = "1.2 .3.0"
$clusterSubnet = "255.0.0.0"
# Install Network Load Balancing and Tools
Write-Host "Install Network Load Balancing and Tools"
Add -WindowsFeature NLB, RSAT-NLB
Import-Module NetworkLoadBalancingClusters
# If the cluster hasn't been created yet then create it
if (!(Get-NlbCluster -HostName $clusterIpAddress -ErrorAction SilentlyContinue))
{
Write-Host "Creating NLB Cluster: $clusterName" -ForegroundColor yellow
# Create Cluster (default unicast)
New-NlbCluster -InterfaceName $interfaceName -ClusterName $clusterName -ClusterPrimaryIP $clusterIpAddress -SubnetMask $clusterSubnet
# Remove defaults
Write-Host "Removing default port rules" -ForegroundColor yellow
Get-NlbClusterPortRule | Remove-NlbClusterPortRule -Force
# Create port rules
Get-NlbCluster | Add-NlbClusterPortRule -StartPort 80 -EndPort 80 -Protocol TCP -Affinity None | Out-Null
Get-NlbCluster | Add-NlbClusterPortRule -StartPort 443 -EndPort 443 -Protocol TCP -Affinity None | Out -Null
}
else
{
Get-NlbCluster
}
# if this node isn't already a member of a cluster then add it
if(!(Get-NlbClusterNode -HostName $env:COMPUTERNAME))
{
# Add node to cluster
Write-Host "Adding node to cluster: $clusterName"- ForegroundColor yellow
Get-NlbCluster -HostName $clusterIpAddress | Add-NlbClusterNode -NewNodeName $env:COMPUTERNAME -NewNodeInterface $interfaceName
}
else
{
Get-NlbClusterNode< br />)
I have been trying to write a power shell program to check if the cluster exists. If not, then it will create it and add itself to it.
If another computer wakes up, it will check if the cluster exists, and if it does, it will add itself to the cluster.
I’m trying to get the cluster IP address from the cluster I have problems referencing objects. Each node knows its address and cluster address. I want to avoid that each node has a list of all other nodes in its cluster.
I found that I need to view non- The cluster IP address can only work with -nlbcluster. Specifying the cluster IP address is just an error.
Is there any way to do this, I don’t have to be on each node every time I add or remove a node from the cluster Update this list. I think I also want to avoid the situation where the node wakes up, and must poll every machine in the “master” list to find a machine in order to add myself to the cluster.
< p>
You can run the following script on all nodes in the cluster, create it if the cluster does not exist, otherwise just add the current computer to the existing cluster. All you need to do is to ensure that the All computers have a dedicated card with the same name. In the example below, the network card is named “NLB”.
Import-Module ServerManager# Interface cards should be named the same and have a fixed IP
$interfaceName = "NLB"
$clusterName = "NLB-Cluster"
$clusterIpAddress = "1.2.3.0"
$clusterSubnet = "255.0.0.0"# Install Network Load Balancing and Tools
Write-Host "Install Network Load Balancing and Tools"
Add-WindowsFeature NLB, RSAT-NLB
Import-Module NetworkLoadBalancingClusters# If the cluster hasn' t been created yet then create it
if (!(Get-NlbCluster -HostName $clusterIpAddress -ErrorAction SilentlyContinue))
{
Write-Host "Creating NLB Cluster: $clusterName" -ForegroundColor yellow# Create Cluster (default unicast)
New-NlbCluster -InterfaceName $interfaceName -ClusterName $clusterName -ClusterPrimaryIP $clusterIpAddress -SubnetMask $clusterSubnet# Remove defaults< br /> Write-Host "Removing default port rules" -ForegroundColor yellow
Get-NlbClusterPortRule | Remove-NlbClusterPortRule -Force# Create port rules
Get-NlbCluster | Add- NlbClusterPortRule -S tartPort 80 -EndPort 80 -Protocol TCP -Affinity None | Out-Null
Get-NlbCluster | Add-NlbClusterPortRule -StartPort 443 -EndPort 443 -Protocol TCP -Affinity None | Out-Null
)
else
{
Get-NlbCluster
}# if this node isn't already a member of a cluster then add it
if(! (Get-NlbClusterNode -HostName $env:COMPUTERNAME))
{
# Add node to cluster
Write-Host "Adding node to cluster: $clusterName" -ForegroundColor yellow
Get -NlbCluster -HostName $clusterIpAddress | Add-NlbClusterNode -NewNodeName $env:COMPUTERNAME -NewNodeInterface $interfaceName
}
else
{
Get-NlbClusterNode
}