Archive for the ‘Network service’ Category.

Database administrator

A database administrator (DBA) is a person who is responsible for the environmental aspects of a database. The role of a database administrator has changed according to the technology of database management systems (DBMSs) as well as the needs of the owners of the databases. For example, although logical and physical database design are traditionally the duties of a database analyst or database designer, a DBA may be tasked to perform those duties.

Duties

The duties of a database administrator vary and depend on the job description, corporate and Information Technology (IT) policies and the technical features and capabilities of the DBMS being administered. They nearly always include disaster recovery (backups and testing of backups), performance analysis and tuning, data dictionary maintenance, and some database design.

Some of the roles of the DBA may include

  • Installation of new software — It is primarily the job of the DBA to install new versions of DBMS software, application software, and other software related to DBMS administration. It is important that the DBA or other IS staff members test this new software before it is moved into a production environment.
  • Configuration of hardware and software with the system administrator — In many cases the system software can only be accessed by the system administrator. In this case, the DBA must work closely with the system administrator to perform software installations, and to configure hardware and software so that it functions optimally with the DBMS.
  • Security administration — One of the main duties of the DBA is to monitor and administer DBMS security. This involves adding and removing users, administering quotas, auditing, and checking for security problems.
  • Data analysis — The DBA will frequently be called on to analyze the data stored in the database and to make recommendations relating to performance and efficiency of that data storage. This might relate to the more effective use of indexes, enabling "Parallel Query" execution, or other DBMS specific features.
  • Database design (preliminary) — The DBA is often involved at the preliminary database-design stages. Through the involvement of the DBA, many problems that might occur can be eliminated. The DBA knows the DBMS and system, can point out potential problems, and can help the development team with special performance considerations.
  • Data modeling and optimization — By modeling the data, it is possible to optimize the system layouts to take the most advantage of the I/O subsystem.
  • Responsible for the administration of existing enterprise databases and the analysis, design, and creation of new databases.
    • Data modeling, database optimization, understanding and implementation of schemas, and the ability to interpret and write complex Structured Query Language (SQL) queries
    • Proactively monitor systems for optimum performance and capacity constraints
    • Establish standards and best practices for SQL
    • Interact with and coach developers in SQL scripting

 

http://metalink.oracle.com/

apache Custom Log Formats – 好用的參數

URL : http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats

我的 sample code :

ServerName test.monster.tw
DocumentRoot "/m2/test"
LogFormat "%{%Y-%m-%d}t , %{%H:%M:%S}t , %D , %a , \"%q\" , \"%{Referer}i\" , \"%{User-agent}i\"" MONSTER_format
CustomLog "/m2/log/test.monster.tw/access.log" MONSTER_format

MTS 的 http config

SetEnvIf Request_URI /dot.gif MTS_icon
LogFormat "%{%Y-%m-%d}t , %{%H:%M:%S}t , %a , \"%q\" , \"%{Referer}i\" , \"%{User-agent}i\"" MTS_format
CustomLog "| /usr/sbin/cronolog /var/www/ts.monster.com.tw/log/access-%Y%m%d%H.log" MTS_format env=MTS_icon

apache default 的 combined format

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog log/acces_log combined

以下是 apache 的資料

