Onex ecstore安装memcached(v1.4.33)

/ 0评 / 1

Onex ecstore安装memcached(v1.4.33)教程

by-xiao酱沫

@Author:  875358601@qq.com @DateTime:  2016-12-07 22:54:20

相关缓存同步:

点我我是redis缓存同步链接

点我我是mongodb缓存同步链接

1.安装memcached


wget http://memcached.org/files/memcached-1.4.33.tar.gz
mkdir /usr/local/memcache
tar -zxvf memcached-1.4.33.tar.gz
cd memcached-1.4.33
./configure --prefix=/usr/local/memcache
make && make install

2. 启动memcached

/usr/local/memcache/bin/memcached -d -m 1024 -u root -p 11211 -c 256

3.启动脚本设置

vi /etc/rc.d/init.d/memcached


#!/bin/sh  
#  
# memcached:    MemCached Daemon  
# chkconfig:    - 90 25  
# description:  MemCached Daemon  
# Source function library.  
. /etc/rc.d/init.d/functions  
. /etc/sysconfig/network  
#[ ${NETWORKING} = "no" ] && exit 0  
#[ -r /etc/sysconfig/dund ] || exit 0  
#. /etc/sysconfig/dund  
#[ -z "$DUNDARGS" ] && exit 0  
start()  
{  
        echo -n $"Starting memcached: "  
        daemon $MEMCACHED -u daemon -d -m 1024 -l 127.0.0.1 -p 11211 -c 256 -P /tmp/memcached.pid    
        echo  
}  
stop()  
{  
        echo -n $"Shutting down memcached: "  
        killproc memcached  
        echo  
}  
MEMCACHED="/usr/local/memcache/bin/memcached"  
[ -f $MEMCACHED ] || exit 1  
# See how we were called.  
case "$1" in  
        start)  
                start  
                ;;  
        stop)  
                stop  
                ;;  
        restart)  
                stop  
                sleep 3  
                start  
                ;;  
        *)  
                echo $"Usage: $0 {start|stop|restart}"  
                exit 1  
esac  
exit 0

4.添加Memcached开机启动


cd /etc/rc.d/init.d/  
chmod 777 memcached  
chkconfig --add memcached  
chkconfig --level 235 memcached on  
chkconfig --list | grep memcached

5.Memcached使用


service memcached start  
service memcached stop  
service memcached restart

6.安装php-memcached扩展,动态编译:


wget https://pecl.php.net/get/memcache-3.0.8.tgz
tar -zxvf memcache-3.0.8.tgz
cd memcache-3.0.8
/usr/local/php53/bin/phpize
./configure --with-php-config=/usr/local/php53/bin/php-config
make && make install
echo 'extension=memcache.so' >> /usr/local/php53/php.ini

service php-fpm restart

如上重启php后即开启ecstore-memcache


vim ecstore/config/config.php

去掉注释:


#define('CACHE_STORAGE', 'base_cache_memcache');

添加:


define('CACHE_MEMCACHE_CONFIG', '127.0.0.1:11211');
//需要保证define('WITHOUT_CACHE',false);才能使用memcached

可参考下图:

1

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注