Firewalls and Ports
If you have a firewall or a router between your cache clients (web/app servers) and the cache servers, you must open up specific ports to ensure that cache clients can talk to the cache servers.
Note
There is no need to configure the entire port range. For example, you don't need all 100 ports in the cluster port range. You will only need a few ports based on your caches. However, the minimum required ports should be open for communication.
NCache server uses the following TCP ports for communication.
NCache Ports Necessary For Client-to-Server Communication
- Client/Server Port: 9800 (Default TCP port for cache client and server communication).
- Management Port: 8250 (Default TCP port for PowerShell cmdlets and NCache Service).
- Cluster Port: 7800-7900 (The default port range). Cluster port that you define in a cache cluster configuration. Use a consecutive range of ports and configure your firewall to allow communication on this port range.
- Cache Management Port: 8300-8400 (The default port range). The port range for cache management.
- Web Management Port: 8251 (Default TCP port for NCache Management).
NCache Bridge Management Ports
If you want to use a bridge, open the following ports:
- Bridge Port: 9900 is the default port.
- Bridge Management port: 8260 is the default port.
- Bridge Ports: 10000-11000 is the default port range.
NCache Monitoring Ports
- Prometheus Server Port: 9090 (Default port at which the Prometheus server runs).
- Grafana Server Port: 3000 (Default port at which the Grafana server runs).
- SNMP Listeners Info Port: 8256 (Default port at which SNMP listens to). This port is configurable and can be changed in the Alachisoft.NCache.Service.dll.config file.
- JMX: 8257 (Default port at which JMX runs).
- Metrics Server Port: 8255 (Default TCP port for the Metrics Server). The Prometheus agent also uses this port. This port is configurable via the Alachisoft.NCache.Service.dll.config file.
Note
During the installation process, NCache lets you automatically enable access to these ports, using the Enable firewall ports using NCache option.
Modifying the NCache Port Range
If there is a port conflict and the above default ports are being used by other applications, then you must configure all the cache servers to use different ports.
Step 1: Modify the service configuration file for Ports
You can also change ports by modifying the service configuration file of all servers. This file is found in the NCache installation as follows:
- .NET 6: Alachisoft.NCache.Service.exe.config located in %NCHOME%/bin/service
- .NET: Alachisoft.NCache.Service.dll.config located in %NCHOME%/bin/service
- Java: Alachisoft.NCache.BridgeService.dll.config placed at %NCHOME%/bin/service.
Change the Port for Client/Server communication and Management Port for NCache management in the file below.
<appSettings>
...
<add key="NCacheServer.Port" value="9800"/>
...
<add key="NCacheServer.ManagementPort" value="8250"/>
...
</appSettings>
Step 2: Restart NCache Service
For the configuration changes made to take effect, restart NCache Service. Make sure you have enough privileges to restart the service. If the user is not a part of the administrator's group, make sure to run Windows 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 NCache Service:
Restart-Service -Name NCacheSvc