Is there any command line or php script which returns the memcached total memory usage?
Asked
Active
Viewed 4.7k times
5 Answers
43
As Mike said, you can look at the line including the "STAT bytes" to see memory usage:
$ echo "stats" | nc -w 1 <host> <port> | awk '$2 == "bytes" { print $2" "$3 }'
quanta
- 52,423
19
memcache's default port is 11211 so if memcache is local
telnet localhost 11211
Then run the stats command and that will spit out memory usage
stats
Mike
- 22,748
4
I personally use PhpMemcacheAdmin
http://code.google.com/p/phpmemcacheadmin/
It creates an easy to use GUI. Of course you'll need to have PHP support.
jaredsten
- 203
2
Another alternative to answer @mike,
echo "stats" | nc localhost 11211
#or
echo "stats settings" | nc localhost 11211
DarckBlezzer
- 203
1
If you are using php:
$m = new Memcached();
$m->addServer('localhost', 11211);
echo $m->getStats()['localhost:11211']['bytes'];
You Old Fool
- 335