• 1.Linux下libevent和memcached安装


    

    1 下载libevent-2.0.22-stable.tar.gz,下载地址是:http://libevent.org/

    2 下载memcached,下载地址是:http://memcached.org/downloads

    3 以下通过源代码安装libeventmemcache。将上面两个gz包上传到Linux,上传后的位置:

    4 Linux上分别解压libeventmemcache

    因为memcached依赖libevent,这里先安装libevent,再安装memcached

    tar zxvf libevent-2.0.22-stable.tar.gz

    cd libevent-2.0.22-stable

    ./configure --prefix=/usr

    然后make && make install(此处截图略)

     

    測试libevent是否成功安装:

    ls -al /usr/lib | grep libevent

    假设出现上面的状态,说明都已经安装上了。

    5 接下来安装memcached

    解压

    tar -zxvf memcached-1.4.24.tar.gz

    进入解压后的memcached文件夹。源代码安装:

    ./configure--with-libevent=/usr

    然后make && make install

     

    6.启动memcached

    打开一个终端,输入以下命令(注意以下两个p,一个是小P,一个是大P):

    /usr/local/bin/memcached -d -m 256 -u root-l 192.168.6.25 -p 11211 -c 1024 -P /tmp/memcached.pid

    启动參数说明:

    -d 选项是启动一个守护进程。

    -u root 表示启动memcached的用户为root

    -m 是分配给Memcache使用的内存数量。单位是MB。默认64MB

    -M return error on memory exhausted (ratherthan removing items)

    -u 是执行Memcache的用户,假设当前为root的话。须要使用此參数指定用户。

    -l 是监听的serverIP地址,这里指定了server的IP地址192.168.6.25

    -p 是设置MemcacheTCP监听的port,最好是1024以上的port。

    -c 选项是最大执行的并发连接数,默认是1024

    -P 是设置保存Memcachepid文件。

     

    另外还有个更具体的參数说明:

    也能够启动多个守护进程。可是port不能反复

    查看memcached启动命令

    ps aux|grep memcached

    或者

    ps –ef | grep 11211

     

    8.停止Memcache进程:
    kill `cat /tmp/memcached.pid`

    9 測试Memcached:

    输入命令:telnet 192.168.6.25 11211

     

  • 相关阅读:
    mysql 性能优化方案
    MYSQL 优化常用方法
    MongoDB集群架构及搭建
    memcache分布式 [一致性hash算法] 的php实现
    memcache 的内存管理介绍和 php实现memcache一致性哈希分布式算法
    【转】linux 查看进程启动路径
    centos7 编译安装nginx+tcp+grpc转发
    mongodb笔记
    【转】mysql 解事务锁
    【转】centos7 搭建etcd集群
  • 原文地址:https://www.cnblogs.com/wgwyanfs/p/7096039.html
Copyright © 2020-2023  润新知