Memcached, a high-performance, distributed memory caching system, typically operates on port 11211 for both TCP and UDP protocols. If you're new to it, this information can be extremely useful in understanding and troubleshooting network connections.
Although the default port is 11211, you have the flexibility to change it as needed by adjusting the Memcached configuration settings and defining a different port number. A case in point, if you need to run Memcached on port 11212, you can do so using the
memcached command-line tool with the
-p option followed by the desired port number:
To ensure that Memcached is indeed operating on the correct port, you can utilize the
netstat command. It lists network statistics and can help confirm if Memcached is listening on the port you've set:
If everything is running smoothly, this will output a line like:
tcp 0 0 0.0.0.0:11212 0.0.0.0:* LISTEN
This indicates that Memcached is successfully running and listening on port 11212.
However, remember that certain hosting providers may restrict access to some ports due to security constraints. If you encounter connection difficulties or issues, it's advisable to verify the available ports with your hosting provider.
By understanding the standard port used by Memcached and how to modify it, you'll be better equipped to manage your application's performance and troubleshoot any potential issues.