??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产成人一区二区三区,日韩精品亚洲人成在线观看,亚洲区日韩区无码区http://www.tkk7.com/sliverfancy/archive/2018/08/14/433329.htmlTue, 14 Aug 2018 04:35:00 GMThttp://www.tkk7.com/sliverfancy/archive/2018/08/14/433329.htmlhttp://www.tkk7.com/sliverfancy/comments/433329.htmlhttp://www.tkk7.com/sliverfancy/archive/2018/08/14/433329.html#Feedback0http://www.tkk7.com/sliverfancy/comments/commentRss/433329.htmlhttp://www.tkk7.com/sliverfancy/services/trackbacks/433329.html今天启动Tomcat启动不了Q报以下错: 

org.apache.catalina.core.StandardContext startInternal 
SEVERE: Error listenerStart 
org.apache.catalina.core.StandardContext startInternal 
SEVERE: Context [/******] startup failed due to previous errors 

|上找了N多文章,都没有切中要実?nbsp;
后来在国外网站上搜到一个方?nbsp;
http://grails.1312388.n4.nabble.com/Deployment-problems-td4628710.html?nbsp;
我试了一下,是可以的。方案如下?nbsp;

Tomcat报的错太含糊了,什么错都没报出来,只提CZError listenerStart。ؓ了调试,我们要获得更详细的日志。可以在WEB-INF/classes目录下新Z个文件叫logging.propertiesQ内容如?nbsp;

Java代码  收藏代码
  1. handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler  
  2.   
  3. ############################################################  
  4. # Handler specific properties.  
  5. # Describes specific configuration info for Handlers.  
  6. ############################################################  
  7.   
  8. org.apache.juli.FileHandler.level = FINE  
  9. org.apache.juli.FileHandler.directory = ${catalina.base}/logs  
  10. org.apache.juli.FileHandler.prefix = error-debug.  
  11.   
  12. java.util.logging.ConsoleHandler.level = FINE  
  13. java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter  


q样Q我们再启动tomcatӞ׃在logs目录下生成一个更详细的日志error-debug.2012-05-31.log?nbsp;

我们q去看看什么错吧?nbsp;
我碰到的错误是FileNotFoundException.大家到的错应该各式各样都有Q所以就要具体问题具体分析了?nbsp;
tomcat的logging文档具体可参考http://tomcat.apache.org/tomcat-7.0-doc/logging.html 

2018-08-14 12:35 发表评论
]]>
服务器一般达到多qps比较?/title><link>http://www.tkk7.com/sliverfancy/archive/2016/06/08/430828.html</link><dc:creator>秦</dc:creator><author>秦</author><pubDate>Wed, 08 Jun 2016 02:23:00 GMT</pubDate><guid>http://www.tkk7.com/sliverfancy/archive/2016/06/08/430828.html</guid><wfw:comment>http://www.tkk7.com/sliverfancy/comments/430828.html</wfw:comment><comments>http://www.tkk7.com/sliverfancy/archive/2016/06/08/430828.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/sliverfancy/comments/commentRss/430828.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/sliverfancy/services/trackbacks/430828.html</trackback:ping><description><![CDATA[<pre id="best-content-2170306838" accuse="aContent" mb-10"="" style="margin-top: 0px; margin-bottom: 10px; padding: 0px; font-family: arial, 'courier new', courier, 宋体, monospace, 'Microsoft YaHei'; white-space: pre-wrap; word-wrap: break-word; color: #333333; line-height: 24px; background-color: #f3ffec;">每秒查询率QPS是对一个特定的查询服务器在规定旉内所处理量多少的衡量标准,在因特网上,作ؓ域名pȝ服务器的机器的性能l常用每U查询率来衡量?br /><br />原理Q每?0%的访问集中在20%的时间里Q这20%旉叫做峰值时?<br />公式Q? 总PV?* 80% ) / ( 每天U数 * 20% ) = 峰值时间每U请求数(QPS) <br />机器Q峰值时间每UQPS / 单台机器的QPS = 需要的机器 <br /><br />问:每天300w PV 的在单台机器上,q台机器需要多QPSQ?<br />{:( 3000000 * 0.8 ) / (86400 * 0.2 ) = 139 (QPS) <br /><br />问:如果一台机器的QPS?8Q需要几台机器来支持Q?<br />{:139 / 58 = 3 <br /></pre><img src ="http://www.tkk7.com/sliverfancy/aggbug/430828.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/sliverfancy/" target="_blank">秦</a> 2016-06-08 10:23 <a href="http://www.tkk7.com/sliverfancy/archive/2016/06/08/430828.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>敏捷开发之Scrum扫盲(转)http://www.tkk7.com/sliverfancy/archive/2016/04/28/430273.htmlThu, 28 Apr 2016 03:14:00 GMThttp://www.tkk7.com/sliverfancy/archive/2016/04/28/430273.htmlhttp://www.tkk7.com/sliverfancy/comments/430273.htmlhttp://www.tkk7.com/sliverfancy/archive/2016/04/28/430273.html#Feedback1http://www.tkk7.com/sliverfancy/comments/commentRss/430273.htmlhttp://www.tkk7.com/sliverfancy/services/trackbacks/430273.html现在敏捷开发是来火了,Zh都在谈敏PZh都在学习Scrum和XP...

 

Z不落后他人,于是我也开始学习ScrumQ今天主要是Ҏ最q阅ȝ相关资料Q根据自q理解Q用自己的话来讲qScrum中的各个环节Q主要目的有两个Q一个是q行知识的ȝQ另外一个是觉得|上很多学习资料的讲q方式让初学者不太容易理解;所以我军_写一扫盲性的博文Q同时试着也与园内的朋友一起分享交一下,希望对初学者有帮助?/p>

 

 什么是敏捷开发?

敏捷开?Agile Development)是一U以Zؓ核心、P代、@序渐q的开发方法?/p>

怎么理解呢?首先Q我们要理解它不是一门技术,它是一U开发方法,也就是一UY件开发的程Q它会指导我们用规定的环节去一步一步完成项目的开发;而这U开发方式的主要驱动核心是hQ它采用的是q代式开发;

 

Z么说是以Zؓ核心Q?/strong>

我们大部分h都学q瀑布开发模型,它是以文档ؓ驱动的,Z么呢Q因为在瀑布的整个开发过E中Q要写大量的文档Q把需求文档写出来后,开发h员都是根据文档进行开发的Q一切以文档Z据;而敏捷开发它只写有必要的文档Q或量写文档Q敏捷开发注重的是h与h之间Q面寚w的交,所以它以h为核心?/p>

 

什么是q代Q?/strong>

q代是指把一个复杂且开发周期很长的开发Q务,分解为很多小周期可完成的dQ这L一个周期就是一ơP代的q程Q同时每一ơP代都可以生或开发出一个可以交付的软g产品?/p>

 

关于Scrum和XP

前面说了敏捷它是一U指导思想或开发方式,但是它没有明告诉我们到底采用什么样的流E进行开发,而Scrum和XP是敏捷开发的具体方式了,你可以采用Scrum方式也可以采用XP方式QScrum和XP的区别是QScrum偏重于过E,XP则偏重于实践Q但是实际中Q两者是l合一起应用的Q这里我主要讲Scrum?/p>

 

什么是ScrumQ?/strong>

Scrum的英文意思是榄球运动的一个专业术语,表示“争球”的动作;把一个开发流E的名字取名为ScrumQ我想你一定能惌Z的开发团队在开发一个项目时Q大家像打橄榄球一栯速、富有战斗激情、hZ争我抢地完成它,你一定会感到非常兴奋的?/p>

而Scrum是q样的一个开发流E,q用该流E,你就能看C团队高效的工作?/p>

 

【Scrum开发流E中的三大角艌Ӏ?/p>

产品负责人(Product OwnerQ?/strong>

主要负责定产品的功能和辑ֈ要求的标准,指定软g的发布日期和交付的内容,同时有权力接受或拒绝开发团队的工作成果?/p>

 

程理员(Scrum MasterQ?/strong>

主要负责整个Scrum程在项目中的顺利实施和q行Q以及清除挡在客户和开发工作之间的沟通障,使得客户可以直接驱动开发?/p>

 

开发团队(Scrum TeamQ?/strong>

主要负责软g产品在Scrum规定程下进行开发工作,人数控制?~10人左叻I每个成员可能负责不同的技术方面,但要求每成员必须要有很强的自我管理能力,同时h一定的表达能力Q成员可以采用Q何工作方式,只要能达到Sprint的目标?/p>

 

 

Scrum程?/strong>

 

//------------------------

下面Q我们开始讲具体实施程Q但是在讲之前,我还要对一个英文单词进行讲解?/p>

什么是SprintQ?/strong>

Sprint是短距离赛跑的意思,q里面指的是一ơP代,而一ơP代的周期?个月旉Q即4个星期)Q也是我们要把一ơP代的开发内容以最快的速度完成它,q个q程我们U它为Sprint?/p>

 

如何q行Scrum开发?

1、我们首先需要确定一个Product BacklogQ按优先序排列的一个品需求列表)Q这个是由Product Owner 负责的;

2、Scrum TeamҎProduct Backlog列表Q做工作量的预估和安排;

3、有了Product Backlog列表Q我们需要通过 Sprint Planning MeetingQSprint计划会议Q?来从中挑选出一个Story作ؓ本次q代完成的目标,q个目标的时间周期是1~4个星期,然后把这个Storyq行l化QŞ成一个Sprint BacklogQ?/p>

4、Sprint Backlog是由Scrum Teamd成的Q每个成员根据Sprint Backlog再细化成更小的Q务(l到每个d的工作量?天内能完成)Q?/p>

5、在Scrum Team完成计划会议上选出的Sprint Backlogq程中,需要进?Daily Scrum MeetingQ每日站立会议)Q每ơ会议控制在15分钟左右Q每个h都必daQƈ且要向所有成员当面汇报你昨天完成了什么,q且向所有成员承Z今天要完成什么,同时遇到不能解决的问题也可以提出Q每个h回答完成后,要走到黑板前更新自己?nbsp;Sprint burn downQSprint燃尽图)Q?/p>

6、做到每日集成,也就是每天都要有一个可以成功编译、ƈ且可以演C的版本Q很多h可能q没有用q自动化的每日集成,其实TFS有q个功能Q它可以支持每次有成员进行签入操作的时候,在服务器上自动获取最新版本,然后在服务器中编译,如果通过则马上再执行单元试代码Q如果也全部通过Q则该版本发布Q这时一ơ正式的{օ操作才保存到TFS中,中间有Q何失败,都会用邮仉知目理人员Q?/p>

7、当一个Story完成Q也是Sprint Backlog被完成,也就表示一ơSprint完成Q这Ӟ我们要进?nbsp;Srpint Review MeetingQ演CZ议)Q也UCؓ评审会议Q品负责h和客户都要参加(最好本公司老板也参加)Q每一个Scrum Team的成员都要向他们演示自己完成的Y件品(q个会议非常重要Q一定不能取消)Q?/p>

8、最后就?nbsp;Sprint Retrospective MeetingQ回会议)Q也UCؓȝ会议Q以轮流发言方式q行Q每个h都要发言Qȝq讨论改q的地方Q放入下一轮Sprint的品需求中Q?/p>

 

 

下面是运用Scrum开发流E中的一些场景图Q?br style="margin: 0px; padding: 0px;" />

上图是一?Product Backlog 的示例?/p>

 

上图是每日的站立会议了Q参会h员可以随意姿势站立,d看板要保证让每个人看刎ͼ当每个h发言完后Q要走到d版前更新自己的燃图?/p>



d看版包含 未完成、正在做、已完成 的工作状态,假设你今天把一个未完成的工作已l完成,那么你要把小卡片从未完成区域贴到已完成区域?/p>


 

每个人的工作q度和完成情况都是公开的,如果有一个h的工作Q务在某一个位|放了好几天Q大安能发C的工作进度出C什么问题(成员人数最好是5~7个,q样每h可以使用一U专用颜色的标签U,一眼就可以从Q务版看出谁的工作q度快,谁的工作q度慢)

 

 

 上图可不是扑克牌Q它是计划纸牌,它的作用是防止项目在开发过E中Q被某些人所领导?/p>

怎么用的呢?比如AE序员开发一个功能,需?个小ӞBE序员认为只需要半时Q那他们各自取相应的牌,藏在手中Q最后摊牌,如果旉差距很大Q那么A和B可以讨论AZ么要5个小?..
转自Q?span style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px;">http://www.cnblogs.com/taven/archive/2010/10/17/1853386.html



2016-04-28 11:14 发表评论
]]>
悲观锁与乐观锁(转)http://www.tkk7.com/sliverfancy/archive/2016/01/05/428930.htmlTue, 05 Jan 2016 01:32:00 GMThttp://www.tkk7.com/sliverfancy/archive/2016/01/05/428930.htmlhttp://www.tkk7.com/sliverfancy/comments/428930.htmlhttp://www.tkk7.com/sliverfancy/archive/2016/01/05/428930.html#Feedback0http://www.tkk7.com/sliverfancy/comments/commentRss/428930.htmlhttp://www.tkk7.com/sliverfancy/services/trackbacks/428930.html先申明概念:

1?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">悲观?/a>Q正如其名,它指的是Ҏ据被外界Q包括本pȝ当前的其他事务,以及来自外部pȝ?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">事务处理Q修Ҏ保守态度Q因此,在整?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">数据处理q程中,数据处于锁定状态?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">悲观?/a>的实玎ͼ往往依靠数据库提供的锁机Ӟ也只有数据库层提供的锁机制才能真正保证数据访问的排他性,否则Q即使在本系l中实现了加锁机Ӟ也无法保证外部系l不会修Ҏ据)?br />2?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">乐观?/a>Q?Optimistic Locking Q?
相对悲观?/a>而言Q?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">乐观?/a>机制采取了更加宽杄加锁机制。悲观锁大多数情况下依靠数据库的锁机制实玎ͼ以保证操作最大程度的独占?/a>。但随之而来的就是数据库性能的大量开销Q特别是寚w事务而言Q这L开销往往无法承受。?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">乐观?/a>机制在一定程度上解决了这个问题。乐观锁Q大多是Z数据版本Q?Version Q记录机制实现。何谓数据版本?即ؓ数据增加一个版本标识,在基于数据库表的版本解决Ҏ中,一般是通过为数据库表增加一?“version” 字段来实现。读取出数据Ӟ此版本?/a>一同读出,之后更新ӞҎ版本?/a>加一。此Ӟ提交数据的版本数据与数据库表对应记录的当前版本信息q行比对Q如果提交的数据版本?/a>大于数据库表当前版本P则予以更斎ͼ否则认ؓ是过期数据?br />
所以悲观锁和乐观锁最大的区别是是否一直锁定资源,悲观锁在事物的全程锁定数据Q乐观锁不锁定数据(?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">d?/a>是阻塞事物,而用乐观锁则会导致回滚。这个是一U事物冲H后的不同锁的表象)。乐观锁的最大特Ҏ在最后检查数据是否被修改Q如果已被别Z改过Q则回滚数据Q避?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">脏数?/a>。至于事物是否冲H和加锁没有直接联系Q该冲突的还是会冲突Q不你加悲观锁和乐观锁都会冲突?br />
悲观锁和乐观锁都是ؓ了解决丢失更新问题或者是脏读。悲观锁和乐观锁的重点就是是否在d记录的时候直接上锁。悲观锁的缺点很明显Q需要一个持l的数据库连接,q在
web应用中已l不适合了?br />
一个比较清楚的场景

下面q个假设的实际场景可以比较清楚的帮助我们理解q个问题Q?br />
a. 假设当当|?/a>上用户下单买了本书,q时数据库中有条订单号ؓ001的订单,其中有个status字段?#8217;有效’,表示该订单是有效的;
b. 后台理人员查询到这?01的订单,q且看到状态是有效?br />c. 用户发现下单的时候下错了Q于是撤销订单Q假设运行这样一条SQL: update order_table set status = ‘取消’ where order_id = 001;
d. 后台理人员׃在bq步看到状态有效的Q这Ӟ虽然用户在cq步已经撤销了订单,可是理人员q未h界面Q看到的订单状态还是有效的Q于是点?#8221;发货”按钮Q将该订单发到物部门,同时q行cM如下SQLQ将订单状态改成已发货:update order_table set status = ‘已发?#8217; where order_id = 001

观点1Q只有冲H非怸重的pȝ才需要悲观锁Q?br />分析Q这是更准确的说法;
“所有悲观锁的做法都适合于状态被修改的概率比较高的情况,具体是否合适则需要根据实际情况判断?#8221;Q表辄也是q个意思,不过说法不够准确Q的,之所以用悲观锁就是因Z个用h新同一条数据的概率高,也就是冲H比较严重的情况下,所以才用悲观锁?br />
观点2Q最后提交前作一ơselect for update查,然后再提交update也是一U乐观锁的做?br />分析Q这是更准确的说法;
的确Q这W合传统乐观锁的做法Q就是到最后再L查。但是wiki在解释悲观锁的做法的时候,’It is not appropriate for use in web application development.’Q?现在已经很少有悲观锁的做法了Q所以我自己这U二ơ检查的做法也归为悲观锁的变U,因ؓq在所有乐观锁里面Q做法和悲观锁是最接近的,都是先select for updateQ然后update

*****除了上面的观?和观?是更准确的说法,下面的所有观炚w是错误的***********

观点3Q这个问题的原因是因为数据库隔离U别是uncommitted readU别Q?br />分析Q这个观Ҏ错误的;
q个q程本n是在read committed隔离U别下发生的Q从a到d每一步,其是dq步Qƈ不是因ؓd了未提交的数据,仅仅是因为用L面没有刷新[事实上也不可能做自动hQ这L当于数据库一发生改变立刻要刷CQ这需要监听数据库了,昄q是单问题复杂化了];

观点4Q悲观锁是指一个用户在更新数据的时候,其他用户不能dq条记录Q也是updatedL叫悲观锁Q?br />分析Q这个观Ҏ错的Q?br />q在db2背景的开发中其常见Q因为db2默认是update会阻塞读Q但是这是各个数据库对读写的时候上锁的q发处理实现不一栗但q根本不是悲观锁乐观锁的区别。Oracle可以做到写不dM仅是因ؓ做了多版本ƈ发控?Multiversion concurrency control),
http://en.wikipedia.org/wiki/Multiversion_concurrency_control;但是在Oracle里面Q一样可以做乐观锁和悲观锁的控制。这本质上是应用层面的选择?br />
观点5QOracle实际上用的就是乐观锁
分析Q这个观Ҏ错的Q?br />前面说了QOracle的确可以做到写不d读,但是q不是悲观锁和乐观锁的问题。这是因为实C多版本ƈ发控制。按照wiki的定义,悲观锁和乐观锁是在应用层面选择的。Oracle的应用只要在W二步做了select for updateQ就是悲观锁的做法;况且Oracle在Q何隔ȝ别下Q除了分布式事务两阶D|交的短暂旉Q其他所有情况下都不存在写阻塞读的情况,如果按照q个观点的话那Oracle已经不能做悲观锁?_-

观点6Q不需要这么麻烦,只需要在dq步Q最后提交更新的时候再做一个普通的select查一下就可以Q[是double check的做法]
分析Q这个观Ҏ错的?br />q个做法其实?a target="_blank" rel="nofollow" style="color: #2d64b3; text-decoration: none;">http://www.hetaoblog.com/database-lost-update-pessimistic-lock/Q?#8217;3. 传统悲观锁做法的变?#8217;q节已经说明了,如果要这么做的话Q仍焉要在最后提交更新前double check的时候做一个select for updateQ?否则selectl束到update提交前的旉仍然有可能记录被修改Q?br />
观点7Q应该尽可能使用悲观锁;
分析Q这个观Ҏ错的Q?br />a. Ҏ悲观锁的概念Q用户在ȝ时?bq步)׃记录锁住,直到更新l束的时候才会将锁释放,所以整个锁的过E时间比较长Q?br />b. 另外Q悲观锁需要有一个持l的数据库连接,q在当今的web应用中已l几乎不存在Qwiki上也说了, 悲观?#8216;is not appropriate for use in web application development.’

所以,现在大部分应用都应该是乐观锁的;
转自Qhttp://zhidao.baidu.com/link?url=MUOUg59oz7-FKwz-zuUviGryfw9J4V63Pd2iWWErorwUpyeL85rznlmYaGDHXjH_ChywA3R1m9XNpx4k7RCCT3rNofjkCxIBYHdsvwr2bVy



2016-01-05 09:32 发表评论
]]>
Lock和synchronized (?http://www.tkk7.com/sliverfancy/archive/2015/10/27/427932.htmlTue, 27 Oct 2015 11:08:00 GMThttp://www.tkk7.com/sliverfancy/archive/2015/10/27/427932.htmlhttp://www.tkk7.com/sliverfancy/comments/427932.htmlhttp://www.tkk7.com/sliverfancy/archive/2015/10/27/427932.html#Feedback0http://www.tkk7.com/sliverfancy/comments/commentRss/427932.htmlhttp://www.tkk7.com/sliverfancy/services/trackbacks/427932.html    JDK1.5以后Q在锁机制方面引入了新的?LockQ在|上的说法都比较W统Q结合网上的信息和我的理解这里做个ȝ?nbsp;

    java现有的锁机制有两U实现方式,J.DK1.4前是通过synchronized实现QJDK1.5后加入java.util.concurrent.locks包下的各UlockQ以下简ULockQ?nbsp;

    先说说代码层的区别?nbsp;
    synchronizedQ在代码里,synchronizedcM“面向对象”Q修饰类、方法、对象?nbsp;
    LockQ不作ؓ修饰Q类?#8220;面向q程”Q在Ҏ中需要锁的时候lockQ在l束的时候unlockQ一般都在finally块里Q?nbsp;
例如代码Q?nbsp;

Java代码  收藏代码
  1. public void method1() {  
  2.     synchronized(this){//旧锁Q无需人工释放  
  3.         System.out.println(1);  
  4.     }  
  5. }  
  6.       
  7. public void method2() {  
  8.     Lock lock = new ReentrantLock();  
  9.     lock.lock();//上锁  
  10.     try{  
  11.         System.out.println(2);  
  12.     }finally{  
  13.         lock.unlock();//解锁  
  14.     }  
  15. }  

    其次说说性能?nbsp;
    相关的性能试|上已经有很多,q里也直接拿来主义,l出l论Q?nbsp;
    在ƈ发高是,luck性能优势很明显,在低q发Ӟsynchronized也能取得优势。具体的临界范围比较隑֮论,下面会讨论?nbsp;

    现在来分析它们具体的区别?nbsp;
    锁都?原子?的,也可以理解ؓ锁是否在使用的标讎ͼq且比较和设|这个标记的操作是原子性的Q不同硬件^C的jdk实现锁的相关Ҏ都是native的(比如park/unparkQ,所以不同^C锁的_度的{p些native的方法决定。所以网上经常可以看见的l论?#8220;Lock比synchronized有更_的原子操?#8221;说的也是nativeҎQ不得不感慨C才是g王道Q?nbsp;


下面l箋讨论怎么׃码层到native的过E?nbsp;
1、所有对象都自动含有单一的锁QJVM负责跟踪对象被加锁的ơ数。如果一个对象被解锁Q其计数变ؓ0。在dQ线E)W一ơ给对象加锁的时候,计数变ؓ1。每当这个相同的dQ线E)在此对象上获得锁Ӟ计数会递增?只有首先获得锁的dQ线E)才能l箋获取该对象上的多个锁。每当Q务离开Ӟ计数递减Q当计数?的时候,锁被完全释放。synchronized是Zq个原理Q同时synchronized靠某个对象的单一锁技术的ơ数来判断是否被锁,所以无需Q也不能Qh工干预锁的获取和释放。如果结合方法调用时的栈和框Ӟ如果Ҏ法的调用q程不熟悉徏议看?/span>http://wupuyuan.iteye.com/blog/1157548Q,不难推测出synchronized原理是基于栈中的某对象来控制一个框Ӟ所以对于synchronized有常用的优化是锁对象不锁Ҏ。实际上synchronized作用于方法时Q锁住的?#8220;this”Q作用于静态方?属性时Q锁住的是存在于怹带的CLASSQ相当于q个CLASS的全局锁,锁作用于一般对象时Q锁住的是对应代码块。在HotSpot中JVM实现中,锁有个专门的名字Q对象监视器?nbsp;


当多个线E同时请求某个对象监视器Ӟ对象监视器会讄几种状态用来区分请求的U程 
Contention ListQ所有请求锁的线E将被首先放|到该竞争队列,是个虚拟队列Q不是实际的Queue的数据结构?/span>
Entry ListQEntryList与ContentionList逻辑上同属等待队列,ContentionList会被U程q发讉KQؓ了降低对ContentionList队尾的争用,而徏立EntryList。,Contention List中那些有资格成ؓ候选h的线E被UdEntry List 
Wait SetQ那些调用waitҎ被阻塞的U程被放|到Wait Set 
OnDeckQQ何时L多只能有一个线E正在竞争锁Q该U程UCؓOnDeck 
OwnerQ获得锁的线E称为Owner 
!OwnerQ释N的线E?nbsp;

2、Lock不同于synchronized面向对象Q它Z栈中的框架而不是某个具体对象,所以Lock只需要在栈里讄锁的开始和l束Qlock和unlockQ的地方p了(人工必须标明Q,不用兛_框架大小对象的变化等{。这么做的好处是Lock能提供无条g的、可轮询的、定时的、可中断的锁获取操作Q相对于synchronized来说Qsynchronized的锁的获取是释放必须在一个模块里Q获取和释放的顺序必ȝ反,而Lock则可以在不同范围内获取释放,q且序无关。java.util.concurrent.locks下的锁类很类|依赖于java.util.concurrent.AbstractQueuedSynchronizerQ它们把所有的Lock接口操作都{嫁到SynccMQ这个类l承了AbstractQueuedSynchronizerQ它同时q包含子2个类QNonfairSync 和FairSync 从名字上可以看的出是Z实现公^和非公^性。AbstractQueuedSynchronizer中把所有的的请求线E构成一个队列(一样也是虚拟的Q,具体的实现可以参?/span>http://blog.csdn.net/chen77716/article/details/6641477#Q这里我׃复制了?nbsp;

3、从jdk的源代码来看QLock和synchronized的源码基本相同,区别主要在维护的同步队列上。再往下深I就CnativeҎ了?nbsp;

4、还有个改进我也惌下,其实很重要的。线E分dQwaitQ和非阻塞状态,d状态由操作pȝQlinux、windows{)完成Q当前一个被“?#8221;的线E执行完毕后Q有可能在后l的U程队列里还没分配出一个获取锁而被“唤醒”的非dU程Q即所有线E还都是d状态时Q就被系l调度(q入内核的线E是d的)Q这样会D内核在用h和内核态之间来回接换,严重影响锁的性能。在jdk1.6以前主要靠自旋锁来解冻I原理是在前一个线E结束后Q争用线E可以做一个空循环Ql占有CPUQ等待取锁的Z。当然这样做昄也是费旉Q只是在两种费中选取费的……  jdk1.6后引入了偏向锁,当线E第一ơ获得了监视对象Q之后让监视对象“偏向”q个U程Q之后的多次调用则可以避免CAS操作Q等于是|了一临时变量来记录位|(cM索引比较Q。详l的涉及到汇编指o了,我也没太深IӞ偏向锁性能优于自旋锁,但是q是没有辑ֈHotSpot认ؓ的最x_一个线E上下文切换的时_?nbsp;

    l合来看对于所有的高ƈ发情况,采用Lock加锁是最优选择Q但是由于历史遗留等问题Qsynchronized也还是不能完全被淘汰Q同Ӟ在低q发情况下,synchronized的性能q是比Lock好的?nbsp;

原帖地址Qhttp://wupuyuan.iteye.com/blog/1158655



2015-10-27 19:08 发表评论
]]>
再叙TIME_WAITQ{Q?/title><link>http://www.tkk7.com/sliverfancy/archive/2015/10/16/427786.html</link><dc:creator>秦</dc:creator><author>秦</author><pubDate>Fri, 16 Oct 2015 06:28:00 GMT</pubDate><guid>http://www.tkk7.com/sliverfancy/archive/2015/10/16/427786.html</guid><wfw:comment>http://www.tkk7.com/sliverfancy/comments/427786.html</wfw:comment><comments>http://www.tkk7.com/sliverfancy/archive/2015/10/16/427786.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/sliverfancy/comments/commentRss/427786.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/sliverfancy/services/trackbacks/427786.html</trackback:ping><description><![CDATA[<article id="post-316" post="" type-post="" status-publish="" format-standard="" hentry="" category-technical="" tag-linux="" tag-tcp"="" style="border-bottom-style: none; margin: 0px 0px 1.625em; padding: 4.875em 0px 0px; position: relative; color: #373737; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 24px; background-color: #ffffff;"><header style="margin: 0px auto; width: 584.265625px;"><h1>再叙TIME_WAIT</h1><br /></header><div style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px auto; outline: 0px; padding-top: 1.625em; vertical-align: baseline; width: 584.265625px;"><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">之所以vq样一个题目是因ؓ很久以前我曾l写q一介lTIME_WAIT?a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">文章</a>Q不q当时基本属于浅辄止,q没深入说明问题的来龙去脉,yq段旉反复被别人问到相关的问题Q让我觉得有必要全面ȝ一下,以备不时之需?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;"></p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">讨论前大家可以拿手头的服务器摸摸底,C「ss」比「netstat」快Q?/p><pre style="border: 0px; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 1.625em; outline: 0px; padding: 0.75em 1.625em; vertical-align: baseline; background-color: #f4f4f4; line-height: 1.5; overflow: auto;">shell> ss -ant | awk ' NR>1 {++s[$1]} END {for(k in s) print k,s[k]} '</pre><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">如果你只是想单独查询一下TIME_WAIT的数量,那么q可以更单一些:</p><pre style="border: 0px; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 1.625em; outline: 0px; padding: 0.75em 1.625em; vertical-align: baseline; background-color: #f4f4f4; line-height: 1.5; overflow: auto;">shell> cat /proc/net/sockstat</pre><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">我猜你一定被巨大无比的TIME_WAIT|络q接L吓到了!以我个h的经验,对于一台繁忙的Web服务器来_如果主要以短q接ZQ那么其TIME_WAIT|络q接L很可能会辑ֈ几万Q甚臛_几万。虽然一个TIME_WAIT|络q接耗费的资源无非就是一个端口、一点内存,但是架不住基数大Q所以这始终是一个需要面对的问题?/p><h2>Z么会存在TIME_WAITQ?/h2><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">TCP在徏立连接的时候需要握手,同理Q在关闭q接的时候也需要握手。ؓ了更直观的说明关闭连接时握手的过E,我们引用?a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">The TCP/IP Guide</a>」中?a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">例子</a>Q?/p><div class="cgygwqs" id="attachment_318" alignnone"="" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0.4em 0px 1.625em; outline: 0px; padding: 9px; vertical-align: baseline; background-color: #eeeeee; max-width: 96%; width: 676px;"><a style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;"><img wp-image-318"="" src="http://huoding.com/wp-content/uploads/2013/12/tcp_close.png" alt="TCP Close" width="666" height="556" style="border: 1px solid #eeeeee; max-width: 97.5%; height: auto; width: auto; display: block; margin: -2px 0px 0px -2px; padding: 6px;" /></a><p style="border: 0px; font-family: Georgia, serif; font-size: 12px; font-style: inherit; margin: 0px 0px 0.6em; outline: 0px; padding: 10px 0px 5px 40px; vertical-align: baseline; color: #666666; position: relative;">TCP Close</p></div><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">因ؓTCPq接是双向的Q所以在关闭q接的时候,两个方向各自都需要关闭。先发FIN包的一Ҏ行的是主动关闭;后发FIN包的一Ҏ行的是被动关闭。主动关闭的一方会q入TIME_WAIT状态,q且在此状态停留两倍的<a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">MSL</a>旉?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">I插一点MSL的知识:MSL指的是报文段的最大生存时_如果报文D在|络zd了MSL旉Q还没有被接Ӟ那么会被丢弃。关于MSL的大,<a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">RFC 793</a>协议中给出的是两分钟Q不q实际上不同的操作系l可能有不同的设|,以LinuxZQ通常是半分钟Q两倍的MSL是一分钟Q也是60U,q且q个数值是编码在<a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">内核</a>中的Q也是说除非你重新~译内核Q否则没法修改它Q?/p><pre style="border: 0px; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 1.625em; outline: 0px; padding: 0.75em 1.625em; vertical-align: baseline; background-color: #f4f4f4; line-height: 1.5; overflow: auto;">#define TCP_TIMEWAIT_LEN (60*HZ)</pre><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">如果每秒的连接数是一千的话,那么一分钟可能会产生六万个TIME_WAIT?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">Z么主动关闭的一方不直接q入CLOSED状态,而是q入TIME_WAIT状态,q且停留两倍的MSL旉呢?q是因ؓTCP是徏立在不可靠网l上的可靠的协议。例子:d关闭的一Ҏ到被动关闭的一方发出的FIN包后Q回应ACK包,同时q入TIME_WAIT状态,但是因ؓ|络原因Q主动关闭的一方发送的q个ACK包很可能延迟Q从而触发被动连接一斚w传FIN包。极端情况下Q这一M回,是两倍的MSL旉。如果主动关闭的一方蟩qTIME_WAIT直接q入CLOSEDQ或者在TIME_WAIT停留的时长不两倍的MSLQ那么当被动关闭的一Ҏ先发出的延迟包到辑֐Q就可能出现cM下面的问题:</p><ul style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em 2.5em; outline: 0px; padding: 0px; vertical-align: baseline; list-style: square;"><li style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">旧的TCPq接已经不存在了Q系l此时只能返回RST?/li><li style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">新的TCPq接被徏立v来了Qgq包可能q扰新的q接</li></ul><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">不管是哪U情况都会让TCP不再可靠Q所以TIME_WAIT状态有存在的必要性?/p><h2>如何控制TIME_WAIT的数量?</h2><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">从前面的描述我们可以得出q样的结论:TIME_WAITq东西没有的话不行,不过太多可能也是个麻烦事。下面让我们看看有哪些方法可以控制TIME_WAIT数量Q这里只说一些常规方法,另外一些诸如SO_LINGER之类的方法太q偏门,略过不谈?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">ip_conntrack</strong>Q顾名思义是跟踪q接。一旦激zM此模块,p在系l参数里发现很多用来控制|络q接状态超时的讄Q其中自然也包括TIME_WAITQ?/p><pre style="border: 0px; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 1.625em; outline: 0px; padding: 0.75em 1.625em; vertical-align: baseline; background-color: #f4f4f4; line-height: 1.5; overflow: auto;">shell> modprobe ip_conntrack shell> sysctl net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait</pre><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">我们可以试~小它的讄Q比如十U,甚至一U,具体讄成多合适取决于|络情况而定Q当然也可以参考相关的<a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">案例</a>。不q就我的个h意见来说Qip_conntrack引入的问题比解决的还多,比如性能会大q下降,所以不使用?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">tcp_tw_recycle</strong>Q顾名思义是回收TIME_WAITq接。可以说q个内核参数已经变成了大众处理TIME_WAIT的万金aQ如果你在网l上搜烦TIME_WAIT的解x案,十有八九会推荐设|它Q不q这里隐藏着一个不易察觉的<a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">陷阱</a>Q?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">当多个客L通过NAT方式联网q与服务端交互时Q服务端看到的是同一个IPQ也是说对服务端而言q些客户端实际上{同于一个,可惜׃q些客户端的旉戛_能存在差异,于是乎从服务端的视角看,便可能出现时间戳错ؕ的现象,q而直接导致时间戳的数据包被丢弃。参考:<a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">tcp_tw_recycle和tcp_timestampsDconnectp|问题</a>?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">tcp_tw_reuse</strong>Q顾名思义是复用TIME_WAITq接。当创徏新连接的时候,如果可能的话会考虑复用相应的TIME_WAITq接。通常认ؓ「tcp_tw_reuse」比「tcp_tw_recycle」安全一些,q是因ؓ一来TIME_WAIT创徏旉必须过一U才可能会被复用Q二来只有连接的旉x递增的时候才会被复用?a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">官方文档</a>里是q样说的Q如果从协议视角看它是安全的Q那么就可以使用。这直就是外交辞令啊Q按我的看法Q如果网l比较稳定,比如都是内网q接Q那么就可以试使用?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">不过需要注意的是在哪里使用Q既然我们要复用q接Q那么当然应该在q接的发h使用Q而不能在被连接方使用。D例来_客户端向服务端发起HTTPhQ服务端响应后主动关闭连接,于是TIME_WAIT便留在了服务端,此类情况使用「tcp_tw_reuse」是无效的,因ؓ服务端是被连接方Q所以不存在复用q接一说。让我们延一Ҏ看,比如说服务端是PHPQ它查询另一个MySQL服务端,然后d断开q接Q于是TIME_WAITp在了PHP一侧,此类情况下用「tcp_tw_reuse」是有效的,因ؓ此时PHP相对于MySQL而言是客LQ它是连接的发v方,所以可以复用连接?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">说明Q如果用tcp_tw_reuseQ请Ȁztcp_timestampsQ否则无效?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">tcp_max_tw_buckets</strong>Q顾名思义是控制TIME_WAITL?a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">官网文档</a>说这个选项只是ZL一些简单的DoSdQ^怸要h为的降低它。如果羃了它,那么pȝ会将多余的TIME_WAIT删除掉,日志里会昄Q「TCP: time wait bucket table overflow」?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">需要提醒大家的是物极必反,曄看到有h把「tcp_max_tw_buckets」设|成0Q也是说完全抛弃TIME_WAITQ这有些冒险了Q用一句围谚语来_入界宜缓?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">…</p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">有时候,如果我们换个角度ȝ问题Q往往能得到四两拨千斤的效果。前面提到的例子Q客L向服务端发vHTTPhQ服务端响应后主动关闭连接,于是TIME_WAIT便留在了服务端。这里的关键在于d关闭q接的是服务端!在关闭TCPq接的时候,先出手的一Ҏ定逃不开TIME_WAIT的宿命,套用一句歌词:把我的悲伤留l自己,你的丽让你带走。如果客L可控的话Q那么在服务端打开<a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">KeepAlive</a>Q尽可能不让服务端主动关闭连接,而让客户端主动关闭连接,如此一来问题便q刃而解了?/p><p style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;">参考文档:</p><ol style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px 0px 1.625em 2.5em; outline: 0px; padding: 0px; vertical-align: baseline; list-style-position: initial; list-style-image: initial;"><li style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">tcp短连接TIME_WAIT问题解决Ҏ大全Q?Q?#8212;—高屋建瓴</a></li><li style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">tcp短连接TIME_WAIT问题解决Ҏ大全Q?Q?#8212;—SO_LINGER</a></li><li style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">tcp短连接TIME_WAIT问题解决Ҏ大全Q?Q?#8212;—tcp_tw_recycle</a></li><li style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">tcp短连接TIME_WAIT问题解决Ҏ大全Q?Q?#8212;—tcp_tw_reuse</a></li><li style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a target="_blank" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">tcp短连接TIME_WAIT问题解决Ҏ大全Q?Q?#8212;—tcp_max_tw_buckets</a></li></ol></div><footer style="color: #666666; clear: both; font-size: 12px; line-height: 18px; margin: 0px auto; width: 584.265625px;">此条目由<a style="border: 0px; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">老王</a>发表?a rel="category tag" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">Technical</a>分类目录Qƈ贴了<a rel="tag" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">Linux</a>?a rel="tag" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">TCP</a>标签。将<a title="铑֐再叙TIME_WAIT的固定链? rel="bookmark" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: #1982d1; text-decoration: none;">固定链接</a>加入收藏夏V?/footer></article><div class="qegucgi" id="comments" style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; margin: 0px; outline: 0px; vertical-align: baseline; color: #373737; line-height: 24px; background-color: #ffffff;"><h2>转自<span style="font-size: 15px;">http://huoding.com/2013/12/31/316</span></h2></div><img src ="http://www.tkk7.com/sliverfancy/aggbug/427786.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/sliverfancy/" target="_blank">秦</a> 2015-10-16 14:28 <a href="http://www.tkk7.com/sliverfancy/archive/2015/10/16/427786.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>|络安全与维?/title><link>http://www.tkk7.com/sliverfancy/archive/2015/10/16/427783.html</link><dc:creator>秦</dc:creator><author>秦</author><pubDate>Fri, 16 Oct 2015 05:45:00 GMT</pubDate><guid>http://www.tkk7.com/sliverfancy/archive/2015/10/16/427783.html</guid><wfw:comment>http://www.tkk7.com/sliverfancy/comments/427783.html</wfw:comment><comments>http://www.tkk7.com/sliverfancy/archive/2015/10/16/427783.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/sliverfancy/comments/commentRss/427783.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/sliverfancy/services/trackbacks/427783.html</trackback:ping><description><![CDATA[<div>1、常规网l访问限Ӟ<br /> a、线上运营设备的SSH端口不允许绑定在公网IP地址上,开发只能登录开发机然后通过内网dq些服务器;<br /> b、开发机、测试机的SSH端口可以l定在公|IP地址上,SSH端口(22)可以考虑改ؓ非知名端口;<br /> c、线上运营设备、开发机、测试机的防火墙配置Q公|只?0(HTTP)?080(HTTP)?43(HTTPS)、SSH端口(仅限开发机、测试机)对外授权讉KQ?br /> d、线上运营设备、开发机、测试机除第c点以外所有服务端口禁止绑定在公网IP地址上,其?306端口(MySQL)Q?br />2、DB保护Q?br /> a、DB服务器不允许配置公网IPQ或用防火墙全部止公网讉KQ;<br /> b、DB的root账户不用于业务访问,回收集中理Q开放普通̎户做业务逻辑讉KQ对不同安全要求的库表用不同的̎户密码访问;<br /> c、程序不要把DB讉K的̎户密码写到配|文件中Q写入代码或启动时远E到配置中心拉取Q此Ҏ比较重,可暂不考虑Q?br /> d、另QDB备䆾文g可以考虑做加密处理;<br />3、系l安全:<br /> a、设备的root密码回收集中理Q给开发提供普通用户帐P<br /> b、密码需要定期修改,有强度要求;<br />4、业务访问控Ӟ<br /> a、业务服务逻辑和运营^収ͼ量不要提供对用戯和订单表的批量访问接口,如果q营q_实有这L需求,需要对特定账户做授权;<br />安全的代h不方ѝ效率会下降Q需要寻扑^衡点?nbsp;</div><img src ="http://www.tkk7.com/sliverfancy/aggbug/427783.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/sliverfancy/" target="_blank">秦</a> 2015-10-16 13:45 <a href="http://www.tkk7.com/sliverfancy/archive/2015/10/16/427783.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux pȝ挂蝲数据盘(阉K云)?/title><link>http://www.tkk7.com/sliverfancy/archive/2015/04/30/424791.html</link><dc:creator>秦</dc:creator><author>秦</author><pubDate>Thu, 30 Apr 2015 08:08:00 GMT</pubDate><guid>http://www.tkk7.com/sliverfancy/archive/2015/04/30/424791.html</guid><wfw:comment>http://www.tkk7.com/sliverfancy/comments/424791.html</wfw:comment><comments>http://www.tkk7.com/sliverfancy/archive/2015/04/30/424791.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/sliverfancy/comments/commentRss/424791.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/sliverfancy/services/trackbacks/424791.html</trackback:ping><description><![CDATA[<p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">转自<a >http://www.witwebs.com/aliyun-mount-init/</a><br />阉K云的服务器,国内讉K速度Q稳定性一直都是不错的。至我在用的q程中,q未到什么问题。我自己在使用Lq程的安装和环境配置做一个详l的介绍。仅供新手朋友参考!当我们在购买到阿里云服务器之后,会获得相应的IP地址和管理密码?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">主要介绍Linux的数据盘的格式化和挂载?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">大致步骤是: 登陆Linux > 查看盘状况 > 分区数据?nbsp;> 格式化数据盘 >  挂蝲新分?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">会用到的命令如下:</p> <blockquote style="border-top: rgb(214,233,198) 1px solid; border-right: rgb(214,233,198) 1px solid; white-space: normal; word-spacing: 0px; border-bottom: rgb(214,233,198) 1px solid; text-transform: none; color: rgb(85,85,85); padding-bottom: 5px; text-align: left; padding-top: 10px; font: 12px/20px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 15px; margin: 15px auto; border-left: rgb(214,233,198) 3px solid; letter-spacing: normal; padding-right: 15px; background-color: rgb(244,255,239); text-indent: 0px; -webkit-text-stroke-width: 0px"> <p style="font-size: 12px; font-weight: 300; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 5px; line-height: 20px; padding-right: 0px">df -h   查看已挂载硬盘信?/p> <p style="font-size: 12px; font-weight: 300; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 5px; line-height: 20px; padding-right: 0px"><span style="text-indent: 24px">fdisk -l     </span><span style="text-indent: 24px">查看盘信息Q未挂蝲的也会列出来</span></p> <p style="font-size: 12px; font-weight: 300; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 5px; line-height: 20px; padding-right: 0px">fdisk /dev/xvdb     Ҏ据盘q行分区Q回车之后,l箋<span id="kskiasi" class="Apple-converted-space"> </span><span style="text-indent: 24px">Ҏ提示Q依ơ输?#8221;n” ,”</span><span style="text-indent: 24px">p”,“1”,</span><span style="text-indent: 24px">两次回RQ?/span><span style="text-indent: 24px">“wq”, </span><span style="text-indent: 24px">分区开始了Q很快就会完?/span></p> <p style="font-size: 12px; font-weight: 300; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 5px; line-height: 20px; padding-right: 0px">mkfs .ext3 /dev/xvdb1  命oҎ分区q行格式?/p> <p style="font-size: 12px; font-weight: 300; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 5px; line-height: 20px; padding-right: 0px">echo ‘/dev/xvdb1  /www ext3    defaults    0  0′ >> /etc/fstab   d分区信息</p> <p style="font-size: 12px; font-weight: 300; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 5px; line-height: 20px; padding-right: 0px">mount -a     命o挂蝲新分?/p></blockquote> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"> </p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">1Q通过Linux   SSH 登陆软g登陆你的linux。登陆之后输入命令:df -lh 的界面如图:</p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"><a title="" style="text-decoration: underline; color: rgb(66,139,202)" data-original-title=""><img class="alignnone size-full wp-image-307" style="max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; border-left: 0px" alt="捕获" src="http://www.witwebs.com/wp-content/uploads/2014/03/%E6%8D%95%E8%8E%B7.jpg" width="450" height="76" /></a></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">2Q输入命令: fdisk -l 查看盘状况Q可以看到有数据盘: /dev/xvdb  而用df没有查看到这个磁盘。所以需要另外挂载?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"><img class="alignnone size-full wp-image-305" style="max-width: 100%; border-top: rgb(221,221,221) 0px; height: auto; border-right: rgb(221,221,221) 0px; vertical-align: middle; border-bottom: rgb(221,221,221) 0px; border-left: rgb(221,221,221) 0px; background-color: rgb(251,251,251)" alt="2" src="http://www.witwebs.com/wp-content/uploads/2014/03/2.jpg" width="536" height="325" suffix_src="http://www.witwebs.com/wp-content/uploads/2014/03/2.jpg" suffix_360="3cdd8dfeea20962034f63b0a0411e9b4" /></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">3Q?  ?fdisk  /dev/xvdb Ҏ据盘q行分区。根据提C,输入 nQ?pQ?1Q?回RQ回车, wq?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">完成之后Q再?nbsp;fdisk -lQ就可以看到昄的信息和之前有不同了?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"><a title="" style="text-decoration: underline; color: rgb(66,139,202)" data-original-title=""><img class="alignnone size-full wp-image-304" style="max-width: 100%; border-top: rgb(221,221,221) 0px; height: auto; border-right: rgb(221,221,221) 0px; vertical-align: middle; border-bottom: rgb(221,221,221) 0px; border-left: rgb(221,221,221) 0px; background-color: rgb(251,251,251)" alt="3" src="http://www.witwebs.com/wp-content/uploads/2014/03/3.jpg" width="706" height="813" suffix_src="http://www.witwebs.com/wp-content/uploads/2014/03/3.jpg" suffix_360="ea3780948f18bfdc30b0e5d9690d2700" /></a></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"> </p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">4Q格式化盘? mkfs .ext3 /dev/xvdb1 ,格式化磁盘。完成之后,可以来挂蝲分区了?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"><a title="" style="text-decoration: underline; color: rgb(66,139,202)" data-original-title=""><img class="alignnone size-full wp-image-303" style="max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; border-left: 0px" alt="4" src="http://www.witwebs.com/wp-content/uploads/2014/03/4.jpg" width="693" height="726" suffix_src="http://www.witwebs.com/wp-content/uploads/2014/03/4.jpg" suffix_360="4759ec09ec8375473d2af894856e8eb9" /></a></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"> </p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">5Q?挂蝲分区Q首先徏立一个目录用来挂载分区。比如: mkdir  /www</p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">然后把分Z息加入到fstab中:一ơ执行:</p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">echo ‘/dev/xvdb1  /www ext3    defaults    0  0′ >> /etc/fstab   d分区信息</p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">mount -a     命o挂蝲新分?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">最后用 df -h 命o查看Q将会发现数据盘?/p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px"><a title="" style="text-decoration: underline; color: rgb(217,83,79); outline-width: 0px; outline-style: none; outline-color: invert" data-original-title=""><img class="alignnone size-full wp-image-302" style="max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; border-left: 0px" alt="5" src="http://www.witwebs.com/wp-content/uploads/2014/03/5.jpg" width="1021" height="506" suffix_src="http://www.witwebs.com/wp-content/uploads/2014/03/5.jpg" suffix_360="88c44177faa11a7001bd03d342c73a40" /></a></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); text-align: left; font: 14px/25px 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0px 0px 15px; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px">OKQ希望能帮到各位?/p><img src ="http://www.tkk7.com/sliverfancy/aggbug/424791.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/sliverfancy/" target="_blank">秦</a> 2015-04-30 16:08 <a href="http://www.tkk7.com/sliverfancy/archive/2015/04/30/424791.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>redis安装Q原创)http://www.tkk7.com/sliverfancy/archive/2015/04/28/424721.htmlTue, 28 Apr 2015 03:13:00 GMThttp://www.tkk7.com/sliverfancy/archive/2015/04/28/424721.htmlhttp://www.tkk7.com/sliverfancy/comments/424721.htmlhttp://www.tkk7.com/sliverfancy/archive/2015/04/28/424721.html#Feedback0http://www.tkk7.com/sliverfancy/comments/commentRss/424721.htmlhttp://www.tkk7.com/sliverfancy/services/trackbacks/424721.html1、需要先安装gcc和tcl
yum install gcc
yum install tcl

2、下载ƈ安装redis
cd /opt
wget http://download.redis.io/releases/redis-3.0.0.tar.gz

tar -zxvf /opt/redis-3.0.0.tar.gz

cd /opt/redis-3.0.0
make
make test
make PREFIX=/opt/redis-3.0.0 install

注:PREFIX一定要大写Q装好后Q会生成/opt/redis-3.0.0/bin目录Q里面有启动命o之类的文件?br />
3、启动与关闭
redis启动
/opt/redis-3.0.0/bin/redis-server /opt/redis-3.0.0/redis.conf
redis关闭
/opt/redis-3.0.0/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown
客户端启?br />
/opt/redis-3.0.0/bin/redis-cli
set name test
get name
4、参C?/div>
/opt/redis-3.0.0/redis.conf文g修改

#后台q行Q可以ctrl+c不至于退?br />
daemonize yes

关于错误提示
Q?Q编?etc/sysctl.conf Q最下面加一行vm.overcommit_memory=1Q然后sysctl -p 佉K|文件生?/div>
Q?Qsysctl vm.overcommit_memory=1

注:如果使用了云服务器,要记得打开6379端口Q否则无法远E访?br />


2015-04-28 11:13 发表评论
]]>linux上整合apache和svnQ多库)原创转蝲h明出?/title><link>http://www.tkk7.com/sliverfancy/archive/2015/03/30/423965.html</link><dc:creator>秦</dc:creator><author>秦</author><pubDate>Mon, 30 Mar 2015 09:28:00 GMT</pubDate><guid>http://www.tkk7.com/sliverfancy/archive/2015/03/30/423965.html</guid><wfw:comment>http://www.tkk7.com/sliverfancy/comments/423965.html</wfw:comment><comments>http://www.tkk7.com/sliverfancy/archive/2015/03/30/423965.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/sliverfancy/comments/commentRss/423965.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/sliverfancy/services/trackbacks/423965.html</trackback:ping><description><![CDATA[<div><div>1、svnadmin create /opt/svn/yiss/app/ios1、apache里的httpd.conf配置如下Q?/div><div>每个库单?/div><div><Location /yiss/app/ios>#q个是ios目url上的讉K上下文,对应http://IP/yiss/app/ios/</div><div>DAV svn</div><div>SVNPath /opt/svn/yiss/app/ios#q个是svn库的l对路径</div><div>AuthType Basic#校验方式</div><div>AuthName "please input username/password"#提示信息</div><div>AuthUserFile  /opt/svn/passwd#密码文gl对路径</div><div>AuthzSVNAccessFile /opt/svn/authz#权限文gl对路径</div><div>Require valid-user</div><div></Location></div><div><Location /yiss/app/android>#安卓目讉K上下?/div><div>DAV svn</div><div>SVNPath /opt/svn/yiss/app/android</div><div>AuthType Basic</div><div>AuthName "please input username/password"</div><div>AuthUserFile  /opt/svn/passwd</div><div>AuthzSVNAccessFile /opt/svn/authz</div><div>Require valid-user</div><div></Location></div><div><Location /yiss/web/buildscript></div><div>DAV svn</div><div>SVNPath /opt/svn/yiss/web/buildscript</div><div>AuthType Basic</div><div>AuthName "please input username/password"</div><div>AuthUserFile  /opt/svn/passwd</div><div>AuthzSVNAccessFile /opt/svn/authz</div><div>Require valid-user</div><div></Location></div><div></div><div>2、首先要创徏/opt/svn/yiss/app目录?opt/svn/yiss/web</div><div>然后用命令创建svn?/div><div>svnadmin create /opt/svn/yiss/app/ios</div><div>svnadmin create /opt/svn/yiss/app/android</div><div>svnadmin create /opt/svn/yiss/web/buildscript</div><div></div><div>3、创建apache用户和密码,会提C重复输?ơ确认。想改密码就多次输入Q以最后一ơ输入的为准?/div><div>htpasswd /opt/svn/passwd wxq</div><div>htpasswd /opt/svn/passwd caowei</div><div>......</div><div></div><div>4、配|权限组/opt/svn/authz</div><div>[groups]</div><div>admin=wxq</div><div>web=caowei,luocan,houlei,gengzhuo,huangwei,wuhaiying,leo</div><div>app=ssh,golden,shawn,leo</div><div></div><div>#adminl用户可以访问所有目?/div><div>[/]</div><div>@admin=rw</div><div>#ios,android,srv,doc,buildscriptq些都是库名Q这里创Z3个库</div><div>[ios:/]</div><div>@app=rw</div><div>[android:/]</div><div>@app=rw</div><div>[buildscript:/]</div><div>@admin=rw</div><div></div><div>5、给目录及子目录授权Q否则会?03forbidden无权?/div><div>chmod 777 /opt/svn -R</div><div></div><div>6、重启svnQ启动的时候要以根启动Q如果以某个svn库启动,则其他库无法启动?/div><div>killall svnserve</div><div>svnserve -d -r /opt/svn/yiss</div><div></div><div>7、重启apache</div><div>/opt/apache/bin/apachectl restart</div><div>8、浏览测?/div><div>http://115.231.94.x/yiss/app/ios/</div><div>http://115.231.94.x/yiss/app/android/</div><div>http://115.231.94.x/yiss/web/buildscript/</div></div><img src ="http://www.tkk7.com/sliverfancy/aggbug/423965.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/sliverfancy/" target="_blank">秦</a> 2015-03-30 17:28 <a href="http://www.tkk7.com/sliverfancy/archive/2015/03/30/423965.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://yinyinai155.com" target="_blank">һ˿wwwƵ߹ۿ</a>| <a href="http://changfafangzhi.com" target="_blank">޾ƷŮһ</a>| <a href="http://yuduruizhi.com" target="_blank">һƵ</a>| <a href="http://www676617.com" target="_blank">ƵĻ</a>| <a href="http://amjt9.com" target="_blank">޸Ļ</a>| <a href="http://miliwo.com" target="_blank">ɫƵվ</a>| <a href="http://519vip.com" target="_blank">պĻò</a>| <a href="http://shlamore.com" target="_blank">Ůcaoվѿ߿</a>| <a href="http://hmjx-tape.com" target="_blank">ŷ޳˾Ʒ㽶</a>| <a href="http://bjhuicui.com" target="_blank">ѹۿ</a>| <a href="http://sitefmns.com" target="_blank">91鶹Բ߹ۿ </a>| <a href="http://www398ph.com" target="_blank">þþƷAV鶹</a>| <a href="http://ebanyou.com" target="_blank">AëƬѹۿվ</a>| <a href="http://4794d.com" target="_blank">༤ۺ͵ͼ</a>| <a href="http://www3ratcom.com" target="_blank">鴤һһgifƵ</a>| <a href="http://theav25.com" target="_blank">޾Ʒa</a>| <a href="http://715686.com" target="_blank">Ʒһʽâ </a>| <a href="http://jkc178.com" target="_blank">ѻɫƬվ</a>| <a href="http://fsdyzs.com" target="_blank">޾Ʒ </a>| <a href="http://www-070755.com" target="_blank">Ӱһ޹ģƷһ</a>| <a href="http://ebuy668.com" target="_blank">ҹ޾Ʒ</a>| <a href="http://spxingyiquan.com" target="_blank">Ѵվ߹</a>| <a href="http://zz773.com" target="_blank">˾þô߽Ƶ</a>| <a href="http://fz166.com" target="_blank">޺ݺۺϾþ</a>| <a href="http://wwwtoutoulu.com" target="_blank">Ļ߳վ</a>| <a href="http://0359jgyy.com" target="_blank">ۺavһ</a>| <a href="http://ahsuibao.com" target="_blank">ÿ߹ۿapp</a>| <a href="http://fdhkauto.com" target="_blank">׾Ʒһ</a>| <a href="http://xjtuykw.com" target="_blank">ٸ36P</a>| <a href="http://xjtuykw.com" target="_blank">ˊ]Ƭѹۿ</a>| <a href="http://nkldj.com" target="_blank">߹ۿ԰Ƶ</a>| <a href="http://127ht.com" target="_blank">AVһ</a>| <a href="http://7a37.com" target="_blank">ձһ߹ۿ</a>| <a href="http://eoeoyui.com" target="_blank">һ߲</a>| <a href="http://jdvgo.com" target="_blank">޳߲va</a>| <a href="http://77110524.com" target="_blank">67paoǿ</a>| <a href="http://newbuybay.com" target="_blank">˳վ999þþۺ</a>| <a href="http://hongyue8.com" target="_blank">һƵ</a>| <a href="http://bovch.com" target="_blank">޾ƷƵ</a>| <a href="http://peipeixiu.com" target="_blank">͵͵޸</a>| <a href="http://cnkaiertong.com" target="_blank">AVþƷ鵺̳</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>