KJBweb

Technical Notes & How To's
Menu
  • Blog
  • How-To
Home
Blog
How to Test Memcached Connectivity

How to Test Memcached Connectivity

Karl November 30, 2016

If you’re looking to verify connectivity from your application server to your Memcached server, a simple CURL request won’t do (much to my dismay).

Instead, you’ll need to use either Telnet or Netcat (nc) to poll the Memcached server for it’s stats, this can be done like so:

Memcached Telnet Connectivity Test

First, open a telnet session to your Memcached server on the appropriate port; by default Memcached listens on port 11211:

telnet memcached.yourdomain.com 11211

All being well, you should then be greeted with the following output:

Trying 208.67.222.124...
Connected to memcached.yourdomain.com.
Escape character is '^]'.

Typing “stats” should yield the following result:

stats
STAT pid 20781
STAT uptime 169659
STAT time 1480504602
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 2.405634
STAT rusage_system 1.338796
STAT curr_connections 5
etc...

Memcached Netcat Connectivity Test

Netcat is a little nicer, in that you can connect and pull stats from your Memcached server using just the one command, run the following from your application server:

echo stats | nc memcached.yourdomain.com 11211

This should yield the following output and close automatically:

Trying 172.17.96.213...
Connected to memcached.yourdomain.com.
Escape character is '^]'.
stats
STAT pid 20781
STAT uptime 169659
STAT time 1480504602
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 2.405634
STAT rusage_system 1.338796
STAT curr_connections 5
...
...
...
STAT total_items 536
STAT evictions 0
END
quit
Connection closed by foreign host.

There you have it, here’s how to test connectivity to your Memcached server using both Netcat and Telnet, if you have any queries be sure to use the comments section below.

Share
Tweet
Email
Prev Article
Tags:memcache

About The Author

Karl

Systems engineer by day, website developer and electronics hobbyist by night.

Leave a Reply

Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • How to Install the NewRelic MySQL Plugin
  • Repair “Repository Error: database disk image is malformed” YUM Issue
  • How to Check NTP Connectivity and Function on the Command Line
  • How to Perform a GET Request with CURL via the Command Line
  • How to Install and Remove a Deb Package via the Command Line in Ubuntu

Recent Comments

  • Karl on How to Install rar/unrar on Ubuntu 18.04 LTS (Bionic Beaver)
  • John on How to Install rar/unrar on Ubuntu 18.04 LTS (Bionic Beaver)
  • How to Install rar/unrar on Ubuntu 16.04 LTS (Xenial) - KJBweb on How to Install rar/unrar on Ubuntu 18.04 LTS (Bionic Beaver)
  • FC on How to Install rar/unrar on Ubuntu 16.04 LTS (Xenial)

Archives

  • August 2018
  • November 2016

Categories

  • Blog
  • How-To

KJBweb

Technical Notes & How To's
Copyright © 2019 KJBweb