Memcached源码安装配置
![Memcached源码安装配置 memcached - a distributed memory object caching system](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
sed -i "/^USER=/c USER=memcached" /etc/init.d/memcached
sed -i "/^CACHESIZE=/c CACHESIZE=2048" /etc/init.d/memcached
root@jlive:~#telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.
stats
STAT pid 16350
STAT uptime 735
STAT time 1463576183
STAT version 1.4.25
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 0.019445
STAT rusage_system 0.026345
STAT curr_connections 2
STAT total_connections 5
STAT connection_structures 3
STAT reserved_fds 20
STAT cmd_get 2
STAT cmd_set 0
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 0
STAT get_misses 2
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 101
STAT bytes_written 2389
STAT limit_maxbytes 2147483648
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT time_in_listen_disabled_us 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 0
STAT crawler_reclaimed 0
STAT crawler_items_checked 0
STAT lrutail_reflocked 0
END
quit
Connection closed by foreign host.
自带小工具--memcached-tool
[root@master ~]# /opt/memcached/scripts/memcached-tool 192.168.8.10:11211 settings
#192.168.8.10:11211
Field
expirezero_does_not_evict
自带小工具--mc_slab_mover
/opt/memcached/scripts/mc_slab_mover --host='127.0.0.1:11211'
GUI管理工具
php扩展(memcached & memcache)
http://libmemcached.org/libMemcached.html
http://php.net/manual/zh/book.memcached.php
http://pecl.php.net/package/memcached
注意:php的memcached扩展,功能和特性比memcache扩展都要优秀
1.安装libmemcached
wget
tar -xvf libmemcached-1.0.18.tar.gz -C /usr/local/src/
cd /usr/local/src/libmemcached-1.0.18
./configure && make && make install
2.安装php memcached扩展库
wget
tar -xvf memcached-2.2.0.tgz -C /usr/local/src/
cd /usr/local/src/memcached-2.2.0
phpize
./configure --enable-memcached-json
&&
3.php.ini加载memcached.so
echo extension=memcached.so >>/usr/local/php/etc/php.ini
service php-fpm restart
memcached
memcached support | enabled |
---|---|
Version |
2.2.0 |
libmemcached version |
1.0.18 |
SASL support |
yes |
Session support |
yes |
igbinary support |
no |
json support |
yes |
msgpack support |
no |
但有些php GUI是基于php memcache的扩展库,所以这里也一并安装
http://php.net/manual/zh/memcache.installation.php
http://pecl.php.net/package/memcache
wget
tar -xvf
memcache-2.2.7.tgz
cd /usr/local/src/memcache-2.2.7
phpize
./configure
&&
echo extension=memcache.so >>/usr/local/php/etc/php.ini
service php-fpm restart
root@jlive:memcache-2.2.7#ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
ldap.so*
memcache
memcache support | enabled |
---|---|
Active persistent connections |
0 |
Version |
2.2.7 |
Revision |
$Revision: 327750 $ |
php memcache GUI工具--MemAdmin
wget
tar -xvf memadmin-1.0.12.tar.gz -C /usr/local/nginx/html
默认用户名和密码为admin/admin,
memadmin/config.php可以修改