Dragonfly Cloud is now available in the AWS Marketplace - learn more

Question: What port does Memcached use?

Answer

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:

memcached -p 11212

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:

netstat -tln | grep 11212

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.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost