[apache] mod cband 頻寬限制

這個MODULE相當好用,這個可以用來解決架設APACHE頻寬問題 安裝方式:

For Linux: 先去下載軟體: mod_cband 目前釋出到 0.9.7.5版 下載到 /tmp/ 資料夾裡面 解壓縮: tar -zxvf mod-cband-0.9.7.5.tgz 如果你有安裝 apsx2的話 請用下面安裝 $ cd mod-cband-0.9.7.5 $ ./configure $ make $ make install 如果沒有安裝 apsx2的話 請用下面安裝 重新編譯 configure –add-module=../mod-cband/mod_cband.c –enable-shared=cband –enable-module=so 設定方法: * 修改httpd.conf 加上2行CBandScoreFlushPeriod 1 CBandRandomPulse On mkdir /var/www/scoreboard chown apache:apache /var/www/scoreboard * 設定 VirtualHost <VirtualHost 1.2.3.4> ServerName www.example.com ServerAdmin webmaster@example.com DocumentRoot /var/www CBandSpeed 1024 10 30 CBandRemoteSpeed 20kb/s 3 3 說明:# 100MB virtualhost bandwidth limit CBandLimit 100M # Maximal 1024kbps speed for this virtualhost # Maximal 10 requests per second for this virtualhost # Maximal 30 open connections for this virtualhost限制該網域總頻寬跟連線數目 CBandSpeed 1024 10 30# Maximal 10kB/s speed, 3 requests/s and 2 open connections for any remote client CBandRemoteSpeed 10kb/s 3 2 4個禮拜清除設定一次# a period of time after which the scoreboard will be cleared (4 weeks) CBandPeriod 4W # define ‘class_1′ CBandClassDst 217.172.231.67 CBandClassDst 127/8 CBandClassDst 192.168.0.0/24 CBandClassDst 10.0.0.20 # define ‘class_2′ CBandClassDst 192.168.100.100 CBandClassDst 153.19/16 CBandUserLimit 1000000 CBandUserExceededURL http://edns.pl/bandwidth_exceeded.html CBandUserScoreboard /home/dembol/write/user.dembol.scoreboard# 500MB limit for ‘class_2′ CBandUserClassLimit class_2 500000 實作部份: CBandClassDst 127/8 CBandClassDst 192.168.0.0/24 <VirtualHost *:80> ServerAdmin appleboy.tw@gmail.com DocumentRoot /var/www/html ServerName nas.th.gov.tw ErrorLog logs/nas.th.gov.tw-error_log CustomLog logs/nas.th.gov.tw-access_log common CBandSpeed 1024 200 200 CBandRemoteSpeed 1024kb/s 50 50 CBandClassRemoteSpeed local_class 1000Gbps 1000 1000 CBandLimit 10G CBandPeriod 1W CBandScoreboard /var/run/apache2/default.scoreboard 如果要看SERVER-Status的話 也可以設定在httpd.conf就好 # # mod_cband # <Location /cband-status> SetHandler cband-status

[Read More]

[Linux] cwRsync [rsync for windows] SSH 加密異地備份

這個我找了好久~因為館內用的系統2003server跟前端系統linux,2個是不同的作業系統 但是我每天都有備份linux資料,我想同步到win的server上面,但是這樣就要在win的機器上面架設rsync伺服器跟rsync client套件 所以我找了很久 終於找到了 cwRsync 有client端 跟server端 跟ssh 加密 open ssh server cwRsync – Rsync for Windows 請點選中間的 Download cwRsync Server 1 下載之後解壓縮,裡面會有一個執行檔,在安裝即可 安裝好之後,去程式集打開 cwrsync server -> 05. Start a Unix BASH Shell 會出現底下畫面 2 執行之後,會出現一個 cmd 視窗但字元卻是 $ 的。

[Read More]

[Linux] Mrtg 實做 war3 線上人數統計

應大家觀眾要求,來寫一下教學 當然我不想怎麼安裝mrtg了,搜尋一下本站就會找到教學 相信mrtg最主要是他的設定檔 cfg檔,先來看看 這個cfg檔怎麼寫

