zoukankan      html  css  js  c++  java
  • memcached源代码阅读笔记(5)memcached1.4.10 libevent2.0.16在centos安装

    memcached1.4.10安装
    操作系统:CENTOS5.6
    安装libevent
    mkdir libevent
    cd libevent
    下载libevent2.0.16
    wget --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gz 
    或者
    通过浏览器下载后通过rz拿到服务器
    安装rz,sz工具
    yum -y install lrzsz
    rz
    tar xzvf libevent-2.0.16-stable.tar.gz
    cd libevent-2.0.16-stable
    ./configure --prefix=/usr/local/libevent
    如果出错:configure: error: in `..libevent-2.0.16-stable':
    configure: error: no acceptable C compiler found in $PATH
    说明没有安装 gcc,
    安装gcc
    #yum -y install gcc
    #yum search gcc
    #yum -y install gcc-c++
    # make
    # make install
    # getconf LONG_BIT

    cd memcached/
    cd memcached-1.4.10
    ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
    make
    make install
    /usr/local/memcached/bin/memcached -d -m 64 -u root  -p 11211 -c 256 -P /tmp/memcached.pid
    ps aux | grep memcached
    /usr/local/memcached/bin/memcached –p 11211 –m 64 -u root –vv

    之前介绍的是单线程的方式,因为接下来要研究多线程的处理过程,因此需要配置成多线程的版本。

    如果是memcached比较老的版本,缺省是单线程,因此编译的时候需要做如下配置,加上

    --enable-threads 选项

    ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent --enable-threads 

    但是memcached1.4以后的版本如果再用这个选项就会报警告:

    configure: WARNING: unrecognized options: --enable-threads

    因为新的版本缺省就是多线程

    可以在启动的时候指定t参数,后面指定线程数。通常为cpu核数

    /usr/local/memcached/bin/memcached –p 11211 –m 64 -uroot -t2 -vv

    如果要单线程方式,指定t为1即可。

    /usr/local/memcached/bin/memcached –p 11211 –m 64 -uroot -t1 -vv

  • 相关阅读:
    324. Wiggle Sort II
    341. Flatten Nested List Iterator
    300. Longest Increasing Subsequence
    72. Edit Distance
    63. Unique Paths II
    221.Maximal Square
    House Robbers. 198 & 213
    [C++] 与比较有关的事情
    218.The Skyline Problem
    41. First Missing Positive
  • 原文地址:https://www.cnblogs.com/yanzhenan/p/2281184.html
Copyright © 2011-2022 走看看