学习整理

一、GIT 学习与整理

1、 git log �Cstat  可以看到每次提交都修改了哪些文件
   有时候查看的时候需要显示全路径 git log �Cstat-name-width=100
2、 git show  06b91520bc66715415315165b892d187c066659f  filename  可以看到每次具体做了哪些修改
3、 merge操作一般从本地分枝merge到master分枝之后 再提交到远端master
   如

4、在同一台机器可以直接pull对方的代码如  git pull /home/user/code master


二、关于 tcp_timestamps和tcp_tw_recycle 导致TCP连接有问题

RFC1323中有如下一段描述:

An additional mechanism could be added to the TCP , a per - host cache of the last timestamp received from any connection . This value could then be used in the PAWS mechanism to reject old duplicate segments from earlier incarnations of the connection , if the timestamp clock can be guaranteed to have ticked at least once since the old connection was open . This would require that the TIME - WAIT delay plus the RTT together must be at least one tick of the senders timestamp clock . Such an extension is not part of the proposal of this RFC .

大概意思是说TCP有一种行为,可以缓存每个连接最新的时间戳,后续请求中如果时间戳小于缓存的时间戳,即视为无效,相应的数据包会被丢弃。


Linux是否启用这种行为取决于tcp_timestamps和tcp_tw_recycle,因为tcp_timestamps缺省就是开启的,所以当tcp_tw_recycle被开启后,实际上这种行为就被激活了。

现在很多公司都用LVS做负载均衡,通常是前面一台LVS,后面多台后端服务器,以NAT方式构建,当请求到达LVS后,它修改地址数据后便转发给后端服务器,但不会修改时间戳数据,对于后端服务器来说,请求的源地址就是LVS的地址,加上端口会复用,所以从后端服务器的角度看,原本不同客户端的请求经过LVS的转发,就可能会被认为是同一个连接,加之不同客户端的时间可能不一致,所以就会出现时间戳错乱的现象,于是后面的数据包就被丢弃了,具体的表现通常是是客户端明明发送的SYN,但服务端就是不响应ACK,还可以通过下面命令来确认数据包不断被丢弃的现象:



你可能感兴趣的:(linux)