• RedHat Linux AS 5下memcached的安装


    一、软件准备

    memcached-1.4.13.tar.gz,下载地址:http://memcached.org/

    libevent-2.0.19-stable.tar.gz,下载地址:http://libevent.org/

    二、具体安装

    1、安装libevent

    [root@localhost tools]# tar zxvf libevent-2.0.19-stable.tar.gz

    [root@localhost tools]# cd libevent-2.0.19-stable

    [root@localhost libevent-2.0.19-stable]# ./configure --prefix=/usr

    [root@localhost libevent-2.0.19-stable]# make

    [root@localhost libevent-2.0.19-stable]# make install

    2、memcached安装

    [root@localhost tools]# tar zxvf memcached-1.4.13.tar.gz

    [root@localhost tools]# cd memcached-1.4.13/

    [root@localhost memcached-1.4.13]# ./configure --prefix=/usr/local

    [root@localhost memcached-1.4.13]# make

    [root@localhost memcached-1.4.13]# make install

    3、测试是否安装成功

    [root@localhost memcached-1.4.13]# ls -la /usr/local/bin/mem*

    -rwxr-xr-x 1 root root 201441 Nov  8 15:10 /usr/local/bin/memcached

    [root@localhost memcached-1.4.13]#

    4、将libevent安装的/usr/local/lib输出到引用库路径

    # vi ~/.bash_profile

    加入如下一行:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

    5、启动memcache的服务器端

    [root@localhost tools]# memcached -d  -m 100 -l 192.168.11.193 -p 11211 -u root  -c 256 -P /tmp/memcached.pid

    [root@localhost tools]# netstat -an|grep 11211

    tcp        0      0 192.168.0.14:11211        0.0.0.0:*                   LISTEN     

    udp        0      0 192.168.0.14:11211        0.0.0.0:*    

    启动选项说明:

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

    -m是分配给memcache使用的内存数量,单位是MB,我这里是100MB,

    -u是运行memcache的用户,也可以使用adduser为memcahed专门创建一个用户

    -l是监听的服务器IP地址,这里指定了服务器的IP地址192.168.11.193

    -p是设置memcache监听的端口,我这里设置了11211,由于是默认端口,因此不指定-p参数也可

    -c选项是最大运行的并发连接数,默认是1024,我这里设置了256,按照你服务器的负载量来设定,

    -P是设置保存Memcache的pid文件,我这里是保存在 /tmp/memcached.pid

    6、结束memcache进程,执行:

    [root@localhost tools]# kill cat /tmp/memcached.pid

    或者取出/tmp/memcached.pid文件里的进程号,然后kill -9 进程号

    也可以启动多个守护进程,不过端口不能重复。

    7、测试

    另外打开一个终端,执行下面的命令

    [root@localhost ~]# telnet 192.168.11.193 11211

    Trying 192.168.11.193...

    Connected to 192.168.11.193 (192.168.11.193).

    Escape character is '^]'.

    stats

    STAT pid 20376

    STAT uptime 236

    STAT time 1289201148

    STAT version 1.4.5

    STAT pointer_size 32

    STAT rusage_user 0.000000

    STAT rusage_system 0.000000

    STAT curr_connections 5

    STAT total_connections 8

    STAT connection_structures 6

    STAT cmd_get 0

    STAT cmd_set 0

    STAT cmd_flush 0

    STAT get_hits 0

    STAT get_misses 0

    STAT delete_misses 0

    STAT delete_hits 0

    STAT incr_misses 0

    STAT incr_hits 0

    STAT decr_misses 0

    STAT decr_hits 0

    STAT cas_misses 0

    STAT cas_hits 0

    STAT cas_badval 0

    STAT auth_cmds 0

    STAT auth_errors 0

    STAT bytes_read 72

    STAT bytes_written 84

    STAT limit_maxbytes 104857600

    STAT accepting_conns 1

    STAT listen_disabled_num 0

    STAT threads 4

    STAT conn_yields 0

    STAT bytes 0

    STAT curr_items 0

    STAT total_items 0

    STAT evictions 0

    STAT reclaimed 0

    END

    恭喜你!安装成功。

  • 相关阅读:
    Path expected for join!错误处理
    JPA 不生成外键
    SpringDataJPA
    MyCat-schema.xml详解
    aliyun阿里云Maven仓库地址——加速你的maven构建
    MyCAT简易入门 (Linux)
    CentOS 7 常用命令大全
    mycat 9066管理端口
    MyCat入门
    Virtualbox的centos7 nat和桥接网络配置
  • 原文地址:https://www.cnblogs.com/tearer/p/2500830.html
Copyright © 2020-2023  润新知