-p <num> TCP port number to listen on (default: 11211)
-U <num> UDP port number to listen on (default: 11211, 0 is off)
-l <addr> interface to listen on (default: INADDR_ANY, all addresses)
<addr> may be specified as host:port. If you don't specify
a port number, the value you specified with -p or -U is
used. You may specify multiple addresses separated by comma
or by using -l multiple times
-d run as a daemon
-u <username> assume identity of <username> (only when run as root)
-m <num> max memory to use for items in megabytes (default: 64 MB)
-M return error on memory exhausted (rather than removing items)
-c <num> max simultaneous connections (default: 1024)
-v verbose (print errors/warnings while in event loop)
-P <file> save PID in <file>, only used with -d option
是否正常?Telnet上去看看
telnet xxx.xxx.xxx.xxx 11211
telnet xxx.xxx.xxx.xxx 11211
然后输入
stats
stats
接着就能看到:
引用
STAT pid 3021
STAT uptime 3621
STAT time 1331261509
STAT version 1.4.13
STAT libevent 2.0.17-stable
STAT pointer_size 64
STAT rusage_user 0.000000
STAT rusage_system 0.000999
STAT curr_connections 6
STAT total_connections 7
STAT connection_structures 7
STAT reserved_fds 20
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 72
STAT bytes_written 1038
STAT limit_maxbytes 52428800
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
STAT reclaimed 0
END
上面状况说明Memcached服务正常。
还可以试试get、set、delete、replace
引用
set foo 0 0 3 (保存命令)
bar (数据)
STORED (结果)
get foo (取得命令)
VALUE foo 0 3 (数据)
bar (数据)
memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
其实这个文件就在/usr/lib下。错就错在Linux是64bit系统,如果没有指定libevent路径,memcached就会去/usr/lib64下去找。
找到这个文件
whereis libevent-2.0.so.5
whereis libevent-2.0.so.5
引用
libevent-2.0.so: /usr/local/lib/libevent-2.0.so.5
ldd /usr/bin/memcached
ldd /usr/bin/memcached
提示找不到libevent-2.0.so.5
引用
libevent-2.0.so.5 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000032f2600000)
libc.so.6 => /lib64/libc.so.6 (0x00000032f1a00000)
/lib64/ld-linux-x86-64.so.2 (0x00000032f1600000)
定位
$MEMCACHE_SERVERS[] = 'mymemcache-server1:11211'; // add more as an array
$MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as an array
define('ADMIN_USERNAME','memcache'); // Admin Username
define('ADMIN_PASSWORD','password'); // Admin Password
define('DATE_FORMAT','Y/m/d H:i:s');
define('GRAPH_SIZE',200);
define('MAX_ITEM_DUMP',50);
$MEMCACHE_SERVERS[] = 'mymemcache-server1:11211'; // add more as an array
$MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as an array