Configure Firewall (Optional)
If you have a firewall or a router between your cache clients (web/app servers) and the cache servers, then you must open up specific ports in your firewall. This will ensure that cache clients are able to talk to the cache servers.
NCache server uses the following TCP ports for 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: Cluster-port that you define in cache cluster configuration. It is recommended to use a consecutive range of ports, (Default range is 7800-7900), and configure Firewall to allow communication on this port range.
- Cache Management Port: The port range for cache management. The default port range is 8300-8400.
- Web Management Port: 8251 (Default TCP port for NCache Web Management)
- Prometheus Server Port: 9090 (Default port at which the Prometheus 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.
- SNMP Cache Listeners The port range for SNMP cache listeners. The default port range is 11000-11999. All of these are UDP Ports.
- SNMP Client Listeners The port range for SNMP client listeners. The default port range is 12000-12999. All of these are UDP Ports.
- SNMP Bridge Listeners The port range for SNMP bridge listeners. The default port range is 13000-13999. All of these are UDP Ports.
- SNMP Bridge Cache Listeners The port range for SNMP bridge cache listeners. The default port range is 14000-14999. All of these are UDP Ports.
- Prometheus Agent Port: 8255 (Default port at which Prometheus agent runs). This port is configurable through NCache service config.
- Metrics Server Port 8255 (Default TCP port for the Metrics Server). This port is configurable and can be changed in the Alachisoft.NCache.Service.dll.config file
If you want to use bridge, open the following ports:
- Bridge Port: Default is 9900
- Bridge Management port: Default is 8260
- Bridge Ports: Default range is 10000-11000
But, 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
You can also change ports by modifying the service configuration file of all servers. This file is found in NCache installation as follows:
- .NET: Alachisoft.NCache.Service.exe.config located in %NCHOME%/bin/service
.NET Core: Alachisoft.NCache.Service.dll.config located in %NCHOME%/bin/service
Change the “Port” for Client/Server communication and “ManagementPort” 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 the part of the Administrator's group, make sure to run Windows PowerShell as administrator, otherwise 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