Friday, September 12, 2008

Google出世(演义)

早期的搜索引擎,基本原理是关键词匹配。
http://www.ccthere.com/article/1751696譬如用户输入关键词"奥运会",搜索引擎的任务是查找与奥运会相关的网页。如果恰好有一篇网页,内容无他,"奥运会,奥运会,。。。",连说100遍。早 期的搜索引擎肯定把这个网页放在结果的首页,说不定还置顶,因为, 1. 网页内容中,"奥运会"这个关键词出现的频率非常高,2. 没有出现与奥运会不相干的内容。
早期搜索引擎的问题很明显,但是如何解决,却是仁者见仁智者见智。
http://www.ccthere.com/article/17516961996年,刚刚入学Stanford计算机系的Larry Page和Sergey Brin哥俩儿觉得,提高搜索引擎的准确性,或许可以从网页与网页之间的相互链接入手。譬如,网页A中提到奥运会时,给了一个链接,指向网页甲,那么网页 甲的内容很可能与奥运会相关。如果不仅网页A有这样的链接,而且网页B,C,D等等,都有类似的链接,那么网页甲的内容与奥运会相关的可能性就极高。
批评者说,这不是三人成虎吗?Larry心里也没谱,就跑去问他的导师,Terry Winograd。
http://www.ccthere.com/article/1751696导师外形很像爱因斯坦,想了一想,说,"先把Stanford校园网内所有网页收集下来,验证一下你们的想法。然后扩大到更大范围,再验证一下。如果验证 的结果不错,就把全世界互联网的所有网页,统统收集下来,做一个搜索引擎,上线,让全世界的人用,让全世界的人都来验证你们的猜想。"
两年后,1998年,Google上线了,三人成虎的猜想被实践证明是行之有效的。
http://www.ccthere.com/article/1751696Terry导师大手一挥,"把全世界互联网的所有网页,统统收集下来",可把Larry和Sergey哥俩儿忙坏了。互联网上有多少网页,统统收集下来, 需要占用多少硬盘空间?Larry和Sergey当时是博士班一年级学生,囊中羞涩,买不起那么多设备,没办法,开始四处讨钱。
托了七大姑八大姨,拐弯抹角找到了一个大款,名叫Andy Bechtolsheim。此公早年在CMU拿了EE的硕士后,跑到Stanford读CS/EE博士。没来得及拿到博士学位,就伙同Scott McNealy和Vinod Khosla,下海开公司去了,这个公司就是大名鼎鼎的SUN Microsystems。 Scott McNealy任SUN的CEO长达20多年,而Andy Bechtolsheim功成身退,跳出SUN自己开了一个小公司,后来这个小公司卖给了Cisco。
http://www.ccthere.com/article/1751696坊间传说,Larry和Sergey拜访Andy的时候,Andy正在电话上。冗长的电话,Larry和Sergey两个小伙子血气方刚,哪里耐得住这份性子,抬腿告辞。因为是朋友介绍,Andy有点过不去,就追到门口。问,"二位上门,有何需求?"
Larry和Sergey铁青着脸,说,"也没什么大事,就是想找点钱,做一个大规模文件系统。"
http://www.ccthere.com/article/1751696Andy问,"多大规模呢?存储什么数据?"
Larry和Sergey,"打算把互联网上所有网页都下载,然后建一个搜索索引。"
http://www.ccthere.com/article/1751696Andy,"把互联网上所有网页统统下载?!需要多大空间?几个Giga不行吧,几个Tera也不行吧,几个Peta,几个Zetta?。。。嗯,我看几个Googol也许才能撑得住。知道Googol吗?就是10的100次方,就是一个1后面拖100个0!"
Larry和Sergey,"是的,我们的确就是打算处理海量数据。"
http://www.ccthere.com/article/1751696Andy,"你们打算怎么做?买个EMC?那玩意儿很贵的哟,我可没那么多钱让你们烧。"
Larry和Sergey,"我们打算自己动手,用一堆PC做一个分布式集群。"
http://www.ccthere.com/article/1751696Andy,"PC?死机了怎么办?干嘛不用工作站,干嘛不用NFS?"
Larry和Sergey,"工作站比PC贵太多,NFS的不是很切合我们的需要。。。"
http://www.ccthere.com/article/1751696Andy挤出一点笑容,"好吧,小伙子们,给朋友一个面子,而且年轻人探险也是值得鼓励的。给你们10万吧,省着点花啊!"
Andy掏出支票本,一边签名一边问,"你们的公司叫什么?"
http://www.ccthere.com/article/1751696Larry和Sergey面面相觑,那时候他们还没来得及给公司取名。"要不就叫Googol吧?","Googol不太好拼写,要不改一改,叫Google吧。" Google这个名字从此诞生。

Monday, September 1, 2008

如何保持SSH链接不因IDLE时间过长而中断?

1. 修改/etc/ssh/sshd_config:
ClientAliveInterval 60
2. 重启SSH服务:
/sbin/service sshd reload
详细说明如下:
Using an OpenSSH server's ClientAliveInterval, it is possible for the ssh server to send periodic "keep alive" messages to the ssh client, keeping the connection open indefinitely. This is useful when a firewall or other packet filtering device drops idle connections after a certain period of time. Note that this is different from the KeepAlive directive in ssh_config.

From the sshd_config manpage:

ClientAliveInterval
Sets a timeout interval in seconds after which if no data has
been received from the client, sshd will send a message through
the encrypted channel to request a response from the client. The
default is 0, indicating that these messages will not be sent to
the client. This option applies to protocol version 2 only.


Example (send "keep alive" messages every 5 minutes) on Red Hat Linux:

1. Add ClientAliveInterval 300 to /etc/ssh/sshd_config

2. Reload the sshd server configuration with /sbin/service sshd reload

Note: you may want to configure the ClientAliveCountMax value in sshd_config to set the number of times that "keep alive" messages are sent. If ClientAliveCountMax number of "keep alive" messages are not acknowledged by the ssh client, the connection is terminated by the ssh server. The default value of 3 should be sufficient for most users.