memcached使用与运维.pptVIP

  • 33
  • 0
  • 约1.19万字
  • 约 44页
  • 2017-06-15 发布于北京
  • 举报
* * * * * * * * * * * * * * * * * * * * * * * * magent 命令行参数 -h this message -u uid -g gid -p port, default is 11211. (0 to disable tcp support) -s ip:port, set memcached server ip and port -b ip:port, set backup memcached server ip and port -l ip, local bind ip address, default is -n number, set max connections, default is 4096 -D do not go to background -k use ketama key allocation algorithm -f file, unix socket path to listen on. default is off -i number, max keep alive connections for one memcached server, default is 20 -v verbose magent 工作流程 单key请求,先从服务集群中获取数据,失败从备份集群中获取; 对多key的请求,会进行遍历; delete incr decr add set replace prepend append cas这些命令会同时发送给服务集群和备份集群; 与memcached保持长链接; 支持ketama算法(一致性hash的一个实现),添加/删除memcached服务器是只影响到1/n的key。 memcachedb 介绍 memcachedb是 一个由新浪网的开发人员开放出来的开源项目,给memcached分布式缓存服务器添加了Berkeley DB的持久化存储机制和异步主辅复制机制,让memcached具备了事务恢复能力、持久化能力和分布式复制能力,非常适合于需要超高性能读写速度,但是 不需要严格事务约束,能够被持久化保存的应用场景。 特性 key/value对象的高性能读写; 高可靠的持久化存储; 高可用的数据存储和复制; 与memcached协议兼容性。 memcachedb 支持的memcached协议 get(also mutiple get) set, add, replace append/prepend incr, decr delete stats 私有协议 rget db_checkpoint db_archive … memcache 简介 memcache是一个关于memcached的php模块。memcache模块提供了于memcached方便的面向过程及面向对象的接口,memcache模块同时提供了一个session 处理器 (memcache)。 memcache 部署安装 yum -y install libevent libevent-devel cd /root/install wget /store/memcache-3.0.6.tar.gz find ./ -type f -name *.tar.gz -exec tar -zxf {} \; cd /root/install/memcache-3.0.6/ /opt/soft/php/bin/phpize ./configure --with-php-config=/opt/soft/php/bin/php-config make clean make make install echo [memcache]\nextension = memcache.so /opt/soft/php/lib/php.ini memcache 使用示例 ?php $memcache = new Memcache; $memcache-connect(localhost, 11211) or die (Could not connect); $version = $memcache-getVersion(); echo Servers version: .$version.br/\n; $tmp_object = new stdClass; $tmp_object-str_attr = test; $tmp_object-int_attr = 123; $memcache-set(key, $tmp_object, false, 10) o

文档评论(0)

1亿VIP精品文档

相关文档