linux安装memcached

          1.准备好安装包memcached-1.4.0.tar.gz   libevent-2.0.21-stable.tar.gz

        2.首先要安装好libevent  库

         解压tar -xvf  libevent-2.0.21-stable.tar.gz  然后执行

        ./configure –prefix=/usr

        make && make install

     安装好后,发现在/usr/lib/下会有一个libevent-2.0.so.5库,此库需要建立一个软件链接,不然在启动memache时会报

     找不到libevent-2.0.so.5文件,其软连接如下:

   
      ln -s /usr/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5

     后解压 tar -xvf  memcached-1.4.0.tar.gz

      ./configure –prefix=/usr/local/memcahced   (可以不指定libevent库)

      make && make install

    安装好后进入/usr/local/memcached/bin下面

   执行memcache  -help正常显示则正常

memcached 1.4.0
-p <num>      TCP port number to listen on (default: 11211)
-U <num>      UDP port number to listen on (default: 11211, 0 is off)
-s <file>     UNIX socket path to listen on (disables network support)
-a <mask>     access mask for UNIX socket, in octal (default: 0700)
-l <ip_addr>  interface to listen on (default: INADDR_ANY, all addresses)
-d            run as a daemon
-r            maximize core file limit
-u <username> assume identity of <username> (only when run as root)
-m <num>      max memory to use for items in megabytes (default: 64 MB)
-M            return error on memory exhausted (rather than removing items)
-c <num>      max simultaneous connections (default: 1024)
-k            lock down all paged memory.  Note that there is a
              limit on how much memory you may lock.  Trying to
              allocate more than that would fail, so be sure you
              set the limit correctly for the user you started
              the daemon with (not for -u <username> user;
              under sh this is done with 'ulimit -S -l NUM_KB').
-v            verbose (print errors/warnings while in event loop)
-vv           very verbose (also print client commands/reponses)
-vvv          extremely verbose (also print internal state transitions)
-h            print this help and exit
-i            print memcached and libevent license
-P <file>     save PID in <file>, only used with -d option
-f <factor>   chunk size growth factor (default: 1.25)
-n <bytes>    minimum space allocated for key+value+flags (default: 48)
-D <char>     Use <char> as the delimiter between key prefixes and IDs.
              This is used for per-prefix stats reporting. The default is
              ":" (colon). If this option is specified, stats collection
              is turned on automatically; if not, then it may be turned on
              by sending the "stats detail on" command to the server.
-t <num>      number of threads to use (default: 4)
-R            Maximum number of requests per event, limits the number of
              requests process for a given connection to prevent 
              starvation (default: 20)
-C            Disable use of CAS
-b            Set the backlog queue limit (default: 1024)
-B            Binding protocol - one of ascii, binary, or auto (default)

可以执行如下命令进行启动

./memcached -d -m 1024 -l 10.110.9.169 -p 11212 -u root

注意的ip必须 是服务器的ip,不然执行此命令后会出现其memcache并没有进程存在。

执行ifconfig -a命令

eth0      Link encap:Ethernet  HWaddr 00:50:56:B7:37:3B  
          inet addr:10.110.9.169  Bcast:10.110.9.175  Mask:255.255.255.240
          inet6 addr: fe80::250:56ff:feb7:373b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:265154 errors:0 dropped:0 overruns:0 frame:0
          TX packets:263697 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:192458677 (183.5 MiB)  TX bytes:25888185 (24.6 MiB)
          Base address:0x2000 Memory:d1020000-d1040000 


lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2575 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2575 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3868380 (3.6 MiB)  TX bytes:3868380 (3.6 MiB)


sit0      Link encap:IPv6-in-IPv4  
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

    其写成上面地址后正常。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值