Remove Server Node from Cache
The dynamic NCache cluster supports removing server nodes from a cache cluster at runtime. When you remove a cache server, the existing cluster automatically updates its membership and notifies all the clients about it.
Mirrored Cache
In the Mirrored cache cluster, data resides in both nodes. When active nodes leave the cluster, the passive node becomes active and handles all incoming client requests. If a passive node leaves, there is no visible change in the cluster. You can remove a server node at any time. The cache needs to stop before removing a node from a cluster.
For the NCache Open Source , you can manually edit config.ncconf and client.ncconf located at %NCHOME%\config. %NCHOME%
is the NCache install directory. You can edit these files through any text editor of your choice. Consider a cache demoClusteredCache registered on these server nodes, i.e., 20.200.20.29 and 20.200.20.30, and the server node 20.200.20.30 needs to be removed from the cluster.
Configuration for Node to Be Removed
Step 1: Stop Cache
Stop the cache on the server node, which is to be removed (20.200.20.30 in this case) through PowerShell using the Stop-Cache cmdlet.
Stop-Cache -Name demoClusteredCache
Step 2: Remove Cache Configuration from config.ncconf
The configuration files of all server nodes contain the information of these server nodes. To remove a node from the cache, remove the entire configuration of the cache from config.ncconf of the node to be removed.
For example, in this scenario, the complete configuration of the demoClusteredCache in the <cache-config>
section will be removed from 20.200.20.30.
Important
Note that the server IPs and cache name will be according to your own environment.
<cache-config cache-name="demoClusteredCache">
...
<cache-deployment>
<servers>
<server-node ip="20.200.20.29"/>
<server-node ip="20.200.20.30"/>
</servers>
</cache-deployment>
</cache-config>
Step 3: Restart NCache Service
For the configuration changes made to take effect, restart the NCache Service. Make sure you have enough privileges to restart the service. If the user is not part of the Administrator's group, run PowerShell as administrator, or you might get an error message that "Cannot open ncachesvc service on computer."
Execute the following command in PowerShell to restart the NCache Service:
Restart-Service -Name NCacheSvc
Step 4: Verify Successful Removal of Cache
To verify that the node is absent from the clustered cache, open PowerShell and use the Get-Caches cmdlet on the server node.
Get-caches
If the server node is successfully removed, the list will not contain the name of the cache demoClusteredCache.
Configuration for Remaining Nodes
Step 5: Update Configuration
Once the node is gone from the cache, you need to update the <cache-deployment>
configuration on the remaining nodes of the cluster. i.e., 20.200.20.29 in this case. To remove a server node from a cache cluster, remove the <server-node>
tag containing the removed node IP within the <cache-deployment>
section in config.ncconf of the remaining server. For example, <server-node ip="20.200.20.30"/>
is removed from the <servers>
list of the remaining server node in the following sample configuration.
Important
Note that the server IPs and cache name will be according to your own environment.
<cache-config cache-name="demoClusteredCache">
...
<cache-deployment>
<servers>
<server-node ip="20.200.20.29"/>
<server-node ip="20.200.20.30"/>
</servers>
</cache-deployment>
...
</cache-config>
Important
Repeat this step for all server nodes.
Step 6: Remove server node from client.ncconf
After removing the node from config.ncconf, you need to update client.ncconf. In the client.ncconf file remove the server node configuration.
Refer to Remove Client from Cache for further details.
Step 7: Verify Successful Node Removal
To verify the successful server node removal, open PowerShell and use Get-Caches cmdlet with the -Detail
parameter, which displays all caches registered on the server and their respective servers.
Get-Caches -Detail
If the node is no longer in the cache, the list will display the Cluster Size
for the cache along with all registered nodes. If there is no update, there might have been some mistake while changing the configuration or restarting the NCache Service.
Important
Repeat this step for all server nodes.
See Also
Create a Cache
Remove Cache
Add Server Node
Update Cache Config