Format String Description
%% The percent sign
%a Remote IP-address
%A Local IP-address
%B Size of response in bytes, excluding HTTP headers.
%b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a ‘-‘ rather than a 0 when no bytes are sent.
%{Foobar}C The contents of cookie Foobar in the request sent to the server.
%D The time taken to serve the request, in microseconds.
%{FOOBAR}e The contents of the environment variable FOOBAR
%f Filename
%h Remote host
%H The request protocol
%{Foobar}i The contents of Foobar: header line(s) in the request sent to the server. Changes made by other modules (e.g. mod_headers) affect this.
%k Number of keepalive requests handled on this connection. Interesting if KeepAlive is being used, so that, for example, a ’1′ means the first keepalive request after the initial one, ’2′ the second, etc…; otherwise this is always 0 (indicating the initial request).
%l Remote logname (from identd, if supplied). This will return a dash unless mod_ident is present and IdentityCheck is set On.
%m The request method
%{Foobar}n The contents of note Foobar from another module.
%{Foobar}o The contents of Foobar: header line(s) in the reply.
%p The canonical port of the server serving the request
%{format}p The canonical port of the server serving the request or the server’s actual port or the client’s actual port. Valid formats are canonical, local, or remote.
%P The process ID of the child that serviced the request.
%{format}P The process ID or thread id of the child that serviced the request. Valid formats are pid, tid, and hextid. hextid requires APR 1.2.0 or higher.
%q The query string (prepended with a ? if a query string exists, otherwise an empty string)
%r First line of request
%s Status. For requests that got internally redirected, this is the status of the *original* request — %>s for the last.
%t Time the request was received (standard english format)
%{format}t The time, in the form given by format, which should be in strftime(3) format. (potentially localized)
%T The time taken to serve the request, in seconds.
%u Remote user (from auth; may be bogus if return status (%s) is 401)
%U The URL path requested, not including any query string.
%v The canonical ServerName of the server serving the request.
%V The server name according to the UseCanonicalName setting.
%X Connection status when response is completed:

X = connection aborted before the response completed.
+ = connection may be kept alive after the response is sent.
- = connection will be closed after the response is sent.

(This directive was %c in late versions of Apache 1.3, but this conflicted with the historical ssl %{var}c syntax.)

%I Bytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this.
%O Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this.

防止盜圖的 code

SetEnvIf Referer "^http://www.example.com/" local_referal
# Allow browsers that do not send Referer info
SetEnvIf Referer "^$" local_referal
[directory images web]
   Order Deny,Allow
   Deny from all
   Allow from env=local_referal
[/directory]

這個更讚! 排除掉 gif / jpg / png / css / swf … 等等不要log的檔案

SetEnvIf Request_URI \.gif misc-request
SetEnvIf Request_URI \.jpg misc-request
SetEnvIf Request_URI \.png misc-request
SetEnvIf Request_URI \.css misc-request
SetEnvIf Request_URI \.swf misc-request
CustomLog logs/access_log env=!misc-request

整合一下, 這是 lazy 的 config

  ServerName lazy.monster.tw
  DocumentRoot "/home/webuser/lazy.monster.tw"
  SetEnvIf Request_URI \.gif misc-request
  SetEnvIf Request_URI \.jpg misc-request
  SetEnvIf Request_URI \.png misc-request
  SetEnvIf Request_URI \.css misc-request
  SetEnvIf Request_URI \.swf misc-request

  LogFormat "%{%Y-%m-%d}t , %{%H:%M:%S}t , %a , %u , %D , \"%r\" , \"%{Referer}i\" , \"%{User-agent}i\"" MONSTER_format

  CustomLog /m2/log/lazy.monster.tw/access.log MONSTER_format env=!misc-request

Protected: [摘] 垂直搜尋引擎

This post is password protected. To view it please enter your password below:


Protected: [摘] Google 的十大信條 — 有時我會忘記東西, 也怕有用的資訊不見, 所以看到就順手留下來了(不公開).

This post is password protected. To view it please enter your password below:


Simple Monster Tracking System – step by step

mts.js , 網上範例很多 , 這個是基本型:
70a13e19e02a2c85496d095bec62ba1b

這段 code 前面就是一連串的組出 z 變數(包括 OS , BROWSER , SCREEN WIDTH/HEIGHT …) , 然後用一個小點透過 apache 的 log 記錄下來.

這個 apache 要裝 mod_setenvif 或 mod_rewrite modules , 在 apache config 中設定 只 log 特定的 tracking data.

