﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-&lt;b style="font-size:28px"&gt;Derek.&lt;font style='color:red'&gt;Guo&lt;/font&gt; BLOG&lt;/b&gt;-随笔分类-Cache</title><link>http://www.blogjava.net/envoydada/category/45572.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 13 Jul 2010 21:05:40 GMT</lastBuildDate><pubDate>Tue, 13 Jul 2010 21:05:40 GMT</pubDate><ttl>60</ttl><item><title>Magent：Memcached集群代理</title><link>http://www.blogjava.net/envoydada/archive/2010/07/13/325947.html</link><dc:creator>Derek.Guo</dc:creator><author>Derek.Guo</author><pubDate>Tue, 13 Jul 2010 05:28:00 GMT</pubDate><guid>http://www.blogjava.net/envoydada/archive/2010/07/13/325947.html</guid><wfw:comment>http://www.blogjava.net/envoydada/comments/325947.html</wfw:comment><comments>http://www.blogjava.net/envoydada/archive/2010/07/13/325947.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/envoydada/comments/commentRss/325947.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/envoydada/services/trackbacks/325947.html</trackback:ping><description><![CDATA[Magent是一款开源的Memcached代理服务器软件，其项目网址为 http://code.google.com/p/memagent/，防止单点现象，缓存代理也可以做备份，通过客户端连接到缓存代理服务器，缓存代理服务 器连接缓存服务器。<span style="font-family: arial, sans-serif; font-size: 13px; ">
<h3 style="font-size: medium; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; border-top-width: 0px; border-top-style: solid; border-top-color: #3366cc; padding-top: 0.5ex; padding-right: 0.5em; padding-bottom: 0.5ex; padding-left: 0px; margin-right: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; background-position: initial initial; background-repeat: initial initial; "><a name="Notes:">Notes:</a><a href="http://code.google.com/p/memagent/#Notes:" class="section_anchor" style="color: #bbbbbb; display: inline; text-decoration: none; margin-left: 0.7em; font-weight: lighter; font-size: 14px; ">&#182;</a></h3>
<ol style="max-width: 65em; padding-left: 40px; ">
    <li>current magent's speed is about 80% of memcached's. finding way to speed it up(not good)</li>
    <li>adding backup server does no harm to magent's performance. (good)</li>
    <li>magent's cpu usage is less than memcached's and has very little memory usage. (good)
    </li>
