﻿<?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-ivaneeo's blog-随笔分类-GNU牛力</title><link>http://www.blogjava.net/ivanwan/category/2555.html</link><description>自由的力量，自由的生活。</description><language>zh-cn</language><lastBuildDate>Fri, 03 Apr 2015 04:26:09 GMT</lastBuildDate><pubDate>Fri, 03 Apr 2015 04:26:09 GMT</pubDate><ttl>60</ttl><item><title>ubuntu 14.04 lastest nginx</title><link>http://www.blogjava.net/ivanwan/archive/2015/04/03/424082.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Thu, 02 Apr 2015 20:47:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/04/03/424082.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/424082.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/04/03/424082.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/424082.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/424082.html</trackback:ping><description><![CDATA[<div>http://www.linuxidc.com/Linux/2014-08/105422.htm</div><img src ="http://www.blogjava.net/ivanwan/aggbug/424082.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-04-03 04:47 <a href="http://www.blogjava.net/ivanwan/archive/2015/04/03/424082.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>haproxy websocket</title><link>http://www.blogjava.net/ivanwan/archive/2015/04/03/424081.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Thu, 02 Apr 2015 20:34:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/04/03/424081.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/424081.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/04/03/424081.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/424081.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/424081.html</trackback:ping><description><![CDATA[<div>http://www.tuicool.com/articles/amQNvuq</div><img src ="http://www.blogjava.net/ivanwan/aggbug/424081.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-04-03 04:34 <a href="http://www.blogjava.net/ivanwan/archive/2015/04/03/424081.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ubuntu pptp vpn</title><link>http://www.blogjava.net/ivanwan/archive/2015/03/28/423912.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Sat, 28 Mar 2015 09:48:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/03/28/423912.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/423912.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/03/28/423912.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/423912.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/423912.html</trackback:ping><description><![CDATA[<div>http://blog.fens.me/vpn-pptp-client-ubuntu/<br /><br /><div>&nbsp;ip route add 192.168.20.0/24 via 192.168.20.1 dev ppp0</div><br /><div>http://blog.163.com/monk...popo/blog/static/208680220111014101233949/</div></div><img src ="http://www.blogjava.net/ivanwan/aggbug/423912.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-03-28 17:48 <a href="http://www.blogjava.net/ivanwan/archive/2015/03/28/423912.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>docker api demo</title><link>http://www.blogjava.net/ivanwan/archive/2015/02/14/422927.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Sat, 14 Feb 2015 06:29:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/02/14/422927.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/422927.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/02/14/422927.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/422927.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/422927.html</trackback:ping><description><![CDATA[<div>http://my.oschina.net/guol/blog/271416</div><img src ="http://www.blogjava.net/ivanwan/aggbug/422927.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-02-14 14:29 <a href="http://www.blogjava.net/ivanwan/archive/2015/02/14/422927.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>redis主从配置</title><link>http://www.blogjava.net/ivanwan/archive/2015/02/07/422802.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Fri, 06 Feb 2015 19:37:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/02/07/422802.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/422802.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/02/07/422802.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/422802.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/422802.html</trackback:ping><description><![CDATA[<div>http://www.tuicool.com/articles/RrmAru</div><img src ="http://www.blogjava.net/ivanwan/aggbug/422802.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-02-07 03:37 <a href="http://www.blogjava.net/ivanwan/archive/2015/02/07/422802.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>nginx制作证书</title><link>http://www.blogjava.net/ivanwan/archive/2015/02/06/422794.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Fri, 06 Feb 2015 06:54:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/02/06/422794.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/422794.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/02/06/422794.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/422794.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/422794.html</trackback:ping><description><![CDATA[<div>http://www.elesos.com/index.php?title=Nginx%E6%90%AD%E5%BB%BAHTTPS%E6%9C%8D%E5%8A%A1%E5%99%A8</div><img src ="http://www.blogjava.net/ivanwan/aggbug/422794.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-02-06 14:54 <a href="http://www.blogjava.net/ivanwan/archive/2015/02/06/422794.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>rabbitmq config</title><link>http://www.blogjava.net/ivanwan/archive/2015/01/16/422262.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Fri, 16 Jan 2015 10:24:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/01/16/422262.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/422262.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/01/16/422262.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/422262.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/422262.html</trackback:ping><description><![CDATA[<p>[{rabbit, [{cluster_partition_handling, autoheal},{loopback_users, []}]}].</p><img src ="http://www.blogjava.net/ivanwan/aggbug/422262.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-01-16 18:24 <a href="http://www.blogjava.net/ivanwan/archive/2015/01/16/422262.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>nginx host</title><link>http://www.blogjava.net/ivanwan/archive/2015/01/06/422094.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 06 Jan 2015 14:24:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2015/01/06/422094.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/422094.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2015/01/06/422094.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/422094.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/422094.html</trackback:ping><description><![CDATA[<pre id="answer-content-1341121341" style="margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: 'Microsoft YaHei'; white-space: pre-wrap; word-wrap: break-word; font-stretch: normal; line-height: 26px; color: #333333; background-color: #ffffff;"><div>http://rhomobi.com/topics/49</div><br />nginx为了实现反向代理的需求而增加了一个ngx_http_proxy_module模块。其中proxy_set_header指令就是该模块需要读取的配置文件。在这里，所有设置的值的含义和http请求同中的含义完全相同，除了Host外还有X-Forward-For。<br />        Host的含义是表明请求的主机名，因为nginx作为反向代理使用，而如果后端真是的服务器设置有类似防盗链或者根据http请求头中的host字段来进行路由或判断功能的话，如果反向代理层的nginx不重写请求头中的host字段，将会导致请求失败【默认反向代理服务器会向后端真实服务器发送请求，并且请求头中的host字段应为proxy_pass指令设置的服务器】。<br />        同理，X_Forward_For字段表示该条http请求是有谁发起的？如果反向代理服务器不重写该请求头的话，那么后端真实服务器在处理时会认为所有的请求都来在反向代理服务器，如果后端有防攻击策略的话，那么机器就被封掉了。因此，在配置用作反向代理的nginx中一般会增加两条配置，修改http的请求头：<br />proxy_set_header Host $http_host;<br />proxy_set_header X-Forward-For $remote_addr;<br /><br />这里的$http_host和$remote_addr都是nginx的导出变量，可以再配置文件中直接使用。如果Host请求头部没有出现在请求头中，则$http_host值为空，但是$host值为主域名。因此，一般而言，会用$host代替$http_host变量，从而避免http请求中丢失Host头部的情况下Host不被重写的失误。</pre><img src ="http://www.blogjava.net/ivanwan/aggbug/422094.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2015-01-06 22:24 <a href="http://www.blogjava.net/ivanwan/archive/2015/01/06/422094.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ssdb monitor</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/30/421971.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 30 Dec 2014 14:49:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/30/421971.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421971.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/30/421971.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421971.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421971.html</trackback:ping><description><![CDATA[<div>http://ssdb.io/docs/ssdb-cli.html</div><img src ="http://www.blogjava.net/ivanwan/aggbug/421971.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-30 22:49 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/30/421971.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>vpn相关内容</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/28/421890.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Sat, 27 Dec 2014 16:30:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/28/421890.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421890.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/28/421890.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421890.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421890.html</trackback:ping><description><![CDATA[<div><h2>对于防火墙的选择:<br />&nbsp;&nbsp;<span style="font-size: 14px;">http://blog.sina.com.cn/s/blog_92dc41ea0101j5l1.html<br /></span><div>&nbsp; http://www.lupaworld.com/article-218506-1.html</div></h2>&nbsp;openvpn:<br />&nbsp; http://grantcurell.com/2014/07/22/setting-up-a-vpn-server-on-ubuntu-14-04/<br /><br />pfsense防火墙:<br />&nbsp; http://www.docin.com/p-88103814.html<br /><br />ssl vpn:openvpn<br /><br />ipsec:sprongswan<br /><br />代理服务器:squid<br /><br />stunnel:tcp加密<br /><br /><br /><strong style="font-family: Simsun; font-size: medium; line-height: normal;">Panabit流控引擎</strong><span style="font-family: Simsun; font-size: medium; line-height: normal;">：<br /></span><div>http://www.panabit.com/html/product/std/2014/0924/86.html<br /><span style="font-family: Simsun; font-size: medium; line-height: normal;">Panabit标准版是目前国内开放度最高、免费、专业的应用层流量管理系统，特别针对P2P应用的识别与控制，截止2009年03月25日，已经支持实际主流应用240种以上，并以两周更新一次特征库的速度持续更新(包括已支持协议和新增协议两方面的更新，Panabit支持协议列表请关注</span><a href="http://www.panabit.com/" target="_blank" style="font-family: Simsun; font-size: medium; line-height: normal;">Panabit网站首页</a><span style="font-family: Simsun; font-size: medium; line-height: normal;">"支持协议")。Panabit在精确识别协议即对应用分类的基础上，根据用户自定义策略，提供灵活方便的流量管理机制：带宽限速、带宽保证、带宽预留，并可基于协议/协议组、IP/IP组进行参数化的策略设置。Panabit采用创新的"节点跟踪"技术与"加密协议深度识别"技术提高识别效率和准确度，如对使用加密协议的eMule、Skype等精确识别。Panabit区别于一些同类设备，在不能精确识别协议的情况下，限制客户端并发连接数非科学的做法，易造成误判或影响正常用户。Panabit是一款真正的应用层流控系统，能做限速控制；如果是疑似识别、不能准确定位具体应用的系统，是不敢做限速控制，起不到实际应用层流控效果。</span></div></div><img src ="http://www.blogjava.net/ivanwan/aggbug/421890.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-28 00:30 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/28/421890.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>zabbix rabbitmq</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/25/421833.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Thu, 25 Dec 2014 14:49:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/25/421833.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421833.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/25/421833.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421833.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421833.html</trackback:ping><description><![CDATA[<div>https://github.com/alfss/zabbix-rabbitmq<br /><div>https://github.com/jasonmcintosh/rabbitmq-zabbix</div></div><img src ="http://www.blogjava.net/ivanwan/aggbug/421833.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-25 22:49 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/25/421833.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>zabbix io discovery</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/25/421832.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Thu, 25 Dec 2014 14:17:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/25/421832.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421832.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/25/421832.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421832.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421832.html</trackback:ping><description><![CDATA[<div>#!/bin/bash</div><div>#written by lenwood</div><div>#mail:ccyhaoran@live.cn</div><div>diskarray=(`cat /proc/diskstats |grep -E "\bsd[abcdefg]\b|\bxvd[abcdefg]\b"|grep -i "\b$1\b"|awk '{print $3}'|sort|uniq &nbsp; 2&gt;/dev/null`)</div><div>length=${#diskarray[@]}</div><div>printf "{\n"</div><div>printf &nbsp;'\t'"\"data\":["</div><div>for ((i=0;i&lt;$length;i++))</div><div>&nbsp;do</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf '\n\t\t{'</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf "\"{#DISK_NAME}\":\"${diskarray[$i]}\"}"</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if [ $i -lt $[$length-1] ];then</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf ','</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fi</div><div>&nbsp;done</div><div>printf &nbsp;"\n\t]\n"</div><div>printf "}\n"</div><img src ="http://www.blogjava.net/ivanwan/aggbug/421832.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-25 22:17 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/25/421832.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql cluster tablespace</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/23/421694.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 23 Dec 2014 13:04:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/23/421694.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421694.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/23/421694.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421694.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421694.html</trackback:ping><description><![CDATA[<div>http://dev.mysql.com/doc/refman/5.1/en/create-tablespace.html<br /><div>http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-disk-data-objects.html</div></div><img src ="http://www.blogjava.net/ivanwan/aggbug/421694.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-23 21:04 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/23/421694.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>create a table with tablespace set.</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/23/421692.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 23 Dec 2014 12:57:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/23/421692.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421692.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/23/421692.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421692.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421692.html</trackback:ping><description><![CDATA[<span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">5.1.37-ndb-7.0.8a-cluster-gpl MySQL Cluster Server (GPL)&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">create a table with tablespace set.&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">* tablespace creation *&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">CREATE TABLESPACE ts_1 ADD DATAFILE '/home/db/mysql-cluster/data/data_1.dat' USE LOGFILE GROUP lg_1 INITIAL_SIZE = 26843545600 ENGINE NDB;&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">ALTER TABLESPACE ts_1 ADD DATAFILE '/home/db/mysql-cluster/data/data_2.dat' INITIAL_SIZE 26843545600 ENGINE NDB;&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">ALTER TABLESPACE ts_1 ADD DATAFILE '/home/db/mysql-cluster/data/data_3.dat' INITIAL_SIZE 26843545600 ENGINE NDB;&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">ALTER TABLESPACE ts_1 ADD DATAFILE '/home/db/mysql-cluster/data/data_4.dat' INITIAL_SIZE 26843545600 ENGINE NDB;&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">* table creation *&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">CREATE TABLE `TABLE` (&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">`A` date NOT NULL,&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">`B` varchar(30) NOT NULL,&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">`C` varchar(50) NOT NULL,&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">`D` varchar(50) NOT NULL,&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">`E` varchar(50) NOT NULL,&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">`F` varchar(255) DEFAULT NULL&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">) TABLESPACE ts_1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=utf8&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">PK, index generated without the table and insert the data(40G),&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">I'm Using logs as the following index numbers are still high. (mgm log)&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">The actual number of memory ndb also giving you an upward trend ... Why?&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">2009-11-17 16:54:58 [MgmtSrvr] INFO -- Node 8: Index usage is 4%(30707 8K pages of total 655392)&nbsp;</span><br style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;" /><span style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; line-height: 23.3999996185303px; background-color: #ffffff;">2009-11-17 16:55:25 [MgmtSrvr] INFO -- Node 8: Data usage is 8%(20603 32K pages of total 229376)</span><img src ="http://www.blogjava.net/ivanwan/aggbug/421692.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-23 20:57 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/23/421692.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NDB语法</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/23/421689.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 23 Dec 2014 12:09:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/23/421689.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421689.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/23/421689.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421689.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421689.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">1，不支持创建临时表(temporary tables);</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">2,创建索引和键的限制：</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">(1),在列上创建索引长度超过3072bytes会成功，但是只能使用索引的前3072bytes。并且会显示警告信息"specified key was too long,max key lenght is 3072 keys"</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;"><strong style="margin: 0px; padding: 0px;">不支持的特征</strong></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">1，在NDB创建create table时，一定要指定tablespace.</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">For NDB tables, beginning with MySQL Cluster NDB 6.2.5 and MySQL Cluster NDB 6.3.2, it is also possible to specify whether the column is stored on disk or in memory by using a STORAGE clause. STORAGE DISK causes the column to be stored on disk, and STORAGE MEMORY causes in-memory storage to be used. The CREATE TABLE statement used must still include a TABLESPACE clause:<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />mysql&gt; CREATE TABLE t1 (<br style="margin: 0px; padding: 0px;" />&nbsp;&nbsp;&nbsp; -&gt;&nbsp;&nbsp;&nbsp;&nbsp; c1 INT STORAGE DISK,<br style="margin: 0px; padding: 0px;" />&nbsp;&nbsp;&nbsp; -&gt;&nbsp;&nbsp;&nbsp;&nbsp; c2 INT STORAGE MEMORY<br style="margin: 0px; padding: 0px;" />&nbsp;&nbsp;&nbsp; -&gt; ) ENGINE NDB;<br style="margin: 0px; padding: 0px;" />ERROR 1005 (HY000): Can't create table 'c.t1' (errno: 140)<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />mysql&gt; CREATE TABLE t1 (<br style="margin: 0px; padding: 0px;" />&nbsp;&nbsp;&nbsp; -&gt;&nbsp;&nbsp;&nbsp;&nbsp; c1 INT STORAGE DISK,<br style="margin: 0px; padding: 0px;" />&nbsp;&nbsp;&nbsp; -&gt;&nbsp;&nbsp;&nbsp;&nbsp; c2 INT STORAGE MEMORY<br style="margin: 0px; padding: 0px;" />&nbsp;&nbsp;&nbsp; -&gt; ) TABLESPACE ts_1 ENGINE NDB;<br style="margin: 0px; padding: 0px;" />Query OK, 0 rows affected (1.06 sec)</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;"><strong style="margin: 0px; padding: 0px;">//NDB参数解释</strong>&nbsp; ---from 《mysql性能调优和架构设计》</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">1) [NDBD DEFAULT]中的配置项：<br style="margin: 0px; padding: 0px;" />NoOfReplicas：定义在Cluster 环境中相同数据的分数，通俗一点来说就是每一份数据存放NoOfReplicas 份。如果希望能够冗余，那么至少设置为2（一般情况来说此参数值设置为2 就够了），最大只能设置为4。另外，NoOfReplicas 值得大小，实际上也就是nodegroup 大小的定义。NoOfReplicas 参数没有系统默认值，所以必须设定，而且只能设置在[NDBD DEFAULT]中，因为此数值在整个Cluster 集群中一个node group 中所有的NDBD 节点都需要一样。另外NoOfReplicas 的数目对整个Cluster 环境中NDB 节点数量有较大的影响，因为NDB 节点总数量是NoOfReplicas * 2 * node_group_num；DataDir：指定本地的pid 文件，trace 文件，日志文件以及错误日志子等存放的路径，无系统默认地址，所以必须设定；</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">DataMemory：设定用于存放数据和主键索引的内存段的大小。这个大小限制了能存放的数据的大小，因为ndb 存储引擎需属于内存数据库引擎，需要将所有的数据（包括索引）都load 到内存中。这个参数并不是一定需要设定的，但是默认值非常小（80M），只也就是说如果使用默认值，将只能存放很小的数据。参数设置需要带上单位，如512M，2G 等。另外，DataMemory 里面还会存放UNDO 相关的信息,所以，事务的大小和事务并发量也决定了DataMemory 的使用量，建议尽量使用小事务；</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;"><br style="margin: 0px; padding: 0px;" />IndexMemory：设定用于存放索引（非主键）数据的内存段大小。和DataMemory类似，这个参数值的大小同样也会限制该节点能存放的数据的大小，因为索引的大小是随着数据量增长而增长的。参数设置也如DataMemory 一样需要单位。IndexMemory 默认大小为18M；实际上，一个NDB 节点能存放的数据量是会受到DataMemory 和IndexMemory 两个参数设置的约束，两者任何一个达到限制数量后，都无法再增加能存储的数据量。如果继续存入数据系统会报错&#8220;table is full&#8221;。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">FileSystemPath：指定redo 日志，undo 日志，数据文件以及meta 数据等的存放位置，默认位置为DataDir 的设置，并且在ndbd 初始化的时候，参数所设定的文件夹必须存在。在第一次启动的时候，ndbd 进程会在所设定的文件夹下建立一个子文件夹叫ndb_id_fs，这里的id 为节点的ID 值，如节点id 为3 则文件夹名称为ndb_3_fs。当然，这个参数也不一定非得设置在[NDBD DEFAULT]参数组里面让所有节点的设置都一样（不过建议这样设置），还可以设置在[NDBD]参数组下为每一个节点单独设置自己的FileSystemPath值；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />BackupDataDir：设置备份目录路径，默认为FileSystemPath/BACKUP。接下来的几个参数也是非常重要的，主要都是与并行事务数和其他一些并行限制有关的参数设置。<br style="margin: 0px; padding: 0px;" />MaxNoOfConcurrentTransactions：设置在一个节点上面的最大并行事务数目，默认为4096，一般情况下来说是足够了的。这个参数值所有节点必须设置一样，所以一般都是设置在[NDBD DEFAULT]参数组下面；</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;"><br style="margin: 0px; padding: 0px;" />MaxNoOfConcurrentOperations：设置同时能够被更新（或者锁定）的记录数量。一般来说可以设置为在整个集群中相同时间内可能被更新（或者锁定）的总记录数，除以NDB节点数，所得到的值。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">MaxNoOfLocalOperations：此参数默认是MaxNoOfConcurrentOperations * 1.1的大小，也就是说，每个节点一般可以处理超过平均值的10%的操作记录数量。但是一般来说，MySQL 建议单独设置此参数而不要使用默认值，并且将此参数设置得更较大一些；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />以下的三个参数主要是在一个事务中执行一条query 的时候临时用到存储（或者内存）的情况下所使用到的，所使用的存储信息会在事务结束（commit 或者rollback）的时候释放资源；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />MaxNoOfConcurrentIndexOperations：这个参数和MaxNoOfConcurrentOperations参数比较类似，只不过所针对的是Index 的record 而已。其默认值为8192，对伊一般的系统来说都已经足够了，只有在事务并发非常非常大的系统上才有需要增加这个参数的设置。当然，此参数越大，系统运行时候为此而消耗的内存也会越大；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />MaxNoOfFiredTriggers：触发唯一索引（hash index）操作的最大的操作数，这个操作数是影响索引的操作条目数，而不是操作的次数。系统默认值为4000，一般系统来说够用了。当然，如果系统并发事务非常高，而且涉及到索引的操作也非常多，自然也就需要提高这个参数值的设置了；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />TransactionBufferMemory：这个buffer 值得设置主要是指定用于跟踪索引操作而使用的。主要是用来存储索引操作中涉及到的索引key 值和column 的实际信息。这这个参数的值一般来说也很少需要调整，因为实际系统中需要的这部分buffer 量非常小，虽然默认值只是1M，但是对于一般应用也已经足够了；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />下面要介绍到的参数主要是在系统处理中做table scan 或者range scan 的时候使用的一些buffer 的相关设置，设置的恰当可以既节省内存又达到足够的性能要求。<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />MaxNoOfConcurrentScans：这个参数主要控制在Cluster 环境中并发的table scan和range scan 的总数量平均分配到每一个节点后的平均值。一般来说，每一个scan 都是通过并行的扫描所有的partition 来完成的，每一个partition 的扫描都会在该partition所在的节点上面使用一个scan record。所以，这个参数值得大小应该是&#8220;scan record&#8221;数目* 节点数目。参数默认大小为256，最大只能设置为500；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />MaxNoOfLocalScans：和上面的这个参数相对应，只不过设置的是在本节点上面的并发table scan 和range scan 数量。如果在系统中有大量的并发而且一般都不使用并行的话，需要注意此参数的设置。默认为MaxNoOfConcurrentScans * node 数目；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />BatchSizePerLocalScan：该参用于计算在Localscan（并发）过程中被锁住的记录数，文档上说明默认为64；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />LongMessageBuffer：这个参数定义的是消息传递时候的buffer 大小，而这里的消息传递主要是内部信息传递以及节点与节点之间的信息传递。这个参数一般很少需要调整，默认大小为1MB 大小；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />下面介绍一下与LOG 相关的参数配置说明，包括LOG level。这里的LOG level 有多种，从0 到15，也就是共16 种。如果设定为0，则表示不记录任何LOG。如果设置为最高level，也就是15，则表示所有的信息都会通过标准输出来记录LOG.由于这里的所有信息实际上都会传递到管理节点的cluster LOG 中，所以，一般来说，除了启动时候的LOG级别需要设置为1 之外，其他所有的LOG level 都只需要设置为0 就可以了。<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />NoOfFragmentLogFiles：这个参数实际上和Oracle 的redo LOG 的group 一样的。其实就是ndb 的redo LOG group 数目，这些redo LOG 用于存放ndb 引擎所做的所有需要变更数据的事情，以及各种checkpoint 信息等。默认值为8；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />MaxNoOfSavedMessages：这个参数设定了可以保留的trace 文件（在节点crash的时候参数）的最大个数，文档上面说此参数默认值为25。<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />LogLevelStartup：设定启动ndb 节点时候需要记录的信息的级别（不同级别所记录的信息的详细程度不一样），默认级别为1；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />LogLevelShutdown：设定关闭ndb 节点时候记录日志的信息的级别，默认为0；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />LogLevelStatistic：这个参数是针对于统计相关的日志的，就像更新数量，插入数量，buffer 使用情况，主键数量等等统计信息。默认日志级别为0；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />LogLevelCheckpoint：checkpoint 日志记录级别（包括local 和global 的），默认为0；</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;"><br style="margin: 0px; padding: 0px;" />LogLevelNodeRestart：ndb 节点重启过程日志级别，默认为0；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />LogLevelConnection：各节点之间连接相关日志记录的级别，默认0；</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;"><br style="margin: 0px; padding: 0px;" />LogLevelError：在整个Cluster 中错误或者警告信息的日志记录级别，默认0；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />LogLevelInfo：普通信息的日志记录级别，默认为0。这里再介绍几个用来作为LOG 记录时候需要用到的Buffer 相关参数，这些参数对于性能都有一定的影响。当然，如果节点运行在无盘模式下的话，则影响不大。<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />UndoIndexBuffer：undo index buffer 主要是用于存储主键hash 索引在变更之后产生的undo 信息的缓冲区。默认值为2M 大小，最小可以设置为1M，对于大多数应用来说，2M 的默认值是够的.当然，在更新非常频繁的应用里面，适当的调大此参数值对性能还是有一定帮助的。如果此参数太小，会报出677 错误：Index UNDO buffers overloaded；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />UndoDataBuffer：和undo index buffer 类似，undo data buffer 主要是在数据发生变更的时候所需要的undo 信息的缓冲区。默认大小为16M，最小同样为1M。当这个参数值太小的时候，系统会报出如下的错误：Data UNDO buffers overloaded，错误号为891；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />RedoBuffer：Redo buffer 是用redo LOG 信息的缓冲区，默认大小为8M，最小为1M。如果此buffer 太小，会报1221 错误：REDO LOG buffers overloaded.<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />此外，NDB 节点还有一些和metadata 以及内部控制相关的参数，但大部分参数都基本上不需要任何调整，所以就不做进一步介绍。如果有兴趣希望详细了解，可以根据MySQL官方的相关参考手册，手册上面都有较为详细的介绍。<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />3、SQL 节点相关配置说明<br style="margin: 0px; padding: 0px;" />1) 和其他节点一样，先介绍一些适用于所有节点的[MySQLD DEFAULT]参数ArbitrationRank：这个参数在介绍管理节点的参数时候已经介绍过了，用于设定节点级别（主要是在多个节点在处理相关操作时候出现分歧时候设定裁定者）的。一般来说，所有的SQL 节点都应该设定为2；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />ArbitrationDelay：默认为0，裁定者在开始裁定之前需要被delay 多久，单位为毫秒。一般不需要更改默认值。<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />BatchByteSize：在做全表扫描或者索引范围扫描的时候，每一次fatch 的数据量，默认为32KB；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />BatchSize：类似BatchByteSize 参数，只不过BatchSize 所设定的是每一次fetch的record 数量，而不是物理总量，默认为64，最大为992（暂时还不知道这个值是基于什么理论而设定的）。在实际运行query 的过程中，fetch 的量受到BatchByteSize 和BatchSize两个参数的共同制约，二者取最小值；<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />MaxScanBatchSize：在Cluster 环境中，进行并行处理的情况下，所有节点的BatchSize 总和的最大值。默认值为256KB，最大值为16MB。<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />2) 每个节点独有的[MySQLD]参数组，仅有id 和hostname 参数需要配置，在之前各类节点均有介绍了，这里就不再累述。<br /><br /><br />转自<span style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px;">http://www.cnblogs.com/alang85/archive/2011/11/18/2253900.html</span></p><img src ="http://www.blogjava.net/ivanwan/aggbug/421689.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-23 20:09 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/23/421689.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql cluster集群时插入大量数据出现 table is full的解决方法</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/23/421688.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 23 Dec 2014 12:07:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/23/421688.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421688.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/23/421688.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421688.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421688.html</trackback:ping><description><![CDATA[<div><ul style="margin: 10px 0px 0px; width: 740px; height: auto; color: #454543; font-family: Simsun; font-size: 12px; line-height: normal; text-align: center; background-color: #ffffff;"><li style="margin: 0px 12px 12px 0px; list-style: none; line-height: 22px;"><span style="font-size: 13px;"><p>一、循环插入数据时出现<br />&nbsp; table is full</p><p>二、在mgm&gt;all report memoryusage 查看</p><p>Node 2: Data usage is 22%(2305 32K pages of total 10240)</p><p>使用率到最后98%以上这时出现啦table is full</p><p>基于以上两种情况，其实是一种情况的我的解决方法是:</p><p>根据硬件配置必须根据硬件配置修改my.cnf文件和config.ini文件</p><p>1.config.ini<br />[ndbd default]<br />NoOfReplicas=2&nbsp;<br />MaxNoOfConcurrentOperations=10000<br />DataMemory=320M<br />IndexMemory=96M<br />TimeBetweenWatchDogCheck=30000<br />MaxNoOfOrderedIndexes=512</p><p>2.my.cnf<br />[mysqld]<br />ndbcluster<br />ndb-connectstring=124.95.137.12<br />optimizer_switch=engine_condition_pushdown=off</p><p>问题得以解决<br /><span style="font-size: 12px;">来源：http://www.greensoftcode.net/</span><br /></p></span></li></ul></div><img src ="http://www.blogjava.net/ivanwan/aggbug/421688.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-23 20:07 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/23/421688.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>zabbix haproxy</title><link>http://www.blogjava.net/ivanwan/archive/2014/12/04/421059.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Thu, 04 Dec 2014 15:17:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/04/421059.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421059.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/04/421059.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421059.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421059.html</trackback:ping><description><![CDATA[<div>http://ma.ttias.be/advanced-monitoring-haproxy-with-zabbix-agent/</div><img src ="http://www.blogjava.net/ivanwan/aggbug/421059.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-04 23:17 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/04/421059.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>zabbix2.0监控到的cpu load值不准确 </title><link>http://www.blogjava.net/ivanwan/archive/2014/12/03/421010.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Wed, 03 Dec 2014 15:25:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/12/03/421010.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/421010.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/12/03/421010.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/421010.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/421010.html</trackback:ping><description><![CDATA[<div>http://blog.sina.com.cn/s/blog_62079f6201019itr.html</div><img src ="http://www.blogjava.net/ivanwan/aggbug/421010.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-12-03 23:25 <a href="http://www.blogjava.net/ivanwan/archive/2014/12/03/421010.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>基于LDAP的企业访问控制系统设计与实现 – 计算机与信息技术</title><link>http://www.blogjava.net/ivanwan/archive/2014/11/19/420317.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Wed, 19 Nov 2014 12:47:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/11/19/420317.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/420317.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/11/19/420317.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/420317.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/420317.html</trackback:ping><description><![CDATA[<div>http://www.ahcit.com/?p=1703</div><img src ="http://www.blogjava.net/ivanwan/aggbug/420317.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-11-19 20:47 <a href="http://www.blogjava.net/ivanwan/archive/2014/11/19/420317.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ubuntu 离线安装包</title><link>http://www.blogjava.net/ivanwan/archive/2014/11/15/420110.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Fri, 14 Nov 2014 17:07:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/11/15/420110.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/420110.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/11/15/420110.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/420110.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/420110.html</trackback:ping><description><![CDATA[<div>http://www.2cto.com/os/201309/243840.html</div><img src ="http://www.blogjava.net/ivanwan/aggbug/420110.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-11-15 01:07 <a href="http://www.blogjava.net/ivanwan/archive/2014/11/15/420110.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>分离pcap包</title><link>http://www.blogjava.net/ivanwan/archive/2014/10/17/418818.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Fri, 17 Oct 2014 04:24:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/10/17/418818.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/418818.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/10/17/418818.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/418818.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/418818.html</trackback:ping><description><![CDATA[<div>http://packetlife.net/blog/2011/apr/11/extracting-packets-large-captures/</div><img src ="http://www.blogjava.net/ivanwan/aggbug/418818.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-10-17 12:24 <a href="http://www.blogjava.net/ivanwan/archive/2014/10/17/418818.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Configure HAProxy to Load Balance Sites With SSL</title><link>http://www.blogjava.net/ivanwan/archive/2014/08/17/417035.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Sat, 16 Aug 2014 17:52:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/08/17/417035.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/417035.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/08/17/417035.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/417035.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/417035.html</trackback:ping><description><![CDATA[<div>http://virtuallyhyper.com/2013/05/configure-haproxy-to-load-balance-sites-with-ssl/</div><img src ="http://www.blogjava.net/ivanwan/aggbug/417035.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-08-17 01:52 <a href="http://www.blogjava.net/ivanwan/archive/2014/08/17/417035.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一些开源的监控工具</title><link>http://www.blogjava.net/ivanwan/archive/2014/05/28/414186.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 27 May 2014 17:01:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/05/28/414186.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/414186.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/05/28/414186.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/414186.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/414186.html</trackback:ping><description><![CDATA[<div><p>什么东西可以监控OpenStack呢？OpenStack对监控的需求起码有以下这些：</p> <p>&nbsp;</p> <ul><li>不仅要能监控物理机，也能监控虚机</li><li>监控信息也必须是tenant隔离的</li><li>监控项的收集应该是自动地</li><li>监控工具应该一般化以监控任何设备</li><li>监控工具必须提供API</li></ul> <p>下面是监控工具的一般架构：</p> <p>&nbsp;</p> <p><a href="http://www.openstack.cn/wp-content/uploads/2013/08/zhjk.jpg"><img size-full=""  wp-image-246"="" alt="zhjk" src="http://www.openstack.cn/wp-content/uploads/2013/08/zhjk.jpg" height="520" width="621" /></a></p> <p>&nbsp;</p> <p>网上搜索了一下，<strong>现在主流的监控工具有：Nagios, cacti, Zabbix, Muni, Zenoss</strong>。我不是做运维的对这些工具都不熟，以前不熟，现在也不熟。下面是一些理解，不一定准。</p> <p>Nagios，最老牌了，比较通用的监控工具。特大的特点是报警。图形化功能一般般。一般要安装Agent，配置起来看网上的说法是比较复杂的，没用过，没实际发言权。</p> <p>cacti，图形化功能不错，所以Nagios一般结合它来使用。</p> <p>Zabbix，监控和图形化功能都还可以了，尤其有一本电子书 zabbix 1.8 network monitoring</p> <p>Zenoss, 监控新贵，它使用无Agent的通用技术如SNMP和SSL来监控，部署起来会比较方便。尤其是Zenoss公司有人现在也加入OpenStack社区了，专门开发了一个OpenStack特有的扩展（</p> <p><a href="https://github.com/zenoss/ZenPacks.zenoss.OpenStack">https://github.com/zenoss/ZenPacks.zenoss.OpenStack</a>）不幸的是，目前只支持Nova API 1.1，且它只能收集单个tenant的数据，不利于rating和billing。</p> <p>OpenStack Ceilometer工程主要监控的是tenant下虚机的数据，用来做billing的，物理机的监控支持不大好。</p> <p>比较来比较去，如果是我，可能会做如下选型决定，不一定正确 ：</p> <p>Nagios 或者 Zenoss (视情况）</p> <p>&nbsp;</p> <p>下面内容来自：<a href="http://docs.openstack.org/developer/ceilometer/">http://docs.openstack.org/developer/ceilometer/</a>， 我们看一下Ceilometer工程的现状, 架构如下：</p> <p>&nbsp;</p> <p><a href="http://www.openstack.cn/wp-content/uploads/2013/08/zhjk2.jpg"><img size-full=""  wp-image-247"="" alt="zhjk2" src="http://www.openstack.cn/wp-content/uploads/2013/08/zhjk2.jpg" height="594" width="732" /></a></p> <p>&nbsp;</p> <p>运行OpenStack各组件的节点上一般有Agent来收集信息，收集后发给MQ，Ceilometer的Collector进程监控到数据之后存储到DB之中。从<a href="http://docs.openstack.org/developer/ceilometer/measurements.html">http://docs.openstack.org/developer/ceilometer/measurements.html</a>&nbsp;这页显示的监控项来看，<strong>目前Ceilometer监控来的数据主要来只是用来做billing的</strong>。</p> <p>&nbsp;</p> <p><strong>文章来源：</strong><a href="http://blog.csdn.net/quqi99/article/details/9400747">http://blog.csdn.net/quqi99/article/details/9400747</a><br /> <strong>文章作者：</strong>张华&nbsp;http://blog.csdn.net/quqi99</p></div><img src ="http://www.blogjava.net/ivanwan/aggbug/414186.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-05-28 01:01 <a href="http://www.blogjava.net/ivanwan/archive/2014/05/28/414186.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>haproxy ssl和ssh配置</title><link>http://www.blogjava.net/ivanwan/archive/2014/03/19/411202.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 18 Mar 2014 17:53:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/03/19/411202.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/411202.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/03/19/411202.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/411202.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/411202.html</trackback:ping><description><![CDATA[<div><h2>Using HAProxy to make SSH and SSL available on the same port</h2>  <p>Certain places firewall TCP ports other than the most common ports. There are <a href="http://en.wikipedia.org/wiki/Tunneling_protocol#SSH_tunneling">many</a> <a href="https://help.ubuntu.com/community/SSH_VPN">techniques</a> for <a href="http://www.daemon.be/maarten/dnstunnel.html">bypassing</a> such <a href="http://tools.ietf.org/html/rfc2549">restrictions</a>. One simple approach is to run a SSH daemon on port 443, however a downside of this is you need to dedicate an IP address to this SSH service.</p>  <p>There is quite a neat technique for making SSH and SSL share a port; in the SSL protocol clients should write first, whereas in SSH the server should write first; therefore by waiting to see if the client writes data it is possible to make a guess as to if the client is an SSL client or a SSH client.</p>  <p>I'm not the first person to think this up, <a href="http://search.cpan.org/dist/Net-Proxy">Net::Proxy</a> has a script called <a href="http://search.cpan.org/%7Ebook/Net-Proxy-0.08/script/sslh">sslh</a> and confusingly there is also a C implementation also called <a href="http://www.rutschle.net/tech/sslh.shtml">sslh</a>.</p>  <p>I recently switched my web server to use <a href="http://haproxy.1wt.eu/">HAProxy</a> to allow me some more flexiblity in how I configure things (especially now the development version has keepalive support).  While reading the (incredibly detailed) <a href="http://haproxy.1wt.eu/#docs">documentation</a> I noticed it should be able to do the <em>sslh</em> technique.</p>  <p>Doing this needs the (currently) in development HAProxy 1.4 (support was added for content switching TCP as well as HTTP in <a href="http://haproxy.1wt.eu/git?p=haproxy.git;a=commit;h=1d0dfb155df56f256b615049a0d9333595a35501">this commit</a> -- thanks to Cyril Bont&#233; on the mailing list for confirming that).</p>  <p>The configuration looks something like the following (global section omitted, you'll want to run it as a user other than root and chroot it if you actually use this).</p>  <pre><span style="font-family: verdana, 'courier new';">defaults</span></pre><p>&nbsp; timeout connect 5s</p> <p>&nbsp; timeout client 50s</p> <p>&nbsp; timeout server 20s</p> <p><br /></p> <p>listen ssl :443</p> <p>&nbsp; tcp-request inspect-delay 2s</p> <p>&nbsp; acl is_ssl req_ssl_ver 2:3.1</p> <p>&nbsp; tcp-request content accept if is_ssl</p> <p>&nbsp; use_backend ssh if !is_ssl</p> <p>&nbsp; server www-ssl :444</p> <p>&nbsp; timeout client 2h</p> <p><br /></p> <p>backend ssh</p> <p>&nbsp; mode tcp</p> <p>&nbsp; server ssh :22</p> <p>&nbsp; timeout server 2h</p><p><br /><br />This listens on port 443, forwards it to port 444 (where the actual SSL web server is listening) unless it is <strong>not</strong> SSLv2, SSLv3 or TLSv1 traffic, in which case it forwards it to the ssh backend listening on port 22.</p>  <p>Obviously as I said earlier this is only a guess that is subject to network conditions such as packet loss. I'm not recommending you use this technique on a production site, but for a low traffic machine where you want to run both protocols it is very useful. (By increasing the timeout for SSH you increase the chances of a correct result, but also add a potentially annoying delay).</p>  <p>Sometimes layer 7 filtering techniques are in use and just listening on port 443 is not enough. In this case you can <a href="http://dag.wieers.com/howto/ssh-http-tunneling/">use SSH inside SSL</a>.</p> </div><div post-info"=""></div><img src ="http://www.blogjava.net/ivanwan/aggbug/411202.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-03-19 01:53 <a href="http://www.blogjava.net/ivanwan/archive/2014/03/19/411202.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>apt-get install 错误</title><link>http://www.blogjava.net/ivanwan/archive/2014/03/12/410946.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Wed, 12 Mar 2014 11:00:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/03/12/410946.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/410946.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/03/12/410946.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/410946.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/410946.html</trackback:ping><description><![CDATA[<span style="font-family: Tahoma, Arial, Helvetica, sans-serif, SimSun; background-color: #ffffff;">dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)<br /><br /><br /></span><span style="font-family: Tahoma, Arial, Helvetica, sans-serif, SimSun; line-height: 26.600000381469727px; background-color: #ffffff;">已解决：	 cd/var/lib/dpkg</span><br style="font-family: Tahoma, Arial, Helvetica, sans-serif, SimSun; line-height: 26.600000381469727px; background-color: #ffffff;" /><span style="font-family: Tahoma, Arial, Helvetica, sans-serif, SimSun; line-height: 26.600000381469727px; background-color: #ffffff;">sudo mv info info.bak</span><br style="font-family: Tahoma, Arial, Helvetica, sans-serif, SimSun; line-height: 26.600000381469727px; background-color: #ffffff;" /><span style="font-family: Tahoma, Arial, Helvetica, sans-serif, SimSun; line-height: 26.600000381469727px; background-color: #ffffff;">sudo mkdir info</span><img src ="http://www.blogjava.net/ivanwan/aggbug/410946.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-03-12 19:00 <a href="http://www.blogjava.net/ivanwan/archive/2014/03/12/410946.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>haproxzy配置</title><link>http://www.blogjava.net/ivanwan/archive/2014/03/11/410878.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Tue, 11 Mar 2014 07:22:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2014/03/11/410878.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/410878.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2014/03/11/410878.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/410878.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/410878.html</trackback:ping><description><![CDATA[<div># this config needs haproxy-1.1.28 or haproxy-1.2.1</div><div></div><div>global</div><div>&nbsp; &nbsp; &nbsp; &nbsp; log 127.0.0.1 &nbsp; local0</div><div>&nbsp; &nbsp; &nbsp; &nbsp; log 127.0.0.1 &nbsp; local1 notice</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #log loghost &nbsp; &nbsp;local0 info</div><div>&nbsp; &nbsp; &nbsp; &nbsp; maxconn 4096</div><div>&nbsp; &nbsp; &nbsp; &nbsp; tune.bufsize 20480</div><div>&nbsp; &nbsp; &nbsp; &nbsp; tune.maxrewrite 2048</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #chroot /usr/share/haproxy</div><div>&nbsp; &nbsp; &nbsp; &nbsp; user haproxy</div><div>&nbsp; &nbsp; &nbsp; &nbsp; group haproxy</div><div>&nbsp; &nbsp; &nbsp; &nbsp; daemon</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #debug</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #quiet</div><div></div><div>defaults</div><div>&nbsp; &nbsp; log global</div><div>&nbsp; &nbsp; mode tcp</div><div>&nbsp; &nbsp; option tcplog</div><div>&nbsp; &nbsp; option dontlognull</div><div>&nbsp; &nbsp; option tcp-smart-accept</div><div>&nbsp; &nbsp; option tcp-smart-connect</div><div>&nbsp; &nbsp; #option dontlog-normal</div><div>&nbsp; &nbsp; retries 3</div><div>&nbsp; &nbsp; option redispatch</div><div>&nbsp; &nbsp; timeout connect 1h</div><div>&nbsp; &nbsp; timeout client &nbsp;1h &nbsp;</div><div>&nbsp; &nbsp; timeout server &nbsp;1h</div><div>&nbsp; &nbsp; maxconn 40000</div><div>&nbsp; &nbsp; option redispatch</div><div></div><div>listen rabbitmq_cluster 0.0.0.0:5672</div><div>&nbsp; &nbsp; &nbsp; &nbsp;mode tcp</div><div>&nbsp; &nbsp; &nbsp; &nbsp;maxconn 2000</div><div>&nbsp; &nbsp; &nbsp; &nbsp;balance roundrobin</div><div>&nbsp; &nbsp; &nbsp; &nbsp;server &nbsp; rabbit1 172.20.21.1:5672 check inter 2000 rise 2 fall 3</div><div>&nbsp; &nbsp; &nbsp; &nbsp;server &nbsp; rabbit2 172.20.21.2:5672 check inter 2000 rise 2 fall 3</div><div>&nbsp; &nbsp; &nbsp; &nbsp;server &nbsp; rabbit3 172.20.21.3:5672 check inter 2000 rise 2 fall 3</div><div></div><div>listen &nbsp;mariadb_cluster</div><div>&nbsp; &nbsp; &nbsp; &nbsp; bind 0.0.0.0:3306</div><div>&nbsp; &nbsp; &nbsp; &nbsp; mode tcp &nbsp; &nbsp; &nbsp;&nbsp;</div><div><span style="white-space:pre">	</span>#option tcpka</div><div>&nbsp; &nbsp; &nbsp; &nbsp; option mysql-check user haproxy #mysql.... &nbsp;root.mysql.....</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #balance leastconn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #....</div><div>&nbsp; &nbsp; &nbsp; &nbsp; balance roundrobin</div><div>&nbsp; &nbsp; &nbsp; &nbsp; server mysql1 172.20.21.1:3306 weight 1 check &nbsp;inter 1s rise 2 fall 2</div><div>&nbsp; &nbsp; &nbsp; &nbsp; server mysql2 172.20.21.2:3306 weight 1 check &nbsp;inter 1s rise 2 fall 2</div><div>&nbsp; &nbsp; &nbsp; &nbsp; server mysql3 172.20.21.3:3306 weight 1 check &nbsp;inter 1s rise 2 fall 2</div><div></div><div>listen ssdb_cluster 0.0.0.0:8888</div><div>&nbsp; &nbsp; &nbsp; &nbsp;mode tcp</div><div>&nbsp; &nbsp; &nbsp; &nbsp;maxconn 2000</div><div>&nbsp; &nbsp; &nbsp; &nbsp;balance roundrobin</div><div>&nbsp; &nbsp; &nbsp; &nbsp;server &nbsp; ssdb1 172.20.21.1:8888 check inter 2000 rise 2 fall 3</div><div>&nbsp; &nbsp; &nbsp; &nbsp;server &nbsp; ssdb2 172.20.21.2:8888 check inter 2000 rise 2 fall 3</div><div></div><div>listen 49 0.0.0.0:3389</div><div>&nbsp; &nbsp; &nbsp; &nbsp;mode tcp</div><div>&nbsp; &nbsp; &nbsp; &nbsp;maxconn 2000</div><div>&nbsp; &nbsp; &nbsp; &nbsp;balance source</div><div>&nbsp; &nbsp; &nbsp; &nbsp;option tcpka</div><div>&nbsp; &nbsp; &nbsp; &nbsp;server &nbsp; 49 172.20.0.49:3389 check inter 2000 rise 2 fall 3</div><div></div><div></div><div>listen stats :1936</div><div>&nbsp; &nbsp; mode http</div><div>&nbsp; &nbsp; stats enable</div><div>&nbsp; &nbsp; stats hide-version</div><div>&nbsp; &nbsp; stats realm Haproxy\ Statistics</div><div>&nbsp; &nbsp; stats uri /</div><div>&nbsp; &nbsp; stats auth admin:admin</div><div></div><img src ="http://www.blogjava.net/ivanwan/aggbug/410878.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2014-03-11 15:22 <a href="http://www.blogjava.net/ivanwan/archive/2014/03/11/410878.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>各种连接池参数比较</title><link>http://www.blogjava.net/ivanwan/archive/2013/12/26/408072.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Thu, 26 Dec 2013 08:02:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2013/12/26/408072.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/408072.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2013/12/26/408072.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/408072.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/408072.html</trackback:ping><description><![CDATA[<div id="version-info" notemacro=""  padded"=""><br />     </div>                                   <div>                         <div> <table><tbody> <tr> <th>&nbsp;</th> <th> Druid </th> <th> DBCP </th> <th> C3P0 </th> <th> JBoss </th> <th> Weblogic </th> <th> BonCP </th> </tr> <tr> <th> 数据库用户名称 </th> <td> Username </td> <td> Username </td> <td> User </td> <td> user-name </td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 数据库密码 </th> <td> Password </td> <td> Password </td> <td> Password </td> <td> password</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 驱动名称 </th> <td> DriverClassName </td> <td> DriverClassName </td> <td> DriverClass </td> <td> driver-class </td> <td> DriverName </td> <td>&nbsp;</td> </tr> <tr> <th> JDBC连接串 </th> <td> Url </td> <td> Url </td> <td> JdbcUrl </td> <td> connection-url </td> <td> Url </td> <td>&nbsp;</td> </tr> <tr> <th> JDBC连接属性 </th> <td> Properties </td> <td> Properties </td> <td> Properties </td> <td> connection-property </td> <td> Properties </td> <td>&nbsp;</td> </tr> <tr> <th> 初始化大小 </th> <td> InitialSize </td> <td> InitialSize </td> <td> InitialPoolSize </td> <td>&nbsp;</td> <td> Initial Capacity </td> <td>&nbsp;</td> </tr> <tr> <th> 连接池最小空闲 </th> <td> MinIdle </td> <td> MinIdle </td> <td> MinPoolSize </td> <td> min-pool-size </td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 连接池最大空闲 </th> <td> MaxIdle </td> <td> MaxIdle </td> <td> MaxPoolSize </td> <td> max-pool-size </td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 连接池最大使用连接数量 </th> <td> MaxActive </td> <td> MaxActive </td> <td>&nbsp;</td> <td>&nbsp;</td> <td> MaximumCapacity </td> <td>&nbsp;</td> </tr> <tr> <th> 最小逐出时间 </th> <td> MinEvictableIdleTimeMillis </td> <td> MinEvictableIdleTimeMillis</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 最多等待线程 </th> <td> MaxWaitThreadCount </td> <td> MaxWaitThreadCount </td> <td>&nbsp;</td> <td>&nbsp;</td> <td> HighestNumWaiters </td> <td>&nbsp;</td> </tr> <tr> <th> 连接池增长步长 </th> <td>&nbsp;</td> <td>&nbsp;</td> <td> AcquireIncrement </td> <td>&nbsp;</td> <td> CapacityIncrement </td> <td>&nbsp;</td> </tr> <tr> <th> 获取连接时测试是否有效</th> <td> TestOnBorrow </td> <td> TestOnBorrow </td> <td> TestConnectionOnCheckout </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 归还连接时是否测试有效 </th> <td> TestOnReturn </td> <td> TestOnReturn </td> <td> TestConnectionOnCheckin </td> <td>&nbsp;</td> <td> TestConnectionsOnReserve </td> <td>&nbsp;</td> </tr> <tr> <th> 测试有效用的SQL Query </th> <td> ValidationQuery </td> <td> ValidationQuery </td> <td> PreferredTestQuery </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 测试有效的超时时间 </th> <td> ValidationQueryTimeout </td> <td> ValidationQueryTimeout </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 连接初始化SQL </th> <td> ConnectionInitSqls </td> <td> ConnectionInitSqls </td> <td>&nbsp;</td> <td>&nbsp;</td> <td> InitSQL </td> <td>&nbsp;</td> </tr> <tr> <th> 连接最大存活实现 </th> <td>&nbsp;</td> <td>&nbsp;</td> <td> MaxConnectionAge </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 连接泄漏的超时时间 </th> <td> RemoveAbandonedTimeout </td> <td> RemoveAbandonedTimeout </td> <td> UnreturnedConnectionTimeout </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 关闭泄漏的连接时打印堆栈信息 </th> <td> LogAbandoned </td> <td> LogAbandoned </td> <td> DebugUnreturnedConnectionStackTraces </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <th> 逐出连接的检测时间间隔</th> <td> TimeBetweenEvictionRunsMillis </td> <td> TimeBetweenEvictionRunsMillis </td> <td>&nbsp;</td> <td>&nbsp;</td> <td> ShrinkFrequencySeconds </td> <td>&nbsp;</td> </tr> <tr> <th> Statement缓存算法 </th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> StatementCacheType</td> <td>&nbsp;</td> </tr> <tr> <th> Statement缓存大小 </th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> StatementCacheSize</td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> TestTableName</td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> SecondsToTrustAnIdlePoolConnection </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> ConnectionCreationRetryFrequencySeconds </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> LoginDelaySeconds </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Connection Usage </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Connection Reservation Wait </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Connection Leak </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Connection Reservation Failed </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Statement Cache Entry </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Statement Usage </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Connection Last Usage </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Connection Multithreaded Usage </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> Profile Harvest Frequency Seconds </td> <td>&nbsp;</td> </tr> <tr> <th> 连接池扩展 </th> <td> Filters </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> DriverInterceptor </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> CredentialMappingEnabled </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> InactiveConnectionTimeoutSeconds </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> ConnectionReserveTimeoutSeconds </td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td> QueryTimeout </td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> StatementTimeout </td> <td>&nbsp;</td> </tr> <tr> <th> 连接池关闭时对正在使用连接的处理方式 </th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> IgnoreInUseConnectionsEnabled </td> <td>&nbsp;</td> </tr> <tr> <th> 把连接放到ThreadLocal中 </th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> PinnedToThread </td> <td>&nbsp;</td> </tr> <tr> <th> 关闭&#8220;赃&#8221;连接（调用过getVendorConnection方法） </th> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> RemoveInfectedConnections </td> <td>&nbsp;</td></tr></tbody></table></div></div><img src ="http://www.blogjava.net/ivanwan/aggbug/408072.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2013-12-26 16:02 <a href="http://www.blogjava.net/ivanwan/archive/2013/12/26/408072.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>3种LVS/Nginx/HAProxy负载均衡器的对比分析</title><link>http://www.blogjava.net/ivanwan/archive/2013/12/25/408014.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Wed, 25 Dec 2013 04:34:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2013/12/25/408014.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/408014.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2013/12/25/408014.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/408014.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/408014.html</trackback:ping><description><![CDATA[<div><p>现在网站发展的趋势对网络负载均衡的使用是随着网站规模的提升根据不同的阶段来使用不同的技术：</p> <p>一种是通过硬件来进行进行，常见的硬件有比较昂贵的NetScaler、F5、Radware和Array等商用的负载均衡器，它的优点就是有专业的维护团队来对这些服务进行维护、缺点就是花销太大，所以对于规模较小的网络服务来说暂时还没有需要使用；另外一种就是类似于LVS/HAProxy、Nginx的基于Linux的开源免费的负载均衡软件策略,这些都是通过软件级别来实现，所以费用非常低廉，所以我个也比较推荐大家采用第二种方案来实施自己网站的负载均衡需求。</p> <p>近期朋友刘鑫(紫雨荷雪)的项目成功上线了，PV达到了亿级/日的访问量，最前端用的是HAProxy+Keepalived双机作的负载均衡器 /反向代理，整个网站非常稳定；这让我更坚定了以前跟老男孩前辈聊的关于网站架构比较合理设计的架构方案：即Nginx /HAProxy+Keepalived作Web最前端的负载均衡器，后端的MySQL数据库架构采用一主多从，读写分离的方式，采用LVS+Keepalived的方式。</p> <p>在这里我也有一点要跟大家申明下：很多朋友担心软件级别的负载均衡在高并发流量冲击下的稳定情况，事实是我们通过成功上线的许多网站发现，它们的稳 定性也是非常好的，宕机的可能性微乎其微，所以我现在做的项目，基本上没考虑服务级别的高可用了。相信大家对这些软件级别的负载均衡软件都已经有了很深的 的认识，下面我就它们的特点和适用场合分别说明下。</p> <p>LVS：使用集群技术和Linux操作系统实现一个高性能、高可用的服务器，它具有很好的可伸缩性（Scalability)、可靠性（Reliability)和可管理性（Manageability)，感谢章文嵩博士为我们提供如此强大实用的开源软件。</p> <p><strong>LVS的特点是：<br /> </strong></p> <ol><li>抗负载能力强、是工作在网络4层之上仅作分发之用，没有流量的产生，这个特点也决定了它在负载均衡软件里的性能最强的；</li><li>配置性比较低，这是一个缺点也是一个优点，因为没有可太多配置的东西，所以并不需要太多接触，大大减少了人为出错的几率；</li><li>工作稳定，自身有完整的双机热备方案，如LVS+Keepalived和LVS+Heartbeat，不过我们在项目实施中用得最多的还是LVS/DR+Keepalived；</li><li>无流量，保证了均衡器IO的性能不会收到大流量的影响；</li><li>应用范围比较广，可以对所有应用做负载均衡；</li><li>软件本身不支持正则处理，不能做动静分离，这个就比较遗憾了；其实现在许多网站在这方面都有较强的需求，这个是Nginx/HAProxy+Keepalived的优势所在。</li><li>如果是网站应用比较庞大的话，实施LVS/DR+Keepalived起来就比较复杂了，特别后面有Windows Server应用的机器的话，如果实施及配置还有维护过程就比较复杂了，相对而言，Nginx/HAProxy+Keepalived就简单多了。<span style="color: #c0c0c0">站长教学网 eduyo.com</span></li></ol> <p><strong>Nginx的特点是：<br /> </strong></p> <ol><li>工作在网络的7层之上，可以针对http应用做一些分流的策略，比如针对域名、目录结构，它的正则规则比HAProxy更为强大和灵活，这也是许多朋友喜欢它的原因之一；</li><li>Nginx对网络的依赖非常小，理论上能ping通就就能进行负载功能，这个也是它的优势所在；</li><li>Nginx安装和配置比较简单，测试起来比较方便；</li><li>也可以承担高的负载压力且稳定，一般能支撑超过几万次的并发量；</li><li>Nginx可以通过端口检测到服务器内部的故障，比如根据服务器处理网页返回的状态码、超时等等，并且会把返回错误的请求重新提交到另一个节点，不过其中缺点就是不支持url来检测；</li><li>Nginx仅能支持http和Email，这样就在适用范围上面小很多，这个它的弱势；</li><li>Nginx不仅仅是一款优秀的负载均衡器/反向代理软件，它同时也是功能强大的Web应用服务器。LNMP现在也是非常流行的web架构，大有和以前最流行的LAMP架构分庭抗争之势，在高流量的环境中也有很好的效果。</li><li>Nginx现在作为Web反向加速缓存越来越成熟了，很多朋友都已在生产环境下投入生产了，而且反映效果不错，速度比传统的Squid服务器更快，有兴趣的朋友可以考虑用其作为反向代理加速器。</li></ol> <p><strong>HAProxy的特点是：<br /> </strong></p> <ol><li>HAProxy是支持虚拟主机的，以前有朋友说这个不支持虚拟主机，我这里特此更正一下。</li><li>能够补充Nginx的一些缺点比如Session的保持，Cookie的引导等工作</li><li>支持url检测后端的服务器出问题的检测会有很好的帮助。</li><li>它跟LVS一样，本身仅仅就只是一款负载均衡软件；单纯从效率上来讲HAProxy更会比Nginx有更出色的负载均衡速度，在并发处理上也是优于Nginx的。</li><li>HAProxy可以对Mysql读进行负载均衡，对后端的MySQL节点进行检测和负载均衡，不过在后端的MySQL slaves数量超过10台时性能不如LVS，所以我向大家推荐LVS+Keepalived。</li><li>HAProxy的算法现在也越来越多了，具体有如下8种：<br />     &#9312; roundrobin，表示简单的轮询，这个不多说，这个是负载均衡基本都具备的；<br />     &#9313; static-rr，表示根据权重，建议关注；<br />     &#9314; leastconn，表示最少连接者先处理，建议关注；<br />     &#9315; source，表示根据请求源IP，这个跟Nginx的IP_hash机制类似，我们用其作为解决session问题的一种方法，建议关注；<br />     &#9316; ri，表示根据请求的URI；<br />     &#9317; rl_param，表示根据请求的URl参数'balance url_param' requires an URL parameter name；<br />     &#9318; hdr(name)，表示根据HTTP请求头来锁定每一次HTTP请求；<br />     &#9319; rdp-cookie(name)，表示根据据cookie(name)来锁定并哈希每一次TCP请求。</li></ol> <p>&nbsp;</p> <h3>&nbsp;</h3> <h3>Nginx和LVS作对比的结果</h3> <p>1、Nginx工作在网络的7层，所以它可以针对http应用本身来做分流策略，比如针对域名、目录结构等，相比之下LVS并不具备这样的功能，所 以  Nginx单凭这点可利用的场合就远多于LVS了；但Nginx有用的这些功能使其可调整度要高于LVS，所以经常要去触碰触碰，由LVS的第2条优点 看，触碰多了，人为出问题的几率也就会大。<br /> 2、Nginx对网络的依赖较小，理论上只要ping得通，网页访问正常，Nginx就能连得通，Nginx同时还能区分内外网，如果是同时拥有内外网的 节点，就相当于单机拥有了备份线路；LVS就比较依赖于网络环境，目前来看服务器在同一网段内并且LVS使用direct方式分流，效果较能得到保证。另 外注意，LVS需要向托管商至少申请多一个ip来做Visual  IP，貌似是不能用本身的IP来做VIP的。要做好LVS管理员，确实得跟进学习很多有关网络通信方面的知识，就不再是一个HTTP那么简单了。<span style="color: #c0c0c0">站长教学网 eduyo.com</span><br /> 3、Nginx安装和配置比较简单，测试起来也很方便，因为它基本能把错误用日志打印出来。LVS的安装和配置、测试就要花比较长的时间了，因为同上所述，LVS对网络依赖比较大，很多时候不能配置成功都是因为网络问题而不是配置问题，出了问题要解决也相应的会麻烦得多。<br /> 4、Nginx也同样能承受很高负载且稳定，但负载度和稳定度差LVS还有几个等级：Nginx处理所有流量所以受限于机器IO和配置；本身的bug也还是难以避免的；Nginx没有现成的双机热备方案，所以跑在单机上还是风险较大，单机上的事情全都很难说。<br /> 5、Nginx可以检测到服务器内部的故障，比如根据服务器处理网页返回的状态码、超时等等，并且会把返回错误的请求重新提交到另一个节点。目前LVS中   ldirectd也能支持针对服务器内部的情况来监控，但LVS的原理使其不能重发请求。重发请求这点，譬如用户正在上传一个文件，而处理该上传的节点刚 好在上传过程中出现故障，Nginx会把上传切到另一台服务器重新处理，而LVS就直接断掉了，如果是上传一个很大的文件或者很重要的文件的话，用户可能 会因此而恼火。<br /> 6、Nginx对请求的异步处理可以帮助节点服务器减轻负载，假如使用apache直接对外服务，那么出现很多的窄带链接时apache服务器将会占用大 量内存而不能释放，使用多一个Nginx做apache代理的话，这些窄带链接会被Nginx挡住，apache上就不会堆积过多的请求，这样就减少了相 当多的内存占用。这点使用squid也有相同的作用，即使squid本身配置为不缓存，对apache还是有很大帮助的。LVS没有这些功能，也就无法能 比较。<br /> 7、Nginx能支持http和email（email的功能估计比较少人用），LVS所支持的应用在这点上会比Nginx更多。在使用上，一般最前端所 采取的策略应是LVS，也就是DNS的指向应为LVS均衡器，LVS的优点令它非常适合做这个任务。重要的ip地址，最好交由LVS托管，比如数据库的  ip、webservice服务器的ip等等，这些ip地址随着时间推移，使用面会越来越大，如果更换ip则故障会接踵而至。所以将这些重要ip交给  LVS托管是最为稳妥的，这样做的唯一缺点是需要的VIP数量会比较多。Nginx可作为LVS节点机器使用，一是可以利用Nginx的功能，二是可以利 用Nginx的性能。当然这一层面也可以直接使用squid，squid的功能方面就比Nginx弱不少了，性能上也有所逊色于Nginx。Nginx也 可作为中层代理使用，这一层面Nginx基本上无对手，唯一可以撼动Nginx的就只有lighttpd了，不过lighttpd目前还没有能做到  Nginx完全的功能，配置也不那么清晰易读。另外，中层代理的IP也是重要的，所以中层代理也拥有一个VIP和LVS是最完美的方案了。具体的应用还得 具体分析，如果是比较小的网站（日PV&lt;1000万），用Nginx就完全可以了，如果机器也不少，可以用DNS轮询，LVS所耗费的机器还是比较 多的；大型网站或者重要的服务，机器不发愁的时候，要多多考虑利用LVS</p></div><img src ="http://www.blogjava.net/ivanwan/aggbug/408014.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2013-12-25 12:34 <a href="http://www.blogjava.net/ivanwan/archive/2013/12/25/408014.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HaProxy的负载均衡策略</title><link>http://www.blogjava.net/ivanwan/archive/2013/12/25/408013.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Wed, 25 Dec 2013 04:32:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2013/12/25/408013.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/408013.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2013/12/25/408013.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/408013.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/408013.html</trackback:ping><description><![CDATA[<div><div id="blog_content">     <p>roundrobin &nbsp;Each server is used in turns, according to their weights.<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;This is the smoothest and fairest algorithm when the server's<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;processing time remains equally distributed. This algorithm<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is dynamic, which means that server weights may be adjusted<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on the fly for slow starts for instance. It is limited by<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;design to 4128 active servers per backend. Note that in some<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;large farms, when a server becomes up after having been down<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for a very short time, it may sometimes take a few hundreds<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;requests for it to be re-integrated into the farm and start<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;receiving traffic. This is normal, though very rare. It is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;indicated here in case you would have the chance to observe<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;it, so that you don't worry.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;roundrobin:每个server根据权重依次被轮询，</p> <div>这个算法是动态的，意味着<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server的权重可以实时地被调整。对于每个haproxy的backend servers的数目<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;而言被限制在4128个活跃数目之内。<br /><br /><br />  &nbsp; &nbsp; &nbsp;static-rr &nbsp; Each server is used in turns, according to their weights.<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;This algorithm is as similar to roundrobin except that it is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;static, which means that changing a server's weight on the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fly will have no effect. On the other hand, it has no design<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limitation on the number of servers, and when a server goes<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up, it is always immediately reintroduced into the farm, once<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;the full map is recomputed. It also uses slightly less CPU to<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;run (around -1%).<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;静态roundrobin(static-rr):跟roundrobin类似，唯一的区别是不可以动态实时<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server权重和backend 的server数目没有上限。<br /><br />  &nbsp; &nbsp; &nbsp;leastconn &nbsp; The server with the lowest number of connections receives the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;connection. Round-robin is performed within groups of servers<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;of the same load to ensure that all servers will be used. Use<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;of this algorithm is recommended where very long sessions are<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;expected, such as LDAP, SQL, TSE, etc... but is not very well<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;suited for protocols using short sessions such as HTTP. This<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;algorithm is dynamic, which means that server weights may be<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adjusted on the fly for slow starts for instance.<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;最小连接数目负载均衡策略（leastconn）：round-robin适合于各个server负载相同的情况。<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;最小连接数目算法适合于长时间会话，如LDAP，SQL，TSE，但是并不适合于HTTP短连接的协议。<br /><br />  &nbsp; &nbsp; &nbsp;source &nbsp; &nbsp; &nbsp;The source IP address is hashed and divided by the total<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;weight of the running servers to designate which server will<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;receive the request. This ensures that the same client IP<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;address will always reach the same server as long as no<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server goes down or up. If the hash result changes due to the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;number of running servers changing, many clients will be<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;directed to a different server. This algorithm is generally<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;used in TCP mode where no cookie may be inserted. It may also<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;be used on the Internet to provide a best-effort stickiness<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to clients which refuse session cookies. This algorithm is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;static by default, which means that changing a server's<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;weight on the fly will have no effect, but this can be<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;changed using "hash-type".<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;源IP hash散列调度：将源ip地址进行hash，再根据hasn求模或者一致性hash定位到<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hash表中的server上。相同的ip地址的请求被分发到同一个server上。但当server的数量变化时，<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;来自于同一client的请求可能会被分发到不同的server上。这个算法通常用在没有cookie的tcp模式下。<br /><br />  &nbsp; &nbsp; &nbsp;uri &nbsp; &nbsp; &nbsp; &nbsp; The left part of the URI (before the question mark) is hashed<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and divided by the total weight of the running servers. The<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result designates which server will receive the request. This<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ensures that a same URI will always be directed to the same<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server as long as no server goes up or down. This is used<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;with proxy caches and anti-virus proxies in order to maximize<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;the cache hit rate. Note that this algorithm may only be used<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in an HTTP backend. This algorithm is static by default,<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;which means that changing a server's weight on the fly will<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;have no effect, but this can be changed using "hash-type".<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;This algorithm support two optional parameters "len" and<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"depth", both followed by a positive integer number. These<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;options may be helpful when it is needed to balance servers<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;based on the beginning of the URI only. The "len" parameter<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;indicates that the algorithm should only consider that many<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;characters at the beginning of the URI to compute the hash.<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Note that having "len" set to 1 rarely makes sense since most<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;URIs start with a leading "/".<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The "depth" parameter indicates the maximum directory depth<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to be used to compute the hash. One level is counted for each<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;slash in the request. If both parameters are specified, the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evaluation stops when either is reached.<br /><br />  &nbsp; &nbsp; &nbsp;url_param &nbsp; The URL parameter specified in argument will be looked up in<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;the query string of each HTTP GET request.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If the modifier "check_post" is used, then an HTTP POST<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;request entity will be searched for the parameter argument,<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;when it is not found in a query string after a question mark<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;('?') in the URL. Optionally, specify a number of octets to<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wait for before attempting to search the message body. If the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;entity can not be searched, then round robin is used for each<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;request. For instance, if your clients always send the LB<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;parameter in the first 128 bytes, then specify that. The<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;default is 48. The entity data will not be scanned until the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;required number of octets have arrived at the gateway, this<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is the minimum of: (default/max_wait, Content-Length or first<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;chunk length). If Content-Length is missing or zero, it does<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;not need to wait for more data than the client promised to<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;send. When Content-Length is present and larger than<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;max_wait&gt;, then waiting is limited to &lt;max_wait&gt; and it is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;assumed that this will be enough data to search for the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;presence of the parameter. In the unlikely event that<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Transfer-Encoding: chunked is used, only the first chunk is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;scanned. Parameter values separated by a chunk boundary, may<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;be randomly balanced if at all.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If the parameter is found followed by an equal sign ('=') and<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a value, then the value is hashed and divided by the total<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;weight of the running servers. The result designates which<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server will receive the request.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;This is used to track user identifiers in requests and ensure<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;that a same user ID will always be sent to the same server as<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;long as no server goes up or down. If no value is found or if<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;the parameter is not found, then a round robin algorithm is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;applied. Note that this algorithm may only be used in an HTTP<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;backend. This algorithm is static by default, which means<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;that changing a server's weight on the fly will have no<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;effect, but this can be changed using "hash-type".<br /><br />  &nbsp; &nbsp; &nbsp;hdr(name) &nbsp; The HTTP header &lt;name&gt; will be looked up in each HTTP request.<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Just as with the equivalent ACL 'hdr()' function, the header<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;name in parenthesis is not case sensitive. If the header is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;absent or if it does not contain any value, the roundrobin<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;algorithm is applied instead.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;An optional 'use_domain_only' parameter is available, for<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reducing the hash algorithm to the main domain part with some<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;specific headers such as 'Host'. For instance, in the Host<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;value "<a target="_blank" href="http://haproxy.1wt.eu/">haproxy.1wt.eu</a> ", only "1wt" will be considered.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;This algorithm is static by default, which means that<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;changing a server's weight on the fly will have no effect,<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;but this can be changed using "hash-type".<br /><br />  &nbsp; &nbsp; &nbsp;rdp-cookie<br />  &nbsp; &nbsp; &nbsp;rdp-cookie(name)<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The RDP cookie &lt;name&gt; (or "mstshash" if omitted) will be<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;looked up and hashed for each incoming TCP request. Just as<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;with the equivalent ACL 'req_rdp_cookie()' function, the name<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is not case-sensitive. This mechanism is useful as a degraded<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;persistence mode, as it makes it possible to always send the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;same user (or the same session ID) to the same server. If the<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cookie is not found, the normal roundrobin algorithm is<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;used instead.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Note that for this to work, the frontend must ensure that an<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RDP cookie is already present in the request buffer. For this<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;you must use 'tcp-request content accept' rule combined with<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a 'req_rdp_cookie_cnt' ACL.<br /><br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;This algorithm is static by default, which means that<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;changing a server's weight on the fly will have no effect,<br />  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;but this can be changed us</div>   </div></div><img src ="http://www.blogjava.net/ivanwan/aggbug/408013.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2013-12-25 12:32 <a href="http://www.blogjava.net/ivanwan/archive/2013/12/25/408013.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mariadb集群负载</title><link>http://www.blogjava.net/ivanwan/archive/2013/12/22/407867.html</link><dc:creator>ivaneeo</dc:creator><author>ivaneeo</author><pubDate>Sat, 21 Dec 2013 18:57:00 GMT</pubDate><guid>http://www.blogjava.net/ivanwan/archive/2013/12/22/407867.html</guid><wfw:comment>http://www.blogjava.net/ivanwan/comments/407867.html</wfw:comment><comments>http://www.blogjava.net/ivanwan/archive/2013/12/22/407867.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ivanwan/comments/commentRss/407867.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ivanwan/services/trackbacks/407867.html</trackback:ping><description><![CDATA[1.安装mariadb on ubuntu<br /><div>http://blog.secaserver.com/2013/07/install-mariadb-galera-cluster-ubuntu/<br /><br />3 在服务器上用mysql -h 192.168.0.1 -u root -p mysql命令登录mysql数据库 <br /><br />然后用grant命令下放权限。 <br /><br />GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'root-password' WITH GRANT OPTION; <br /><br />GRANT ALL PRIVILEGES ON *.* TO root@127.0.0.1 IDENTIFIED BY 'root-password' WITH GRANT OPTION; <br /><br />GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'root-password' WITH GRANT OPTION; <br /><br />例如： <br />  GRANT&nbsp;&nbsp;  ALL&nbsp;&nbsp;  PRIVILEGES&nbsp;&nbsp;  ON&nbsp;&nbsp;  *.*&nbsp;&nbsp;  TO&nbsp;&nbsp;  root@'%'&nbsp;&nbsp;  identified&nbsp;&nbsp;  by&nbsp;&nbsp;  '123456'&nbsp;&nbsp;  <br /><br />注意：自己根据情况修改以上命令中的 &#8220;用户&#8221;&#8220;ip地址&#8221;&#8220;密码&#8221;。&nbsp;<br /><br />2 安装和配置haproxy<br /><pre>option mysql-check [ user &lt;username&gt; ]   <br /><span style="font-family: verdana, 'courier new';"> USE mysql;       INSERT INTO user (Host,User) values ('&lt;ip_of_haproxy&gt;','&lt;username&gt;');       FLUSH PRIVILEGES</span>heck <br /><br />only consists in parsing the Mysql Handshake Initialisation packet or   Error packet, we don't send anything in this mode. It was reported that it   can generate lockout if check is too frequent and/or if there is not enough   traffic. In fact, you need in this case to check MySQL "max_connect_errors"   value as if a connection is established successfully within fewer than MySQL   "max_connect_errors" attempts after a previous connection was interrupted,   the error count for the host is cleared to zero. If HAProxy's server get   blocked, the "FLUSH HOSTS" statement is the only way to unblock it.<br /><br />配置：<br /><div># this config needs haproxy-1.1.28 or haproxy-1.2.1  global         <br />log 127.0.0.1   <br />local0 info    <br />#日志相关         <br />log 127.0.0.1   <br />local1 notice         <br />maxconn 4096         <br />daemon         <br />#debug         <br />#quiet  defaults        <br /> log     global         mode    http         #option httplog         option  dontlognull         retries 3         option redispatch         maxconn         2000         contimeout      5000         clitimeout      50000         srvtimeout      50000  listen  mysql         bind 0.0.0.0:3333   #代理端口         mode tcp              #模式 TCP         option mysql-check user haproxy #mysql健康检查  root为mysql登录用户名         balance roundrobin            #调度算法         server mysql1 172.20.21.1:3306 weight 1 check  inter 1s rise 2 fall 2         server mysql2 172.20.21.2:3306 weight 1 check  inter 1s rise 2 fall 2         server mysql3 172.20.21.3:3306 weight 1 check  inter 1s rise 2 fall 2  listen stats :1936     mode http     stats enable     stats hide-version     stats realm Haproxy\ Statistics     stats uri /     stats auth admin:admin</div></pre></div><img src ="http://www.blogjava.net/ivanwan/aggbug/407867.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ivanwan/" target="_blank">ivaneeo</a> 2013-12-22 02:57 <a href="http://www.blogjava.net/ivanwan/archive/2013/12/22/407867.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>