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
相关推荐
1. The data of each Cloud Memcached's instance is stored on multiple sets of mac
Installing Django on UNIX/Linux and Mac OS X 16 Installing a database system 17 Creating your first project 18 Creating an empty project 18 Setting up the database 20 Launching the development ...
8. **Memcached**:一个高性能的分布式内存对象缓存系统,有助于提高应用性能。 9. **iTerm2**:一款增强版的终端应用,提供了更丰富的功能和自定义选项。 10. **SIP(System Integrity Protection)**:苹果引入...
此外,该库具有跨平台的特性,能在Windows、Linux、BSD和Mac OS等多种操作系统上运行,并且支持多种I/O多路复用技术,如epoll、poll、dev/poll、select和kqueue,以适应不同系统的最佳性能。 Libevent的核心功能...
在标题和描述中提到的情况,"一个用户只能在一台机器访问服务器",这涉及到的是单点登录(Single Sign-On, SSO)和会话管理策略。下面我们将深入探讨这个话题。 首先,单点登录是一种网络认证机制,它允许用户在一...
21. 缓存技术:如APC、Memcached、Redis等,存储预处理过的数据,减少数据库查询。 22. 代码优化:避免冗余代码,合理使用数据结构和算法,减少内存占用。 23. PHP配置优化:调整`php.ini`配置,如开启OPcache,...