# Created by
#          Appleboy 2006/09/25

WorkDir: /usr/local/www/data-dist
Language: big5

Target[bnet_person]: `/usr/local/etc/mrtg/mrtg.person.sh`
MaxBytes[bnet_person]: 10000
Options[bnet_person]: gauge, nopercent, growright
YLegend[bnet_person]: Online Users
ShortLegend[bnet_person]: 人
LegendI[bnet_person]:   線上人數 :
LegendO[bnet_person]:   遊戲數目 :
Title[bnet_person]: 小熊戰網 上線人數統計表
先來解釋
WorkDir: /usr/local/www/data-dist
這個是來存放mrtg統計圖的資料夾,請對應到相關可以放html的資料夾
Target[bnet_person]: `/usr/local/etc/mrtg/mrtg.person.sh`
以下是 mrtg.person.sh 這個檔案
#!/bin/sh
# 這個程式主要在計算有多少人以 bnetd 的方式連線進我們的主機!

# 1. 計算線上的數目
cat /~pvpgn/server.dat  | grep "Users" | cut -d "=" -f2

# 2. 計算遊戲數目
cat /~pvpgn/server.dat  | grep "Games" | cut -d "=" -f2

# 3. 輸出時間咚咚
UPtime=`/usr/bin/uptime | awk '{print $3 " " $4 " " $5}'`
echo $UPtime
echo bnet.dearbear.net
要先來看看war3在啟動的時候,會把線上人數 寫在 server.dat 檔案裏面,下面是該檔案的模式

[STATUS] Version=1.8.0 Uptime=9 hours 20 minutes 0 seconds Games=62 Users=323 Channels=8 UserAccounts=1909 所以我們最主要需要下面這2個值

[Read More]

[Linux] CentOS 4.4 安裝過程 NAS 2U Server

新主機 2u nas server

  • 2顆amd Opteron 2.2ghz
  • 機架高度2u
  • 2*1GB RAM ECC DDR400
  • SCSI硬碟 ULTRA320磁碟陣列卡支援RAID0,1,5,1000RPM 72GB4顆
  • 網路卡10/100/ 1000 Mbps介面卡2個
  • 主機板型號GA-7A8DRH 連結

主機照片 上面那台,下面那台也是NAS WIN2003 SERVER

  • 安裝步驟:

利用光碟開機,鍵入linux ddDSCF0059

[Read More]

[Ubuntu] 安裝 StarDict 星際譯王 以及 字典檔

