zoukankan      html  css  js  c++  java
  • memcached部署memcached环境及PHP扩展

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://lxsym.blog.51cto.com/1364623/876209

    Memcached用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提供动态、数据库驱动网站的速度。部署步骤见下:
    1.先安装libevent:
    tar zxvf libevent-2.0.15-stable.tar.gz 
    cd libevent-2.0.15-stable
    ./configure --prefix=/usr/local/webserver/libevent-2.0.15
    make && make install

    2.安装memcached,同时需要在安装中指定libevent的安装位置
    zxvf memcached-1.4.13.tar.gz 
    cd memcached-1.4.13
    ./configure --prefix=/usr/local/webserver/memcached-1.4.13 --with-libevent=/usr/local/webserver/libevent-2.0.15/
    make && make install

    启动Memcache的服务器端: 
    /usr/local/webserver/memcached-1.4.13/bin/memcached -d -m 64 -u root -l 192.168.0.200 -p 11211 -c 256 –P /tmp/memcached.pid

    3.附:php的memcached扩展的安装:php有两个memcached扩展,一个是memcache,一个是memcached
    1)安装libmemcached库
    tar zxvf libmemcached-0.50.tar.tar 
    cd libmemcached-0.50
    ./configure --prefix=/usr/local/webserver/libmemcached --with-memcached
    make
    make install
      
    2)安装php memcached扩展
    zxvf memcached-1.0.2.tgz 
    cd memcached-1.0.2
    /usr/local/webserver/php/bin/phpize 
    ./configure --enable-memcached --with-php-config=/usr/local/webserver/php/bin/php-config --with-libmemcached-dir=/usr/local/webserver/libmemcached
    make
    make install

    3)在php.ini里添加
     vi /usr/local/webserver/php/etc/php.ini 
    extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"
    extension = "memcache.so"
    extension = "memcached.so"
    再把服务重启一下

    vi /etc/ld.so.conf
    /usr/local/webserver/libevent-2.0.15/bin
    /usr/local/webserver/libmemcached/bin

  • 相关阅读:
    SpringBoot配置Druid数据源
    springboot自定义异常处理
    SpringBoot配置详解
    设计模式 | 模板方法模式(template method)
    设计模式 | 原型模式(prototype)
    设计模式 | 工厂方法模式(factory method)
    设计模式 | 代理模式(proxy)
    设计模式 | 装饰模式(decorator)
    设计模式 | 策略模式(strategy)
    设计模式 | 简单工厂模式(static factory method)
  • 原文地址:https://www.cnblogs.com/wanghuaijun/p/5494799.html
Copyright © 2011-2022 走看看