</ol>
</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">一、安装步骤：<br />
1、编译安装libevent：</p>
<div class="dp-highlighter" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; font-size: 12px; background-color: transparent; width: 694px; overflow-x: auto; overflow-y: auto; margin-left: 9px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; ">
<ol start="1" class="dp-j" style="font-size: 1em; line-height: 1.4em; margin-top: 0px; margin-right: 0px; margin-bottom: 1px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-color: #ffffff; color: #2b91af; ">
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; "><span style="color: black; ">wget&nbsp;http:</span><span class="comment" style="color: #008200; ">//monkey.org/~provos/libevent-1.4.9-stable.tar.gz</span><span style="color: black; ">&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">tar&nbsp;zxvf&nbsp;libevent-<span class="number" style="color: #c00000; ">1.4</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">9</span><span style="color: black; ">-stable.tar.gz&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">cd&nbsp;libevent-<span class="number" style="color: #c00000; ">1.4</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">9</span><span style="color: black; ">-stable/&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">./configure&nbsp;--prefix=/usr&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">make&nbsp;&amp;&amp;&nbsp;make&nbsp;install&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">cd&nbsp;../&nbsp;&nbsp;</span></li>
</ol>
</div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;2、编译安装Memcached：</p>
<div class="dp-highlighter" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; font-size: 12px; background-color: transparent; width: 694px; overflow-x: auto; overflow-y: auto; margin-left: 9px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; ">
<ol start="1" class="dp-j" style="font-size: 1em; line-height: 1.4em; margin-top: 0px; margin-right: 0px; margin-bottom: 1px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-color: #ffffff; color: #2b91af; ">
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; "><span style="color: black; ">wget&nbsp;http:</span><span class="comment" style="color: #008200; ">//danga.com/memcached/dist/memcached-1.2.6.tar.gz</span><span style="color: black; ">&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">tar&nbsp;zxvf&nbsp;memcached-<span class="number" style="color: #c00000; ">1.2</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">6</span><span style="color: black; ">.tar.gz&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">cd&nbsp;memcached-<span class="number" style="color: #c00000; ">1.2</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">6</span><span style="color: black; ">/&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">./configure&nbsp;--with-libevent=/usr&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">make&nbsp;&amp;&amp;&nbsp;make&nbsp;install&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">cd&nbsp;../&nbsp;&nbsp;</span></li>
</ol>
</div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;3、编译安装magent：</p>
<div class="dp-highlighter" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; font-size: 12px; width: 694px; overflow-x: auto; overflow-y: auto; margin-left: 9px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; background-color: transparent; ">
<ol start="1" class="dp-j" style="font-size: 1em; line-height: 1.4em; margin-top: 0px; margin-right: 0px; margin-bottom: 1px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-color: #ffffff; color: #2b91af; ">
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; "><span style="color: black; ">mkdir&nbsp;magent&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">cd&nbsp;magent/&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">wget&nbsp;http:<span class="comment" style="color: #008200; ">//memagent.googlecode.com/files/magent-0.5.tar.gz</span><span style="color: black; ">&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">tar&nbsp;zxvf&nbsp;magent-<span class="number" style="color: #c00000; ">0.5</span><span style="color: black; ">.tar.gz&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">/sbin/ldconfig&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">sed&nbsp;-i&nbsp;<span class="string" style="color: blue; ">"s#LIBS&nbsp;=&nbsp;-levent#LIBS&nbsp;=&nbsp;-levent&nbsp;-lm#g"</span><span style="color: black; ">&nbsp;Makefile&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">make&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">cp&nbsp;magent&nbsp;/usr/bin/magent&nbsp;&nbsp;</span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">cd&nbsp;../&nbsp;&nbsp;</span></li>
</ol>
</div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="font-weight: bold; ">二、使用实例：</strong></p>
<div class="dp-highlighter" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; font-size: 12px; background-color: transparent; width: 694px; overflow-x: auto; overflow-y: auto; margin-left: 9px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; ">
<ol start="1" class="dp-j" style="font-size: 1em; line-height: 1.4em; margin-top: 0px; margin-right: 0px; margin-bottom: 1px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-color: #ffffff; color: #2b91af; ">
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; "><span style="color: black; ">memcached&nbsp;-m&nbsp;</span><span class="number" style="color: #c00000; ">1</span><span style="color: black; ">&nbsp;-u&nbsp;root&nbsp;-d&nbsp;-l&nbsp;</span><span class="number" style="color: #c00000; ">127.0</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">0.1</span><span style="color: black; ">&nbsp;-p&nbsp;</span><span class="number" style="color: #c00000; ">11211</span><span style="color: black; ">&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">memcached&nbsp;-m&nbsp;<span class="number" style="color: #c00000; ">1</span><span style="color: black; ">&nbsp;-u&nbsp;root&nbsp;-d&nbsp;-l&nbsp;</span><span class="number" style="color: #c00000; ">127.0</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">0.1</span><span style="color: black; ">&nbsp;-p&nbsp;</span><span class="number" style="color: #c00000; ">11212</span><span style="color: black; ">&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">memcached&nbsp;-m&nbsp;<span class="number" style="color: #c00000; ">1</span><span style="color: black; ">&nbsp;-u&nbsp;root&nbsp;-d&nbsp;-l&nbsp;</span><span class="number" style="color: #c00000; ">127.0</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">0.1</span><span style="color: black; ">&nbsp;-p&nbsp;</span><span class="number" style="color: #c00000; ">11213</span><span style="color: black; ">&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">magent&nbsp;-u&nbsp;root&nbsp;-n&nbsp;<span class="number" style="color: #c00000; ">51200</span><span style="color: black; ">&nbsp;-l&nbsp;</span><span class="number" style="color: #c00000; ">127.0</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">0.1</span><span style="color: black; ">&nbsp;-p&nbsp;</span><span class="number" style="color: #c00000; ">12000</span><span style="color: black; ">&nbsp;-s&nbsp;</span><span class="number" style="color: #c00000; ">127.0</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">0.1</span><span style="color: black; ">:</span><span class="number" style="color: #c00000; ">11211</span><span style="color: black; ">&nbsp;-s&nbsp;</span><span class="number" style="color: #c00000; ">127.0</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">0.1</span><span style="color: black; ">:</span><span class="number" style="color: #c00000; ">11212</span><span style="color: black; ">&nbsp;&nbsp;&nbsp;</span></span></li>
    <li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span style="color: black; ">-b&nbsp;<span class="number" style="color: #c00000; ">127.0</span><span style="color: black; ">.</span><span class="number" style="color: #c00000; ">0.1</span><span style="color: black; ">:</span><span class="number" style="color: #c00000; ">11213</span><span style="color: black; ">&nbsp;&nbsp;</span></span></li>