如何在Ubuntu 底下安裝字典呢 先去搜尋 StarDict Shell Script{#p94}StarDict Shell Script{#p94}StarDict Shell Script{#p94} 套件

[root@appleboy-dorm][~][21:59:39]# apt-cache search stardict sdcv – StarDict Console Version stardict – International dictionary for GNOME 2 stardict-common – International dictionary for GNOME 2 – data files stardict-tools – The dictionary conversion tools of stardict 然後安裝

apt-get install stardict-* 安裝好之後就可以在 應用程式->附屬應用程式->星際譯王 但是安裝好之後沒有任何字典檔,所以請自行到網路上下載 http://stardict.sourceforge.net/Dictionaries_zh_TW.php 下載軟體後 請把他解壓縮到 /usr/share/stardict/dic/ 解壓縮的目錄應該有 *.dz *.idx *.ifo 這3個檔案 重新啟動該軟體 就可以使用了 Update: 2007.04.16 有人有寫好script了,底下給大家參考 StarDict Shell Script{#p94}

[CentOS 4.4] 架設 rsync 伺服器

  • 安裝方式:

  • 先檢查是否有安裝rsync

  • yum list installed | grep rsync

  • rsync.x86_64 2.6.3-1 installed

  • vi /etc/xinetd.d/rsync

service rsync { disable = yes socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = –daemon log_on_failure += USERID } disable = yes 改成 disable = no 然後重新啟動xinetd /etc/init.d/xinetd restart

  • vi /etc/rsyncd.conf
  • [backup] path = /backup02 auth users = admin uid = root gid = root secrets file = /etc/rsyncd.secrets read only = no

[主機代號:自訂] path = 備份資料放置的路徑 auth users = 定義援權的帳號 uid = 應是執行時的uid gid = 應是執行時的gid secrets file = 認證密碼檔的位置 read only = 是否唯讀

[Read More]

[Linux] Suse Server 9 && My Company Computer

館內買的17萬伺服器,剛來的時候是安裝 Suse Linux Enterprise 9

DSCF0070DSCF0070 Hosted on Zooomr
玩來玩去所有的linux好像都差不多,正版的linux

Suse LINUX Server 其實網路上都下載的到,差別在於你買企業版,提供30天免費服務電話,打電話去煩他 不過我想一個資訊人員,應該不用這樣吧哈 我們館內還有買dell的機器,買的是rhel4的系統,也是正版,明天去拍一下 順便看看我的桌面吧 超亂 My company Desktop 桌上都是一堆雜誌pchome pc office這是我們定的,都是由我保管 哈~

[Ubuntu] 安裝 java-tool for Flickr upload tool

國外知名的相簿網站 Zooomr Flickr 有支援同一套上傳軟體,2個相簿的網頁空間分別如下 Flickr 升級後如下 Upgrade to a Pro Account today for just $24.95! Click here! 還蠻便宜的,zooomr 則是 100MB用完就沒有了,Flickr 則是每個月可以上傳20MB 接下來~來說明 ubuntu安裝方式 下載Flickr 上傳軟體 http://juploadr.sourceforge.net/ 下載之後,解壓縮到桌面 ,到該資料夾之後執行 ./jUploadr , 不過如果你沒有安裝java的話,會執行失敗 首先安裝java apt-get install sun-java5* java-package 安裝時會出現下面錯誤訊息

This package is an installer package, it does not actually contain the J2SDK documentation. You will need to go download one of the archives: jdk-1_5_0-doc.zip jdk-1_5_0-doc-ja.zip (choose the non-update version if this is the first installation). Please visit http://java.sun.com/j2se/1.5.0/download.html now and download. The file should be owned by root.root and be copied to /tmp. 這時候要去下載 去 www.google.com.tw 收尋 jdk-1_5_0-doc-ja.zip 第一個收尋就是了 然後分別下載 jdk-1_5_0-doc.zip jdk-1_5_0-doc-ja.zip 然後在放到 /tmp/ 底下 ,然後在重新執行

[Read More]

[Linux] CentOS 安裝在 2u server

最近館內買了一台2u的伺服器,雙cpu AMD,底下圖片上面那台,下面那台是後端的圖片資料庫

DSCF0070DSCF0070 Hosted on Zooomr
processor : 1 vendor_id : AuthenticAMD cpu family : 15 model : 37 model name : AMD Opteron(tm) Processor 248 stepping : 1 cpu MHz : 2193.217 cache size : 1024 KB MemTotal: 2055132 kB 2顆,不過重點不是這個,重點這台機器我搞了1個星期 就是因為抓不到scsi介面卡,打電話給客服,好像機器不是他們裝的 原本機器送過裝好suse 9.0 enterorise server,可是我不喜歡suse,還可以安裝桌面 一堆有的沒有程式,所以我只好砍掉自己系統重做,不過原本想用freebsd 6.1 release 也沒辦法 外接卡不支援freebsd 那就別安裝了,根本抓不到硬碟,最後上網找driver,終於找到for fc centos 想說沒玩過centOS 4.4 就裝來玩看看 , 順便動手切了LVM
DSCF0075DSCF0075 Hosted on Zooomr
安裝好之後機器大概就ok了,沒什麼問題 這台機器,是在

捷洲資訊股份有限公司 台中分公司 台中市南屯區大英街636 Web Site : http://www.jcnetcorp.com

[Read More]