12 2009 檔案
postgres create INDEX
摘要: CREATE INDEX 在指定的表上構造一個名為 index_name 的索引。索引主要用來提高數據庫性能。但是如果不恰當的使用將導致性能的下降。
PostgreSQL 為從索引提供 B-tree,R-tree,hash(散列) 和 GiST 索引方法。 B-tree 索引方法是一個 Lehman-Yao 高并發 B-trees 的實 現。R-tree 索引方法用 Guttman 的二次分裂算法實現了標準的 R-trees。 hash(散列)索引方法是 Litwin 的線性散列的一個實現。 用戶也可以定義它們自己的索引方法,但這個工作相當復雜。
如果出現了 WHERE 子句,則創建一個部分索引。 部分索引是一個只包含表的一部分記錄的索引,通常是該表中比其它部分數據更有用的部分。
在 WHERE 子句里用的表達式只能引用下層表的字段,但是它可以使用所有字段,而不僅僅是被索引的字段。 目前,子查詢和聚集表達式也不能出現在WHERE里。
索引定義里的所有函數和操作符都必須是immutable,(不
閱讀全文
posted @
2009-12-22 10:00 冰是沒有未來的,因為它的永恒|
編輯
java jar
摘要: java -cp "./WEB-INF/lib/*:./WEB-INF/classes" bran.RestaurantCenterJettyStarter
閱讀全文
posted @
2009-12-22 09:47 冰是沒有未來的,因為它的永恒|
編輯
nginx ssi設置
摘要: 一個登錄用戶在頁面訪問的時候如何充分利用 cache?
頁面靜態化的一個大問題是登錄用戶訪問頁面如何靜態化。 例如首頁, 大部分的頁面內容需要緩存但是用戶登錄后的個人信息是動態信息, 不能緩存。 那么如何解決這個"頁面部分緩存"問題?
現有的方案是利用 SSI - Server Side include.
Nginx SSI 實現是 http://wiki.nginx.org/NginxHttpSsiModule
這里最關鍵的就是靜態文件可以包含一個動態的網頁的 URL.
這里有一篇文章對這個問題進行了深入的討論:
http://jimmyg.org/blog/2009/ssi-memcached-nginx.html
文章用了 memcache. 我關心的是 SSI 和 Nginx 自身的 cache 的協同工作。
模塊分析:
1. http://hi.baidu.com/langwan/blog/item/
閱讀全文
posted @
2009-12-22 09:35 冰是沒有未來的,因為它的永恒|
編輯
openmq 集群配置
摘要: 一 . Adding Brokers to a Conventional Cluster
1. To Add a New Broker to a Conventional Cluster Using a Cluster Configuration File
1).Add the new broker to the imq.cluster.brokerlist property in the cluster configuration file.
2).Issue the following command to any broker in the cluster: imqcmd reload cls
3).(Optional) Set the value of the imq.cluster.url property in the new broker’s instance configuration file (config.properties) to point to the clu
閱讀全文
posted @
2009-12-22 09:32 冰是沒有未來的,因為它的永恒|
編輯
grails quartz
摘要: http://svn.codehaus.org/grails-plugins/grails-quartz/tags/RELEASE_0_4_1/
閱讀全文
posted @
2009-12-11 15:56 冰是沒有未來的,因為它的永恒|
編輯
solr
摘要: http://lucene.apache.org/solr/tutorial.html
閱讀全文
posted @
2009-12-11 12:43 冰是沒有未來的,因為它的永恒|
編輯
nginx 通過user-agent判斷是手機的瀏覽器
摘要: user-agent 收集:http://www.developershome.com/wap/detection/detection.asp?page=userAgentHeader
http://search.cpan.org/~cmanley/Mobile-UserAgent-1.05/lib/Mobile/UserAgent.pm
http://www.zytrax.com/tech/web/mobile_ids.html
http://en.wikipedia.org/wiki/List_of_user_agents_for_mobile_phones
nginx
location = / {
root /var/www/path;
if ($http_user_agent ~* "Nokia") { rewrite . /index.html break; }
if ($http_user_agent ~* "Mobile") { r
閱讀全文
posted @
2009-12-08 09:22 冰是沒有未來的,因為它的永恒|
編輯
Iptables使用介紹
摘要: 原理簡介
安裝運行
特殊介紹
1.iptables的3個表:
filter: 顧名思義,用于過濾的時候
nat: 顧名思義,用于做NAT 的時候
manager:見下
2.iptables的5條鏈
INPUT: 匹配目的IP 是本機的數據包
OUPUT: 匹配源IP是本機的數據包
FORWARD: 匹配穿過本機的數據包
PREROUTING: 用于修改目的地址(DNAT)
POSTROUTING:用于修改源地址(SNAT)
3.manager簡介
這個表主要用來mangle數據包。我們可以改變不同的包及包頭的內容,比如 TTL,TOS或MARK。 注意MARK并沒有真正地改動數據包,
它只是在內核空間為包設了一個標記。防火墻內的其他的規則或程序(如tc)可以使用這種標記對包進行過濾或高級路由。這個表有五
閱讀全文
posted @
2009-12-04 13:42 冰是沒有未來的,因為它的永恒|
編輯
linux iptables 設置
摘要: 1. 限制 client 每秒訪問次數
限制連 80 port 的次數 = 60 秒 2次 , 超過就 drop
iptables -I INPUT -p tcp –dport 80 -i eth0 -m state –state NEW -m recent –set
iptables -I INPUT -p tcp –dport 80 -i eth0 -m state –state NEW -m recent –update –seconds 60 –hitcount 2 -j DROP
2. 控制client訪問特定的port
只允許114.80.192.18 和 127.0.0.1 訪問8080-8099的端口
iptables -A INPUT -p tcp -s 114.80.192.18 --dport 8080:8099 -j ACCEPT
iptables -A INPUT -p tcp -s ! 127.0.0.1 --dport 808
閱讀全文
posted @
2009-12-04 11:52 冰是沒有未來的,因為它的永恒|
編輯