Add Server Node to the Cluster
NCache cluster is dynamic and supports adding server nodes to a running cache cluster at runtime. When the new cache server starts, it automatically joins the existing cache cluster and connects with a cache server if the caching topology requires it.
Consider a cache named demoClusteredCache registered on 20.200.20.29 and a new node, i.e., 20.200.20.30 is to be added to the cache.
Note
You can add a server node at runtime without stopping the cache.
Configuration for Existing Nodes
Step 1: Add Server Node in config.ncconf
Add the configuration of the new node under the <servers>
tag in the <cache-deployment>
section in the config.ncconf file of the existing nodes. In the example given below, the server nodes 20.200.20.29 already existed in the server node list in config.ncconf, and the information of the new server node <server-node ip="20.200.20.30"/>
is added in the server list.
The configuration file (config.ncconf) before adding the server node contains the node IP address as follows.
<cache-config cache-name="demoClusteredCache">
<cache-settings inproc="False">
...
<cache-deployment>
<servers>
<server-node ip="20.200.20.29" />
</servers>
...
</cache-deployment>
</cache-settings>
</cache-config>
Whereas the configuration file (config.ncconf) after adding the server node contains the IP address of both server nodes as follows.
<cache-config cache-name="demoClusteredCache">
<cache-settings inproc="False">
...
<cache-deployment>
<servers>
<server-node ip="20.200.20.29" />
<server-node ip="20.200.20.30" />
</servers>
...
</cache-deployment>
</cache-settings>
</cache-config>
Please note the following points before updating the configurations:
- The
cache-name
in the example used is demoClusteredCache. Ensure you change the server cache name. - Replace the IP addresses given in the
<cache-deployment>
section with the IP Addresses of your cache servers. Note that the IP addresses must be the binded IPs.
Important
Ensure you add the configurations in the config.ncconf file of all pre-existing server machines.
Step 2: Restart Cache (Optional)
If the cache has critical data and is already running on the existing nodes, do not restart the service on the existing nodes at this step. The cache will update the server list upon the next NCache Service restart.
Ensure you restart the NCache Service on the existing nodes so the configuration is updated accordingly on all the nodes.
Step 3: Add Server Node in client.ncconf
In the client.ncconf of the same machines, update the information about server nodes under the <configuration>
tag because the client application reads client.ncconf to connect to the cache on the server(s) specified in this file.
Please refer to Add Client to Cache for further details.
Important
Repeat this step on all existing server nodes.
Configuration for New Node
Step 4: Add Cache Configuration in config.ncconf
The updated cache configuration of the existing node needs to be copied in config.ncconf of the new server node (20.200.20.30 in this case) for configuration consistency on all cluster nodes.
<configuration>
<cache-config cache-name="demoClusteredCache">
<cache-settings inproc="False">
<logging enable-logs="True" trace-errors="True" trace-notices="False" log-path=""/>
<performance-counters enable-counters="True"/>
<cache-notifications item-remove="False" item-add="False" item-update="False"/>
<cleanup interval="15sec"/>
<storage type="heap" cache-size="1024mb"/>
<eviction-policy default-priority="normal" eviction-ratio="5%"/>
<cache-topology topology="mirrored">
<cluster-settings operation-timeout="60sec" stats-repl-interval="60sec" use-heart-beat="False">
<cluster-connection-settings cluster-port="7806" port-range="1" connection-retries="2" connection-retry-interval="2secs"/>
</cluster-settings>
</cache-topology>
</cache-settings>
<cache-deployment>
<servers>
<server-node ip="20.200.20.29"/>
<server-node ip="20.200.20.30"/>
</servers>
</cache-deployment>
</cache-config>
</configuration>
Please note the following points before updating the configurations:
There might be other caches already registered on the cache server. Please paste the following configuration under the
<configuration>
section so that this new<cache-config>
section is at the same level as other sample caches shipped with setup.Make sure that the name of the cache is the same as the
cache-name
on the existing nodes.
Note
Please ensure that the cache-config
is the same as the cache-config
on the existing nodes.
Step 5: Restart NCache Service
For the configuration changes made to take effect, restart the NCache Service. Ensure you have enough privileges to restart the service. If the user is not part of the Administrator's group, run PowerShell as an administrator, or you might get an error message, "Cannot open ncachesvc service on computer."
Execute the following command in PowerShell to restart the NCache Service:
Restart-Service -Name NCacheSvc
Step 6: Start Cache on New Node
Once cache creation is verified, start the cache on each server through PowerShell using the Start-Cache cmdlet.
Start-Cache -Name demoClusteredCache
Step 7: Add Server Node in client.ncconf
In client.ncconf of the same machine, add the following description about cache under the <cache>
tag because the client application reads client.ncconf to connect to the cache on the server(s) specified in this file. Refer to Add Client to Cache for further details.
Step 8: Verify Successful Addition of Node
To verify the successful cache server node addition, open PowerShell and use Get-Caches cmdlet with the -Detail
parameter, which displays all caches registered on the server and their respective servers along with additional information.
Get-Caches -Detail
If the node exists as part of the cache, the list will display the Cluster Size
for the cache along with all registered nodes. If it does not, there might have been some mistake while changing the configuration or restarting the NCache Service.
Important
Repeat this step for all server nodes.
Mirror Cache Behavior
The Mirrored cache consists of two server nodes, active and passive. The active node is considered the coordinator node. A coordinator node is the oldest server node in any cache cluster with membership management authority. The other node is passive, i.e., a mirrored version of an active node.
- State Transfer:
State transfer in NCache means automatically moving or copying data from one cache server to another. In the Mirrored cache, the passive node replicates the state from the active node when it joins the cache cluster.
- Client Connectivity:
Cache clients can only connect with the active node. The passive node replicates the data stored in the active node in case the active node goes down.
Note
At a time, your cache can only connect to 1 client, it can be local or remote.
See Also
Create a Cache
Remove Cache
Remove Server Node
Update Cache Config