SetEnvIf Request_URI /dot.gif MTS_icon
LogFormat "%{%Y-%m-%d}t , %{%H:%M:%S}t , %a , \"%q\" , \"%{Referer}i\" , \"%{User-agent}i\"" MTS_format
CustomLog "| /usr/sbin/cronolog /var/www/ts.monster.com.tw/log/access-%Y%m%d%H.log" MTS_format env=MTS_icon

引用例:

fce31197e4af4ae225f2a76fb86e84cb

然後 apache log 會長這個樣子:

32e8d2437c1ca7c201d84d7e14f56c72

寫一段 PHP code:

$fp = fopen($mts_logfile,"r");

while ( $temp = fgetcsv($fp,$max_size)  ) {
  if ( count($temp)<1 ) continue;
  print_r($temp);
}
fclose($fp);

結果就類似這樣:

237de7c2773e273a224561d7bfcba4c7

再來就是處理 [3] 那邊的各種 data …

透過 TOR 作 SSH / MSN 跳板 ( socks4 )

要先裝好 tor , 啟動 tor 後 , 用 putty 照下面的設定就好了

擷取-tor-ssh

這是透過 tor network 的出口點的 traceroute 

8  r02-s2.tp.hinet.net (220.128.4.42)  3.919 ms r02-s2.tp.hinet.net (220.128.4.38)  3.863 ms  3.812 ms
9  r12-pa.us.hinet.net (211.72.108.193)  133.255 ms  133.232 ms *
10  r11-ny.us.hinet.net (202.39.83.105)  253.503 ms  253.630 ms  253.790 ms
11  US-NY-RI-01.chello.com (198.32.160.48)  258.488 ms  255.308 ms  259.752 ms
12  213.46.190.93 (213.46.190.93)  252.272 ms us-nyc01b-rd1-10ge-3-0.aorta.net (213.46.190.177)  252.482 ms  252.557 ms
13  213.46.190.50 (213.46.190.50)  258.266 ms *  258.407 ms
14  fr-par02a-rd1-pos-2-0.aorta.net (213.46.160.105)  339.525 ms  339.944 ms  339.758 ms
15  ch-gva01a-ra1-xe-1-0-0.aorta.net (213.46.160.26)  352.450 ms  352.673 ms  352.191 ms
16  mlrZHZ006-xge-3-4.aorta.net (213.46.171.54)  357.266 ms  362.542 ms  355.218 ms
17  * * *
18  80-218-145-22.dclient.hispeed.ch (80.218.145.22)  505.819 ms  508.504 ms  544.136 ms

擷取-tor-msn

VMware ESXi server 連接 FreeNAS 的免費 iSCSI storage

首先這是 iSCSI 的基本知識 , From wiki : http://en.wikipedia.org/wiki/ISCSI

iSCSI uses TCP/IP (typically TCP ports 860 and 3260). In essence, iSCSI simply allows two hosts to negotiate and then exchange SCSI commands using IP networks. By doing this, iSCSI takes a popular high-performance local storage bus and emulates it over wide-area networks, creating a storage area network (SAN). Unlike some SAN protocols, iSCSI requires no dedicated cabling; it can be run over existing switching and IP infrastructure. As a result, iSCSI is often seen as a low-cost alternative to Fibre Channel, which requires dedicated infrastructure.

Although iSCSI can communicate with arbitrary types of SCSI devices, system administrators almost always use it to allow server computers (such as database servers) to access disk volumes on storage arrays. iSCSI SANs often have one of two objectives:

Storage consolidation
Organizations move disparate storage resources from servers around their network to central locations, often in data centers; this allows for more efficiency in the allocation of storage. In a SAN environment, a server can be allocated a new disk volume without any change to hardware or cabling.

Disaster recovery
Organizations mirror storage resources from one data center to a remote data center, which can serve as a hot standby in the event of a prolonged outage. In particular, iSCSI SANs allow entire disk arrays to be migrated across a WAN with minimal configuration changes, in effect making storage “routable” in the same manner as network traffic.

