中小型规模网站集群架构:memcached
: Ago linux运维群:93324526
前言:
你的用户登录信息是怎么保存的,你了解session的工作原理吗?
搭上memcached玩玩吧。部署服务端
我放在backup服务器上
tar xf libevent-1.4.13-stable.tar.gzcd libevent-1.4.13-stable./configure --prefix=/usr/local/libeventmake && make installcd ..tar xf memcached-1.4.36.tar.gzcd memcached-1.4.36./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent/make && make install
vi /server/scripts/memcache_rpm.sh
#!/bin/shuseradd -M -s /sbin/nologin/ -u 888 www/usr/local/memcached/bin/memcached -p 11211 -u www -m 16m -c 10240 -decho '/usr/local/memcached/bin/memcached -p 11211 -u www -m 16m -c 10240 -d' >> /etc/rc.local
rpm制作
fpm -s dir -t rpm -n memcached -v 1.4.36 --post-install=/server/scripts/memcache_rpm.sh -f /usr/local/memcached /usr/local/libevent
memcached启动
echo "/usr/local/lib">> /etc/ld.so.confldconfig参数-p 端口 -d 用守护进程启动 -m 指定内存大小 -c 并发大小 -l 监听地址 -u指定用户 -P是pid/usr/local/memcached/bin/memcached -p 11211 -u www -m 16m -c 10240 -d
客户端安装
tar xf memcache-2.2.7.tgzcd memcache-2.2.7/application/php/bin/phpize ./configure --enable-memcache --with-php-config=/application/php/bin/php-config --with-zlib-dirmakemake install
vi /application/php/lib/php.ini
extension_dir = "/application/php/lib/php/extensions/no-debug-non-zts-20121212/"extension = memcache.sosession.save_handler = memcachesession.save_path = "tcp://172.16.1.41:11211"
剧本走一波
稍后跟上