</ol>
</div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">1、分别在11211、11212、11213端口启动3个Memcached进程，在12000端口开启magent代理程序；<br />
2、11211、11212端口为主Memcached，11213端口为备份Memcached；<br />
3、连接上12000的magent，set key1和set key2，根据哈希算法，key1被写入11212和11213端口的Memcached，key2被写入11212和11213端口的Memcached；<br />
4、当11211、11212端口的Memcached死掉，连接到12000端口的magent取数据，数据会从11213端口的Memcached取出；<br />
5、当11211、11212端口的Memcached重启复活，连接到12000端口，magent会从11211或11212端口的 Memcached取数据，由于这两台Memcached重启后无数据，因此magent取得的将是空值，尽管11213端口的Memcached还有数 据（此问题尚待改进）。</p>
</span>
<img src ="http://www.blogjava.net/envoydada/aggbug/325947.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/envoydada/" target="_blank">Derek.Guo</a> 2010-07-13 13:28 <a href="http://www.blogjava.net/envoydada/archive/2010/07/13/325947.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Memcached 剖析(转)</title><link>http://www.blogjava.net/envoydada/archive/2008/09/28/231708.html</link><dc:creator>Derek.Guo</dc:creator><author>Derek.Guo</author><pubDate>Sun, 28 Sep 2008 09:12:00 GMT</pubDate><guid>http://www.blogjava.net/envoydada/archive/2008/09/28/231708.html</guid><wfw:comment>http://www.blogjava.net/envoydada/comments/231708.html</wfw:comment><comments>http://www.blogjava.net/envoydada/archive/2008/09/28/231708.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/envoydada/comments/commentRss/231708.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/envoydada/services/trackbacks/231708.html</trackback:ping><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.danga.com/memcached/">memcached</a> 是以<a href="http://www.livejournal.com/">LiveJournal</a> 旗下<a href="http://www.danga.com/">Danga Interactive</a> 公司的<a href="http://www.bradfitz.com/">Brad Fitzpatric</a> 为首开发的一款软件。现在已成为 <a href="http://mixi.jp/">mixi</a>、 <a href="http://www.hatena.ne.jp/">hatena</a>、 <a href="http://www.facebook.com/">Facebook</a>、 <a href="http://www.vox.com/">Vox</a>、LiveJournal等众多服务中提高Web应用扩展性的重要因素。</p>
<p>许多Web应用都将数据保存到RDBMS中，应用服务器从中读取数据并在浏览器中显示。但随着数据量的增大、访问的集中，就会出现RDBMS的负担加重、数据库响应恶化、网站显示延迟等重大影响。</p>
<p>这时就该memcached大显身手了。memcached是高性能的分布式内存缓存服务器。一般的使用目的是，通过缓存数据库查询结果，减少数据库访问次数，以提高动态Web应用的速度、提高可扩展性......<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 完整文章下载&nbsp;&nbsp; <a href="/Files/envoydada/memcached.pdf">/Files/envoydada/memcached.pdf</a><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Server端下载&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://danga.com/memcached">http://danga.com/memcached</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <a href="http://jehiah.cz/projects/memcached-win32/">http://jehiah.cz/projects/memcached-win32/</a><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Client端下载&nbsp;&nbsp; <a href="http://www.whalin.com/memcached/">http://www.whalin.com/memcached/</a></p>
(感谢原作者及翻译者的辛勤工作,向你们致敬!!^_^)
<img src ="http://www.blogjava.net/envoydada/aggbug/231708.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/envoydada/" target="_blank">Derek.Guo</a> 2008-09-28 17:12 <a href="http://www.blogjava.net/envoydada/archive/2008/09/28/231708.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>