以下是基本的名詞解釋

Initiator

Further information: SCSI initiator

An initiator functions as an iSCSI client. An initiator typically serves the same purpose to a computer as a SCSI bus adapter would, except that instead of physically cabling SCSI devices (like hard drives and tape changers), an iSCSI initiator sends SCSI commands over an IP network. An initiator falls into two broad types:

Software initiator
A software initiator uses code to implement iSCSI. Typically, this happens in a kernel-resident device driver that uses the existing network card (NIC) and network stack to emulate SCSI devices for a computer by speaking the iSCSI protocol. Software initiators are available for most mainstream operating systems, and this type is the most common mode of deploying iSCSI on computers.
Hardware initiator
A hardware initiator uses dedicated hardware, typically in combination with software (firmware) running on that hardware, to implement iSCSI. A hardware initiator mitigates the overhead of iSCSI and TCP processing and Ethernet interrupts, and therefore may improve the performance of servers that use iSCSI.

Host Bus Adapter

An iSCSI host bus adapter (more commonly, HBA) implements a hardware initiator. A typical HBA is packaged as a combination of a Gigabit (or 10 Gigabit) Ethernet NIC, some kind of TCP/IP offload technology (TOE) and a SCSI bus adapter, which is how it appears to the operating system.

An iSCSI HBA can include PCI option ROM to allow booting from an iSCSI target.

Target

iSCSI refers to a storage resource located on an iSCSI server (more generally, one of potentially many instances of iSCSI running on that server) as a “target”. An iSCSI target usually represents hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.

Storage array
In a data center or enterprise environment, an iSCSI target often resides in a large storage array, such as a NetApp filer or an EMC Corporation NS-series computer appliance. A storage array usually provides distinct iSCSI targets for numerous clients.[1]
Software target
In a smaller or more specialized setting, mainstream server operating systems (like Linux, Solaris or Windows Server 2008) and some specific-purpose operating systems (like NexentaStor, StarWind iSCSI SAN, FreeNAS, iStorage Server, OpenFiler or FreeSiOS) can provide iSCSI target’s functionality.

Addressing

Special names refer to both iSCSI initiators and targets. iSCSI provides three name-formats:

iSCSI Qualified Name (IQN)
Format: iqn.yyyy-mm.{reversed domain name} (e.g. iqn.2001-04.com.acme:storage.tape.sys1.xyz) (Note: there is an optional colon with arbitrary text afterwards. This text is there to help better organize or label resources.)

以下是用 FreeNAS 的 step by step ,

我把一個 hardisk 整個當作一個 iSCSI 的 target (FreeNAS 那邊可以分成用 file 或 device 當 target , 各有好壞 , 當然 device 是效能較好)

4398dfd3b7283642ad11a403bcd7d6c5

在 VMware ESXi server 那邊要把 iSCSI 的 software adapter enable ( Initiator ):

e3fd27fb2527cfc6977a825a1868c356

在 Storage 那邊把 FreeNAS 提供的 iSCSI target 加進來 , Windows Vista 可以直接把 taget 加進去, XP 或 其他的 Windows server 要裝 Microsoft 所題供的 iSCSI software 才行.

145ed5da05493c3453d4837dcfb61d53

29aa71b4ecb5880c1ba8b9025d3c3161

不過我發現 iSCSI 的 extent 用 file 的會有 error : Error: The changes could not be applied (error code1).

19e398e657f49c463094788b4a98a6da

超簡易的 wiki system – Tiddlywiki

網站贊助廣告版位出租 – Pagerank 5 / 10 , SEO

廣告特色 : 本站 www.monster.com.tw 目前在 Google pagerank 是 5/10, 本位置廣告可以增加您的網站 SEO.

廣告版位 : 固定每頁都有(參考附圖), 不輪播, 大小為 720px × 90px , 可放一則 banner 或 flash 加上網頁聯結.

廣告價格 : 請看我的賣場!

