Memcached on MAC

本文介绍如何在Mac上安装Memcached,并解决安装过程中遇到的问题,如libevent依赖缺失等。此外,还提供了将HAProxy配置为Memcached集群前端的方法,包括TCP模式配置和节点设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Memcached on MAC

Many years had gone since I used memcached. Even the official website is changed to this>
http://memcached.org/downloads

1. Check and Update the Memcached
Just download the latest files.
>wget http://memcached.org/files/memcached-1.4.20.tar.gz
>cd memcached-1.4.20
>./configure --prefix=/Users/carl/tool/memcached-1.4.20

Error Message:
checking for libevent directory... configure: error: libevent is required.  You can get it from http://www.monkey.org/~provos/libevent/

Solution:
>wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
>./configure
>make
>sudo make install

It solve the problem.

>./configure --prefix=/Users/carl/tool/memcached-1.4.20
>make
>make install

>sudo ln -s /Users/carl/tool/memcached-1.4.20 /opt/memcached-1.4.20
>sudo ln -s /opt/memcached-1.4.20 /opt/memcached

Start the Server
>memcached -d -m 50 -p 11211 -u carl -l 0.0.0.0
>memcached -d -m 50 -p 11212 -u carl -l 0.0.0.0
>memcached -d -m 50 -p 11213 -u carl -l 0.0.0.0

2. Configure and Put Haproxy in front of memcached

I add the configuration some as follow>
listen memcached_local_cluster 127.0.0.1:11210      

#配置TCP模式      

mode      tcp      

#balance url_param userid      

#balance url_param session_id check_post 64      

#balance hdr(User-Agent)      

#balance hdr(host)      

#balance hdr(Host) use_domain_only      

#balance rdp-cookie      

#balance leastconn      

#balance source 

//ip      

#简单的轮询      

balance roundrobin      

#memcached集群节点配置      

server memcached1  127.0.0.1:11211 check inter 5000 rise 2 fall 2      

server memcached2  127.0.0.1:11212 check inter 5000 rise 2 fall 2 backup


References:
http://sillycat.iteye.com/blog/562676  installation
http://sillycat.iteye.com/blog/563940  tools
http://sillycat.iteye.com/blog/563615 strategy

http://memcached.org/

haproxy
https://github.com/shuge/man/blob/master/sa/ha/haproxy-sa-memcached-frontend-quick-guide.md
http://serverfault.com/questions/519070/configuring-haproxy-with-memcache-with-failover
https://github.com/shuge/man/blob/master/sa/ha/haproxy-sa-memcached-frontend-quick-guide.md

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值