daemon memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS 改为 daemon /usr/local/memcached/bin/memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS
(可选)删除脚本中以下内容
PORT=11211
USER=nobody
MAXCONN=1024
CACHESIZE=64
OPTIONS=""
创建参数脚本并添加参数
创建touch /etc/sysconfig/memcached
更改用户与用户组 chown memcached.memcached /etc/sysconfig/memcached
添加内容
PORT=11211
USER=memcached
MAXCONN=1024
CACHESIZE=64
OPTIONS="-l 0.0.0.0,::1"
将memcached添加进service管理,并开机启动
chkconfig --add memcached
chkconfig memcached on
4. 测试
启动: /etc/init.d/memcached start 或者 service memcached start
启动成功
5. 连接(通过telnet测试连接)
telnet 127.0.0.1 11211
Linux CentOS 7 下通过Memcached实现Session共享
Memcached的安装配置及将PHP的session保存在Memcached中
Linux CentOS 7 下通过Memcached实现Session共享
CentOS 6.6下Memcached 源码安装配置