請參考本站在 Google 排名 2009.0331

關鍵字 oracle :
繁體中文網頁 – 排名第 12
台灣的網頁 – 排名第 7

關鍵字 vmware :
繁體中文網頁 – 排名第 7
台灣的網頁 – 排名第 5

關鍵字 javascript  :
繁體中文網頁 – 排名第 33
台灣的網頁 – 排名第 20

關鍵字 codeigniter  :
繁體中文網頁 – 排名第 3
台灣的網頁 – 排名第 3

15d0ecaf788b8cd0b7d97e87fa7d19c1

Microsoft Internet Explorer 8 / IE8 新功能 accelerator implement

 

參考這頁: http://msdn.microsoft.com/en-us/library/cc304163(VS.85).aspx

可以作出這樣的效果 , 這東西 microsoft 管它叫作 Internet Explorer 8 的 “新” 功能 – Accelerators

cbbf837d7ab99e765e0f1b3a5374674a

XML file:

.....
....
重點是 .... preview action="xxxxx" accept-charset="big5"
....

好了, 接下來是碎碎唸時間 …. 心得是 微軟老愛搞這種小玩意兒… 要用到此功能, 首先 user 必須要在網頁選取一段他感興趣的字, 然候再點旁邊出現的藍框 , 仔細找會有一個 所有的加速器 , 再移過去 會看到自己寫的 加速器 , 然後在加速器上要等一下下 , 才會出現 商品 preview , 然後整個過程手還不能發抖讓 mouse 游標跑掉 . . . 這功能有人要用才有鬼咧.

而且這東西要叫 “加速器” 才好笑, 用的過程囉唆的要命, 還要叫加速器??

為網站裝上 Microsoft IE8 search provider

聽說 微軟 的 IE8 即將要推出了 , 公司有一連串的配合計畫 , 我分到一部分工作 , 就是為 IE8 的 user 加上 search  功能.

簡單的說 , IE8 提供一個方便的功能, 讓 user 可以快速的進行查詢 …..

可以點那個加的連結 , 或者看這個示範

95be1836ae483edd768f62d8bde5eb9d

以下是一部分剪圖

aa478377a47203f82127e37bf38f8c1b

參考這頁很快就可以把這功能完成了!

不過有幾點要注意

  • web server 的 xml header 會不會送錯
  • 字元集 UTF8 / BIG5 ?

Google checkout screen snap

這算是個資外洩嗎

剛好在研究 mysqldump 的東西然後我對於 mysqldump 出來的前面有一些
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

這些感到好奇, 不曉得有沒有用處 , 那我就去 google 了一下
竟然被我找到這個 image

這真的有點恐怖哩
image

簡單方便的 RSS 工具程式 Feedcreator

http://feedcreator.org/

include("include/feedcreator.class.php");

$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "PHP news";
$rss->description = "daily news from the PHP scripting world";
$rss->link = "http://www.dailyphp.net/news";
$rss->syndicationURL = "http://www.dailyphp.net/".$PHP_SELF;

$image = new FeedImage();
$image->title = "dailyphp.net logo";
$image->url = "http://www.dailyphp.net/images/logo.gif";
$image->link = "http://www.dailyphp.net";
$image->description = "Feed provided by dailyphp.net. Click to visit.";
$rss->image = $image;

// get your news items from somewhere, e.g. your database:
mysql_select_db($dbHost, $dbUser, $dbPass);
$res = mysql_query("SELECT * FROM news ORDER BY newsdate DESC");
while ($data = mysql_fetch_object($res)) {
    $item = new FeedItem();
    $item->title = $data->title;
    $item->link = $data->url;
    $item->description = $data->short;
    $item->date = $data->newsdate;
    $item->source = "http://www.dailyphp.net";
    $item->author = "John Doe";

    $rss->addItem($item);
}

$rss->saveFeed("RSS1.0", "news/feed.xml");

ESXi server 的 image 處理技巧

通常 converter 用來把 vmware workstation or server 的 image 轉上 ESXi server , 不過我發現 ESXi server 的 image  download 下來後 , 一樣也可以用 convert 把它 轉上 ESXi server , 轉上去可以順便改個名字 , 這樣就可以方便的加一台測試機了.

1055ed6795b3cff2a9877c318a86fc92

我的 subversion / svn server 設定

OS : Gentoo Linux 2.6.22-gentoo-r5 #11

gcc –version
gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.1)

svnserve –version
svnserve, version 1.5.4 (r33841)
   compiled Dec 17 2008, 08:11:10

/usr/bin/svnserve –foreground –daemon –root=/var/svn

很奇怪 , 裝法都一樣, 但我另一台 MLP Lite 就不 work??

b3427f82eb24f02a7a8c162d19f344c6 

74fe80d6a738a7f3beb1c6da3e33b80f

 

一些 subversion command 下的操作:

用 svn co 一個 source 到目錄下 , 把要加到 svn  的檔案/目錄 copy 過來 , 下 svn status 會看到一堆 ? 表示那些是新的檔案

e7cd532c5adf186cfae84be0973cfcf6

下 svn add * 或 svn add dirname

84befb5056c4efb725a40ba8ef42577f

下 svn status 可以看到 剛剛的 ? 變成 A 了 (add)

eaf23dbfa9a596768ee8e351bb792062

下 svn ci 把 source code commit 進 svn

5ffc7c116629e31e25b3b274d4f9ee4a

cd 到工作目錄

svn –username monster export svn://xxx.com/my_repos/search/src

把 source code export 出來

客串 “狗仔隊” – 拍 Google Street View 360度環景拍攝車

今天我被 Google Street View 的 360度環景拍攝車拍到了, 然後我就驅車趕緊追上, 拍了兩張那台車, 看看車頂上的環景相機, 如下圖!

告訴大家 … Google 大大帶著 Street View 來囉! 搞不好下次用 Google Map 看台北地區的話, 就可以看到實景的街道景觀了.

看看別人寫的 Google Street View:

P028 P029

小心! 博客來* 寄出來的書 是 舊書 ㄚ

上週我在那個站上買了一本書 , 但是為了省運費 , 再去選了一本想看的書 (但不是最近出版的書) , 結果該站寄來的是一本新的一本舊書 , 舊書除了外觀是舊的泛黃 , 紙張還有一點一點的黃點 , 不僅如此還有一股臭味, Orz … 比租書店的書還糟糕!

當下, 就想要退回! 但沒想到我這陣子忙翻了… 就一直放在桌上了, 我想我應該是不會有時間去搞這本書了, 剛剛又想起了這件事,  覺得自己算是被 博客來 給凹到了 , 他就賭客戶收到這種舊書 不會有空去退書 , 那我就那種沒空到書店買書才到線上買的人, 更別說是有空去郵局寄回那本書的人,  真的是被吃定了!

我把我的經驗寫出來, 給大家參考參考! 我相信我的站 Google page rank = 6  一定會有人看的!

不爽中…

Virtual appliance

看到 http://virtualappliances.net/ 這裡面立即提供了 5 總 ready to go 的 appliance  , 只要 “抓下來 / 啟動 就立即可用” —> 這就是 virtual appliance 的精神 , 看了這頁頓時覺得 這些 appliance 真的對 developer 非常 friendy , 看看這頁
http://virtualappliances.net/documentation/readme/README.lamp.html

裝好立即有

  • Apache HTTP Server
  • PHP
  • Perl
  • Python
  • ZendOptimizer (www.zend.com)
  • MySQL
  • phpMyAdmin

然後要開發就只要到它開放的 samba  目錄下寫程式即可 , 這點跟我包裝的 Monster LAMP Pack 精神是相同的.

遷移我的 VMware ESXi VMs 到另一台 ESXi server