<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Blog Voice</title>
	<atom:link href="http://voice.zeednetwork.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://voice.zeednetwork.com</link>
	<description>Blog Voice Computer it network</description>
	<pubDate>Thu, 13 Nov 2008 15:39:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>ทดสอบการ อ่านเขียน HD</title>
		<link>http://voice.zeednetwork.com/2008/11/03/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3-%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-hd/</link>
		<comments>http://voice.zeednetwork.com/2008/11/03/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3-%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-hd/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 08:15:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CentOS]]></category>

		<category><![CDATA[hardisk]]></category>

		<category><![CDATA[อ่าน]]></category>

		<category><![CDATA[เขียน]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=67</guid>
		<description><![CDATA[สำหรับคำสั่งที่ใช้ทดสอบ
CentOS
hdparm -t /dev/sda
CentOS &#38; FreeBSD
Write Test
dd if=/dev/zero of=/usr/test.bin bs=512 count=4096000
dd if=/dev/zero of=/usr/test2.bin bs=512 count=4096000
Read Test
dd if=/usr/test.bin of=/dev/null
]]></description>
			<content:encoded><![CDATA[<p>สำหรับคำสั่งที่ใช้ทดสอบ<br />
CentOS<br />
hdparm -t /dev/sda</p>
<p>CentOS &amp; FreeBSD<br />
Write Test<br />
dd if=/dev/zero of=/usr/test.bin bs=512 count=4096000<br />
dd if=/dev/zero of=/usr/test2.bin bs=512 count=4096000<br />
Read Test<br />
dd if=/usr/test.bin of=/dev/null</p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/11/03/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3-%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-hd/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mysql localhost แยกเครื่องออกจากเครื่อง web</title>
		<link>http://voice.zeednetwork.com/2008/10/02/mysql-localhost-%e0%b9%81%e0%b8%a2%e0%b8%81%e0%b9%80%e0%b8%84%e0%b8%a3%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%87%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%88%e0%b8%b2%e0%b8%81%e0%b9%80%e0%b8%84%e0%b8%a3%e0%b8%b7/</link>
		<comments>http://voice.zeednetwork.com/2008/10/02/mysql-localhost-%e0%b9%81%e0%b8%a2%e0%b8%81%e0%b9%80%e0%b8%84%e0%b8%a3%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%87%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%88%e0%b8%b2%e0%b8%81%e0%b9%80%e0%b8%84%e0%b8%a3%e0%b8%b7/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 06:14:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<category><![CDATA[config mysql local]]></category>

		<category><![CDATA[mysql local network]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=64</guid>
		<description><![CDATA[พอดีได้มีโอกาศ ได้ติดตั้งเครื่อง 2 เครื่อง เครื่อง web (apache) กับ database (Mysql) โดยมี สายออกเน็ท 1 เส้น ส่วน mysql จะเชื่อมกับ web โดยผ่านสายแลนที่เป็น local network(10.0.0.2)  ทำการ ติดตั้ง apache+php และ phpmyadmin(ทำการ config ให้มัน เชื่อต่อ ไปที่ 10.0.0.2 แล้ว)  แล้วทำการเชื่อต่อ เชื่อต่อได้ครับ แต่ไมมันช้าได้ใจจริง  เลยไปหาข้อมูลในเน็ทเค้าบอกให้ ใส่
[mysqld]
skip-name-resolve
แล้ว restart mysql ทันได้นั้น ก็สามารถเข้าได้ รวดเร็วทันใจ
ปล. อยาลืม grant สิทธิ์ ให้ user เข้าจาก ip อื่นได้ด้วยนะครับ
]]></description>
			<content:encoded><![CDATA[<p>พอดีได้มีโอกาศ ได้ติดตั้งเครื่อง 2 เครื่อง เครื่อง web (apache) กับ database (Mysql) โดยมี สายออกเน็ท 1 เส้น ส่วน mysql จะเชื่อมกับ web โดยผ่านสายแลนที่เป็น local network(10.0.0.2)  ทำการ ติดตั้ง apache+php และ phpmyadmin(ทำการ config ให้มัน เชื่อต่อ ไปที่ 10.0.0.2 แล้ว)  แล้วทำการเชื่อต่อ เชื่อต่อได้ครับ แต่ไมมันช้าได้ใจจริง  เลยไปหาข้อมูลในเน็ทเค้าบอกให้ ใส่</p>
<p><strong><span style="color: #800000;">[mysqld]<br />
</span><span style="color: #339966;">skip-name-resolve</span></strong></p>
<p>แล้ว restart mysql ทันได้นั้น ก็สามารถเข้าได้ รวดเร็วทันใจ<br />
ปล. อยาลืม grant สิทธิ์ ให้ user เข้าจาก ip อื่นได้ด้วยนะครับ</p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/10/02/mysql-localhost-%e0%b9%81%e0%b8%a2%e0%b8%81%e0%b9%80%e0%b8%84%e0%b8%a3%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%87%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%88%e0%b8%b2%e0%b8%81%e0%b9%80%e0%b8%84%e0%b8%a3%e0%b8%b7/feed/</wfw:commentRss>
		</item>
		<item>
		<title>update ports for CentOS5.2</title>
		<link>http://voice.zeednetwork.com/2008/09/10/update-ports-for-centos52/</link>
		<comments>http://voice.zeednetwork.com/2008/09/10/update-ports-for-centos52/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 17:51:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CentOS]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[update]]></category>

		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=59</guid>
		<description><![CDATA[#rpm &#8211;import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
#vi /etc/yum.repos.d/utterramblings.repo
insert data
[utterramblings]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">#rpm &#8211;import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka<br />
#vi /etc/yum.repos.d/utterramblings.repo<br />
<strong>insert data</strong><br />
<span style="color: #0000ff;">[utterramblings]<br />
name=Jason’s Utter Ramblings Repo<br />
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/<br />
enabled=1<br />
gpgcheck=1<br />
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</span></p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/09/10/update-ports-for-centos52/feed/</wfw:commentRss>
		</item>
		<item>
		<title>รายละเอียด การ Config mysql</title>
		<link>http://voice.zeednetwork.com/2008/09/08/%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%a5%e0%b8%b0%e0%b9%80%e0%b8%ad%e0%b8%b5%e0%b8%a2%e0%b8%94-%e0%b8%81%e0%b8%b2%e0%b8%a3-config-mysql/</link>
		<comments>http://voice.zeednetwork.com/2008/09/08/%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%a5%e0%b8%b0%e0%b9%80%e0%b8%ad%e0%b8%b5%e0%b8%a2%e0%b8%94-%e0%b8%81%e0%b8%b2%e0%b8%a3-config-mysql/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 10:29:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<category><![CDATA[config my.conf]]></category>

		<category><![CDATA[config_mysql]]></category>

		<category><![CDATA[my.conf]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=57</guid>
		<description><![CDATA[ภาคที่1
MySQL นับว่าเป็นหัวใจของ Web Server อีกตัวหนึ่งเลยก็ว่าได้เพราะว่า MySQL นั้นเป็นแหล่งข้อมูลที่สามารถเรียกใช้งานได้อย่างรวดเร็ว วันนี้ผมจะเอาประสบการณ์เกี่ยวกับการ Config MySQL มาให้อ่านกัน
ผมอิงตามรุ่น 4.1 โดยใช้กับ Server ที่ใช้ tis620 เป็น Default นะครับ
เริ่มต้นที่การ Compile PHP ให้สนับสนุน MySQL
ปกติแล้วสามารถ Compile PHP ให้สนับสนุน MySQL ด้วยการใช้ &#8211;with-mysql วิธีการนี้จะเป็นการใช้ MySQL Lib Client ที่ Bundle มากับ PHP ครับ ซึ่งเป็น Version เก่า นอกจากนี้ยังมี Extension ใหม่ชื่อ MySQLi ซึ่งถ้าจะใช้ MySQLi จะไม่สามารถใช้ MySQL Lib Client ที่ Bungle มาด้วยได้ มันจะตีกัน [...]]]></description>
			<content:encoded><![CDATA[<p><span class="postbody"><span style="font-weight: bold;"><span style="color: blue;">ภาคที่1</span></span><br />
MySQL นับว่าเป็นหัวใจของ Web Server อีกตัวหนึ่งเลยก็ว่าได้เพราะว่า MySQL นั้นเป็นแหล่งข้อมูลที่สามารถเรียกใช้งานได้อย่างรวดเร็ว วันนี้ผมจะเอาประสบการณ์เกี่ยวกับการ Config MySQL มาให้อ่านกัน</p>
<p>ผมอิงตามรุ่น 4.1 โดยใช้กับ Server ที่ใช้ tis620 เป็น Default นะครับ</p>
<p>เริ่มต้นที่การ Compile PHP ให้สนับสนุน MySQL<br />
ปกติแล้วสามารถ Compile PHP ให้สนับสนุน MySQL ด้วยการใช้ &#8211;with-mysql วิธีการนี้จะเป็นการใช้ MySQL Lib Client ที่ Bundle มากับ PHP ครับ ซึ่งเป็น Version เก่า นอกจากนี้ยังมี Extension ใหม่ชื่อ MySQLi ซึ่งถ้าจะใช้ MySQLi จะไม่สามารถใช้ MySQL Lib Client ที่ Bungle มาด้วยได้ มันจะตีกัน ดังนั้นเริ่มต้นผมแนะนำให้คุณ Compile PHP ด้วย &#8211;with-mysql=/usr/local/mysql (หรือถ้า mysql อยู่ที่อื่นก็ใช้ path อื่นแล้วกันครับ)</p>
<p>เพื่อความสะดวกในการใช้งานภาษาไทย มักจะ setup ใน my.cnf ว่า default-character-set = tis620 วิธีการนี้จะทำให้ MySQL ทำงานช้าลงไปประมาณ 20 - 30% แต่ไม่เป็นไรครับ เพราะว่ายังไงผมก็ต้องใช้ภาษาไทยอยู่แล้ว</p>
<p>หลังจากใส่คำสั่งว่า default-character-set = tis620 ลงไปใน my.cnf แล้ว ผมที่ได้คือ MySQL Client มันต๊องครับ เพราะว่า Charset ของ Server เป็น tis620 แต่ของ Client เป็น Latin ครับ ดังนั้นต้อง setup เพิ่มอีกตัวหนึ่งคือ skip-character-set-client-handshake ใส่ส่วน my.cnf ครับ วิธีการนี้จะทำให้ Client ทำงานที่ Charset เดียวกับ Server เลยครับ</p>
<p>skip-locking - อันนี้ถ้าจำไม่ผิดเขาเปลี่ยนชื่อเป็น skip-external-locking เกี่ยวกับการทำ Repicate MySQL Server ผมไม่แน่ใจว่าถ้ามี Server เดียวจะช่วยเพิ่มประสิทธิภาพอะไรได้หรือเปล่า แต่ใส่ไว้ก็ไม่เสียหายครับ</p>
<p>skip-thread-priority - เป็นการกำหนดครับว่าไม่ต้องให้ thread แซงคิวกันได้ MySQL จะให้ QUERY แต่ละแบบมีความสำคัญไม่เท่ากัน ผมจำไม่ได้ว่าอะไรมากกว่าอะไร แต่การเอาหัวข้อนี้ออกทำให้ระบบ queue ของ MySQL ไม่ต้องมายุ่งยากกับการจัดคิวและทำงานเป็น FIFO แทนครับ</p>
<p>skip-bdb - ไม่ได้ใช้ก็ข้ามไปครับ ถ้าใช้ bdb ก็ Comment บรรทัดนี้ซะ สำหรับผมแล้วผมใช้แค่ MYISAM กับ INNODB ครับ</p>
<p>skip-networking - อันนี้เป็นการบอก MySQL Server ว่าไม่ต้อง Listen ที่ INET SOCKET ครับ ให้ Listen ที่ UNIX SOCKET อย่างเดียวพอ อันนี้ไม่ได้เพิ่มความเร็วมากนัก แต่ลดโอกาสการโดนโจมตีได้ครับ</p>
<p>log-slow-queries - อันนี้ใช้เฉพาะเวลาที่ต้องการดูว่า Query อันไหนทำงานช้า จะได้มาปรับแต่งได้ครับ</p>
<p><span style="font-weight: bold;"><span style="color: blue;">ภาคที่ 2</span></span><br />
การบริหาร Thread - ตัวแปรเกี่ยวกับ Thread ที่สำคัญของ MySQL คือ thread_cache ตัวแปรนี้จะเป็นการไม่ทำลาย thread ของ MySQL ให้ต่ำกว่าเลขนี้ครับ ปกติก็เดาไปเรื่อยๆ ครับ โดยดูจาก Status ของ MySQL ผมแนะนำให้ดูจาก phpMyAdmin ครับ สะดวกดี จะมีค่าเกี่ยวกับ thread คือ</p>
<p>Threads cached 143<br />
Threads connected 7<br />
Threads created 532<br />
Threads running 1</p>
<p>Threads cached - คือจำนวน threads ที่อยู่ในโปรแกรม MySQL ตอนนี้ จะเห็นได้ว่ามี 143 threads<br />
Threads connected - คือจำนวน threads ที่ใช้งานจริงๆ ครับ<br />
Threads running - คือ threads ที่กำลังหาผลการ Query อยู่ครับ<br />
Threads created - คือจำนวน threads ที่สร้างใหม่ตั้งแต่เริ่ม Server มาครับ ถ้าค่านี้เพิ่มเร็วเกินไป ให้เพิ่มจำนวน Thread_cache ครับ ผลที่ได้คือ MySQL จะทำงานเร็วขึ้นนิดหน่อยเพราะว่าจะไม่ต้องเสียเวลา สร้างและทำลาย Threads บ่อยๆ ครับ</p>
<p><span style="color: blue;"><span style="font-weight: bold;">ภาคที่ 3</span></span></p>
<p>MYISAM กับหน่วยความจำ ตัวแปรที่เราสนใจคือ</p>
<p>key_buffer=32M<br />
sort_buffer_size=1M<br />
read_buffer_size=1M<br />
read_rnd_buffer_size=4M</p>
<p>- Key Buffer คือพื้นที่สำหรับ Cache ค่า Key ของแต่ละ Table ครับ โดยที่ Key ของ MySQL มี 3 ตัวคือ PRIMARY, INDEX และ UNIQUE ครับ ปกติถ้ามีการใช้ Table MyISAM มากๆ ค่านี้ควรจะมากๆ ครับ ของผมมีใช้ไม่มากเลยไม่ต้องใช้ค่า Key_Buffer มาก แนะนำ 16MB สำหรับแรม 256 และเพิ่มมากขึ้นเมื่อแรมมากขึ้น</p>
<p>- Sort Buffer คือหน่วยความจำที่ MySQSL แต่ละ Connection จะจองเพิ่ม เพื่อทำ Table Scan ครับ ปกติถ้าคุณจะ Sort Field ที่ไม่ใช่ Key จะต้องใช้หน่วยความจำส่วนนี้เสมอ ให้ Setup เริ่มต้นตั้งแต่ 512K ขึ้นไป เนื่องจากเป็นหน่วยความจำที่จะมีการจองเพิ่มต่อ Connection ดังนั้นจะไม่ควรจะ Setup ให้สูงเกินเพราะว่าจะทำให้ MySQL ทำงานจนหน่วยความจำหมด</p>
<p>- Read Buffer คือหน่วยความจำที่ MySQL จะใช้ในการเก็บค่าที่อ่านจากตารางแบบต่อเนื่อง (คือไม่ได้ Sort) ไม่จำเป็นต้องมากนักก็ได้ เพราะว่าปกติเราจะมีการทำ LIMIT ในการอ่านค่ามาแสดงบนเว็บอยู่แล้ว</p>
<p>- Read-Random Buffer Size คือหร่วมความจำที่ MySQL จะใช้เก็บค่าจากตารางแบบไม่ต่อเนื่อง (เช่นผลการ Sort) ควรจะใหญ่กว่า Read Buffer</p>
<p>ของผมไม่ค่อยได้ใช้ MyISAM ค่าต่างๆ นี้เลยไม่ได้ Set เอาไว้มากนัก ครับ เดี๋ยวไปต่อภาค 4 เรื่องของ tmp_table ครับ</p>
<p><span style="color: blue;"><span style="font-weight: bold;">ภาคที่ 4</span></span><br />
ในภาดนี้เราจะพูดถึง tmp_table ปกติแล้วในการ Complex Query นั้น MySQL จะทำการสร้างตารางผลลัทธ์ขึ้นมาในหน่วยความจำเป็น เป็น TABLE แบบ HEAP แต่ถ้าตารางมีขนาดใหญ่กว่าค่าค่าหนึ่ง MySQL จะคัดลอกตารางนั้นลง Disk เป็น MyISAM TABLE ครับ เราจะมาดูค่าค่านั้นกันครับ</p>
<p>ก่อนที่จะไปไกลกว่านั้น เรามาพูดถึง Complex Query ก่อนครับ โดยมากเราจะพูดถึง Query ที่มีการใช้ GROUP BY, UNIQUE, LIKE และที่ไม่แน่ใจคือ SUB SELECT ครับ</p>
<p>วิธีการดูว่ามีการ Swap ลงหน่วยความจำมากน้อยแค่ไหน สามารถดูได้จาก<br />
Created tmp disk tables 14652<br />
Created tmp tables 222220</p>
<p>โดยเมื่อมีการสร้าง tmp_table MySQL จะเพิ่มค่า Created tmp tables ครับ และถ้ามีการ Swap ลง Disk จะเพิ่มค่า Created tmp disk tables ปกติ ถ้านำสองค่านี้มาหารกัน คูณ ร้อย ไม่ควรจะเกิน 5-10% ครับ ขึ้นอยู่กับว่าตารางที่คุณใช้ใหญ่เล็กอย่างไร มีความซับซ้อนมากแค่ไหน</p>
<p>ตัวแปรที่จะควบคุมการ Swap จะมี 2 ตัวคือ</p>
<p>tmp_table_size=32M<br />
max_tmp_tables=32</p>
<p>โดยถ้า tmp_table ใหญ่กว่า tmp_table_size จะ Swap ลง Disk ครับ หรือถ้ามีจำนวน tmp_table มากกว่า max_tmp_tables ก็จะ Swap ลง Disk เช่นกันครับ<br />
ค่า tmp_table_size ปกติเป็น 32M และ max_tmp_tables จะเป็น 32 ครับ คุณไม่ควร Setup ให้สูงกว่า 2 เท่าของค่าปกติ แต่แนะนำให้ลองไปตรวจสอบครับว่าโปรแกรมของคุณมีทางที่จะ Optimize Query ได้มากแค่ไหน หรือ จะใช้วิธีการ Cache ผมลัพธ์ของหน้าเว็บเข้ามาช่วยก็ได้ครับ</p>
<p><span style="color: blue;"><span style="font-weight: bold;">ภาคที่ 5 </span></span>- Key Buffer แบบเชิงลึก</p>
<p>Key Buffer คือหน่วยความจำที่ MySQL จองไว้หนเดียว แล้วใช้งานแชร์กันทุกๆ Process (ดังที่ได้พูดไว้ก่อนหน้านี้ครับ)</p>
<p>แต่เราจะมาพูดถึงประสิทธิภาพของ Key กันครับ ค่าที่น่าสนใจคือ</p>
<p>Key blocks unused 27683<br />
Key blocks used 1312<br />
Key read requests 1318393<br />
Key reads 1344</p>
<p>คู่แรกจะบอกว่า Key Buffer ของคุณใช้งานไปมากน้อยแค่ใด ปกติแล้ว Key Blocks Unused จะไม่มากครับหรือเป็น 0 เลยก็ได้ อย่างตัวอย่างแสดงว่าเรากำหนดค่า Key_Buffer มากเกินไปครับ</p>
<p>คู่ที่สองถ้าเอา (Key read requests - Key reads) * 100 / Key read requests เราจะเรียกว่า Key Hits Rate ครับ อย่างตัวอย่างคือ 99.9 ครับ แสดงว่า Key Hits Rate ดีมากครับ ปกติแล้วจะอยู่ที่ประมาณ 95 - 99% ครับ ถ้าน้อยกว่านี้แนะนำให้เพิ่ม Key_Buffer ครับ สำหรับ Key Hits Rate นั้นจะต้องคิดเมื่อทำงาน MySQL ไปแล้วสักพักนะครับ อาจจะ 2-3 วัน ครับ</p>
<p><span style="color: blue;"><span style="font-weight: bold;">ภาคที่ 6 </span></span>- Table Cache</p>
<p>สำหรับ Table Cache นั้นเป็นการเปิด Handle ของ Table ทิ้งเอาไว้ครับ เพื่อการเข้าถึงข้อมูลใน Table ได้อย่างรวดเร็วครับ แต่ถ้าคุณเพิ่มค่านี้มากๆ คุณอาจจะเกิดปัญหาว่า File Descriptor ไม่พอครับ ถ้าผมจำไม่ผิดแนะนำให้เพิ่ม File Descriptor ได้จากการแก้ไขตัวแปร Kernel ที่ /proc/sys/fs/file-max ครับโดยการใช้คำสั่ง</p>
<p>echo 392604 &gt; /proc/sys/fs/file-max</p>
<p>ผมไม่แน่ใจว่าการใช้คำสั่ง ulimit จะได้ผลเหมือนกันหรือไม่</p>
<p>กลับมาต่อที่ table_cache ปกติแล้วถ้าในระบบที่มีตารางมากๆ table_cache ควรจะครอบคลุมตารางพื้นฐานทั้งหมด และอีกประมาณ 50% ของตารางที่เหลือ แต่ถ้าเป็นไปได้จะครอบคลุมทั้งหมดเลยก็ไม่ผิดแต่อย่างใด อย่างของผมเอง set ไว้ที่ 1024 เลยครับ</p>
<p>วิธีการจะดูว่า set ไว้น้อยเกินไปหรือเปล่า ให้ดูที่</p>
<p>Open tables 1024<br />
Opened tables 1120</p>
<p>โดย Open tables คือจำนวน Table ที่เปิดอยู่ขณะนี้ และ Opened tables คือจำนวน Table ที่เปิดมาทั้งหมด นับตั้งแต่เริ่ม MySQL Server มา โดยถ้าค่าของ Opened tables เพิ่มเร็วเกินไป แนะนำให้เพิ่มค่า table_cache ครับ</p>
<p>วิธีการปรับค่า table cache ทำได้โดย เพิ่มบรรทัดนี้ใน my.cnf</p>
<p>table_cache=1024</p>
<p><span style="color: blue;"><span style="font-weight: bold;">ภาคที่ 7 Query Cache</span></span></p>
<p>Query Cache นั้นเป็นคุณสมบัติใหม่ที่มีใน MySQL รุ่นที่ 4.x ขึ้นมาครับ</p>
<p>Query Cache ทำงานง่ายๆ คือ ถ้ามี Query เหมือนเดิม MySQL จะเรียกจาก Cache แทนที่จะไป Query ใหม่ครับ</p>
<p>แต่ Query Cache ไม่ได้มีประโยชน์กับทุก Database Structure นะครับ Query Cache เหมาะกับ Table ที่ไม่ค่อยได้ Update แต่มีจำนวน Records เป็นจำนวนมาก เช่น 50,000 records ขึ้นไป Query Cache จะใช้กับ Select เท่านั้นครับ ถ้าระบบของคุณแตกต่างจากนี้การใช้ Query Cache อาจจะทำให้ได้ผลตรงกันข้ามก็ได้ครับ</p>
<p>วิธีการเปิดใช้งาน Query Cache ให้ใส่บรรทัดนี้ลงใน my.cnf ครับ</p>
<p>query_cache_type=1<br />
query_cache_size=32M</p>
<p>query_cache_type จะมีได้ 3 ค่าคือ<br />
0 - ปิด Query Cache<br />
1 - เปิด Query Cache คุณสามารถสั่งให้ไม่ต้อง Cache ได้โดยการใช้ &#8220;SELECT SQL_NO_CACHE&#8221;<br />
2 - แบบ On Demand คุณสามารถสั่งให้ MySQL Cache โดยการใช้ &#8220;SELECT SQL_CACHE&#8221;</p>
<p>ปกติแล้วถ้า Table มีการ Update แล้ว MySQL จะลบ Cache ของ Table นั้นๆ ทั้งหมดทันที และ Query Cache นั้นเป็น Case Sensitive ครับ ดังนั้น</p>
<p>SELECT * FROM a WHERE b=1</p>
<p>กับ</p>
<p>select * from a where b=1</p>
<p>จะไม่เหมือนกันนะครับ ถ้าเราเรียกตัวแรกแล้วเรียกตัวที่ 2 ตัวที่ 2 จะไม่ได้เรียกจาก Cache</p>
<p>ดังนั้นถ้า<br />
1. ในระบบของคุณมีการเขียน SQL แบบไม่ได้วางแผนเรืองตัวใหญ่ตัวเล็ก คุณจะได้รับประโยชน์จาก Query Cache น้อยลง<br />
2. ถ้า Table หลักๆ ของคุณมีการ Update ตลอดเวลา คุณจะได้รับประโยชน์จาก Query Cache น้อยลง<br />
3. ถ้า Table หลักๆ ของคุณไม่ได้มีจำนวน Records มากคุณก็แทบจะไม่ได้รับประโยชน์จาก Query Cache เลยครับ</p>
<p>แหล่งที่มา<br />
<a href="http://www.thaiadmin.org/board/index.php?topic=18693.new" target="_blank">http://www.thaiadmin.org/board/index.php?topic=18693.new</a><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/09/08/%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%a5%e0%b8%b0%e0%b9%80%e0%b8%ad%e0%b8%b5%e0%b8%a2%e0%b8%94-%e0%b8%81%e0%b8%b2%e0%b8%a3-config-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>สร้าง user สำหรับแบ่งพื้นที่ทำ website</title>
		<link>http://voice.zeednetwork.com/2008/08/30/%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87-user-%e0%b8%aa%e0%b8%b3%e0%b8%ab%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b9%81%e0%b8%9a%e0%b9%88%e0%b8%87%e0%b8%9e%e0%b8%b7%e0%b9%89%e0%b8%99%e0%b8%97%e0%b8%b5/</link>
		<comments>http://voice.zeednetwork.com/2008/08/30/%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87-user-%e0%b8%aa%e0%b8%b3%e0%b8%ab%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b9%81%e0%b8%9a%e0%b9%88%e0%b8%87%e0%b8%9e%e0%b8%b7%e0%b9%89%e0%b8%99%e0%b8%97%e0%b8%b5/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 17:35:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[apache]]></category>

		<category><![CDATA[adduser]]></category>

		<category><![CDATA[http-userdir]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=53</guid>
		<description><![CDATA[ปรับแต่ง config apache ที่ file http.conf
 
UserDir public_html
UserDir disabled root toor daemon operator bin tty kmem games news man sshd bind proxy _pflogd _dhcp uucp pop www nobody mailnull smmsp
&#60;Directory &#8220;/home/*/public_html&#8221;&#62;
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    &#60;Limit GET POST OPTIONS&#62;
        Order allow,deny
        Allow from all
    &#60;/Limit&#62;
    &#60;LimitExcept GET POST OPTIONS&#62;
        Order [...]]]></description>
			<content:encoded><![CDATA[<p>ปรับแต่ง config apache ที่ file http.conf</p>
<p> </p>
<p>UserDir public_html<br />
UserDir disabled root toor daemon operator bin tty kmem games news man sshd bind proxy _pflogd _dhcp uucp pop www nobody mailnull smmsp</p>
<p>&lt;Directory &#8220;/home/*/public_html&#8221;&gt;<br />
    AllowOverride FileInfo AuthConfig Limit Indexes<br />
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec<br />
    &lt;Limit GET POST OPTIONS&gt;<br />
        Order allow,deny<br />
        Allow from all<br />
    &lt;/Limit&gt;<br />
    &lt;LimitExcept GET POST OPTIONS&gt;<br />
        Order deny,allow<br />
        Deny from all<br />
    &lt;/LimitExcept&gt;<br />
&lt;/Directory&gt;</p>
<p>&lt;Directory &#8220;/home/*/public_html/cgi-bin&#8221;&gt;<br />
  AllowOverride None<br />
  Options ExecCGI -MultiViews +SymLinksIfOwnerMatch<br />
  Order allow,deny<br />
  Allow from all<br />
&lt;/Directory&gt;</p>
<p>  </p>
<p>เพิ่ม user โดยใช้ shell</p>
<p>//////in the shell///<br />
adduser mike<br />
su - mike<br />
cd /home/mike<br />
mkdir -p /home/mike/public_html/cgi-bin<br />
mkdir -p /home/mike/logs<br />
ln -s public_html www<br />
chmod 755 public_html<br />
chmod a+r public_html/*<br />
cd /home/<br />
chmod 711 mike<br />
//////end in the shell///</p>
<p>//now edit your httpd.conf//</p>
<p>&lt;VirtualHost *:80&gt;<br />
ServerName mike.server.com<br />
ServerAdmin <a href="mailto:mike@server.com"><span style="color: #22229c;">mike@server.com</span></a><br />
DocumentRoot /home/mike/www<br />
TransferLog /home/mike/logs/access-log<br />
ScriptAlias /cgi-bin/ /home/mike/www/cgi-bin/<br />
&lt;/VirtualHost&gt;</p>
<p>///end//////////////</p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/08/30/%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87-user-%e0%b8%aa%e0%b8%b3%e0%b8%ab%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b9%81%e0%b8%9a%e0%b9%88%e0%b8%87%e0%b8%9e%e0%b8%b7%e0%b9%89%e0%b8%99%e0%b8%97%e0%b8%b5/feed/</wfw:commentRss>
		</item>
		<item>
		<title>กำหนดสิทธิ์ให้ Mysql</title>
		<link>http://voice.zeednetwork.com/2008/08/27/%e0%b8%81%e0%b8%b3%e0%b8%ab%e0%b8%99%e0%b8%94%e0%b8%aa%e0%b8%b4%e0%b8%97%e0%b8%98%e0%b8%b4%e0%b9%8c%e0%b9%83%e0%b8%ab%e0%b9%89-mysql/</link>
		<comments>http://voice.zeednetwork.com/2008/08/27/%e0%b8%81%e0%b8%b3%e0%b8%ab%e0%b8%99%e0%b8%94%e0%b8%aa%e0%b8%b4%e0%b8%97%e0%b8%98%e0%b8%b4%e0%b9%8c%e0%b9%83%e0%b8%ab%e0%b9%89-mysql/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 05:54:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<category><![CDATA[grant]]></category>

		<category><![CDATA[grant mysql]]></category>

		<category><![CDATA[กำหนดสิทธิ์ mysql]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=51</guid>
		<description><![CDATA[server01# mysql - u root -p  เข้าระบบ
  mysql&#62; GRANT all  ON customer.* TO custom@&#8217;%&#8217;  IDENTIFIED BY &#8216;manager&#8217;;
  mysql&#62; FLUSH PRIVILEGES;
กำหนดให้ มีสิทธ์ ทุก database ทุก table โดยมี user ชื่อ custom สามารถเข้าได้ จากทุก ip และมี password คือ manager

]]></description>
			<content:encoded><![CDATA[<p>server01# <span style="color: #333399;">mysql - u root -p  เข้าระบบ</span><br />
<span style="color: #800000;">  mysql&gt; <strong>GRANT all </strong><strong> ON customer.* </strong><strong>TO <a href="mailto:custom@'%'">custom@&#8217;%&#8217;</a>  </strong><strong>IDENTIFIED BY &#8216;manager&#8217;;</strong></span></p>
<p><span style="color: #800000;"><strong>  </strong>mysql&gt; <strong>FLUSH PRIVILEGES;</strong></span></p>
<p><strong><span style="color: #333399;">กำหนดให้ มีสิทธ์ ทุก database ทุก table โดยมี user ชื่อ custom สามารถเข้าได้ จากทุก ip และมี password คือ manager</span></strong></p>
<p><strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/08/27/%e0%b8%81%e0%b8%b3%e0%b8%ab%e0%b8%99%e0%b8%94%e0%b8%aa%e0%b8%b4%e0%b8%97%e0%b8%98%e0%b8%b4%e0%b9%8c%e0%b9%83%e0%b8%ab%e0%b9%89-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>การติดตั้ง Plugin WP-Cache ให้ Wordpress</title>
		<link>http://voice.zeednetwork.com/2008/08/21/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-plugin-wp-cache-%e0%b9%83%e0%b8%ab%e0%b9%89-wordpress/</link>
		<comments>http://voice.zeednetwork.com/2008/08/21/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-plugin-wp-cache-%e0%b9%83%e0%b8%ab%e0%b9%89-wordpress/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 06:36:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[cms]]></category>

		<category><![CDATA[cache wordpress]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=46</guid>
		<description><![CDATA[1.ให้ทำการ ดาวน์โหลด WP-Cache
2.นำมา unzip แล้วทำการ upload folder ไว้ที่ /wp-content/plugins/
3.ทำการแก้ไข file wp-config.php โดยการเพิ่ม define(&#8217;WP_CACHE&#8217;, true);
4.ทำการ chmod 777 wp-content เพื่อให้สามารถ สร้าง folder cache และ สร้าง file cache
5.login ที่ wp-admin และไปที่เมนู Plugins ให้คลิกที่ Activate WP-Cache Plugin
6.ที่ setting จะมี tap wp-cache แสดงขึ้นมา ให้ไปที่ tap นั้นแล้วทำการ Enable it เพื่อทำการใช้งาน
หมายเหตุ ถ้ามีปัญหากี่ยวกับ file advanced-cache.php ใน folder wp-content ไม่เจอ ก็ให้ทำการ link file จาก [...]]]></description>
			<content:encoded><![CDATA[<p>1.ให้ทำการ ดาวน์โหลด <a href="http://mnm.uib.es/gallir/wp-cache-2/">WP-Cache</a><br />
2.นำมา unzip แล้วทำการ upload folder ไว้ที่ /wp-content/plugins/<br />
3.ทำการแก้ไข file wp-config.php โดยการเพิ่ม define(&#8217;WP_CACHE&#8217;, true);<br />
4.ทำการ chmod 777 wp-content เพื่อให้สามารถ สร้าง folder cache และ สร้าง file cache<br />
5.login ที่ wp-admin และไปที่เมนู Plugins ให้คลิกที่ Activate WP-Cache Plugin<br />
6.ที่ setting จะมี tap wp-cache แสดงขึ้นมา ให้ไปที่ tap นั้นแล้วทำการ Enable it เพื่อทำการใช้งาน</p>
<p><strong>หมายเหตุ</strong> ถ้ามีปัญหากี่ยวกับ file advanced-cache.php ใน folder wp-content ไม่เจอ ก็ให้ทำการ link file จาก /wp-content/plugins/wp-cache/wp-cache-phase1.php มา ไว้ที่ wp-content/advanced-cache.php</p>
<p><strong>ตัวอย่าง</strong> ln -s /your root/wp-content/plugins/wp-cache/wp-cache-phase1.php /your root/wp-content/advanced-cache.php</p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/08/21/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-plugin-wp-cache-%e0%b9%83%e0%b8%ab%e0%b9%89-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>VieTrio วีทรีโอ เล่นสด</title>
		<link>http://voice.zeednetwork.com/2008/08/15/vietrio-%e0%b8%a7%e0%b8%b5%e0%b8%97%e0%b8%a3%e0%b8%b5%e0%b9%82%e0%b8%ad-%e0%b9%80%e0%b8%a5%e0%b9%88%e0%b8%99%e0%b8%aa%e0%b8%94/</link>
		<comments>http://voice.zeednetwork.com/2008/08/15/vietrio-%e0%b8%a7%e0%b8%b5%e0%b8%97%e0%b8%a3%e0%b8%b5%e0%b9%82%e0%b8%ad-%e0%b9%80%e0%b8%a5%e0%b9%88%e0%b8%99%e0%b8%aa%e0%b8%94/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 19:12:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ประทับใจ]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.com/?p=36</guid>
		<description><![CDATA[
 

]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="620" height="380" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="bgcolor" value="#000000" /><param name="src" value="http://video.sanook.com/player/playerver1.swf?contentId=381297&amp;autoplay=false&amp;repeats=false&amp;embed=true" /><embed type="application/x-shockwave-flash" width="620" height="380" src="http://video.sanook.com/player/playerver1.swf?contentId=381297&amp;autoplay=false&amp;repeats=false&amp;embed=true" bgcolor="#000000"></embed></object></p>
<p> </p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="620" height="380" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="bgcolor" value="#000000" /><param name="src" value="http://video.sanook.com/player/playerver1.swf?contentId=381173&amp;autoplay=false&amp;repeats=false&amp;embed=true" /><embed type="application/x-shockwave-flash" width="620" height="380" src="http://video.sanook.com/player/playerver1.swf?contentId=381173&amp;autoplay=false&amp;repeats=false&amp;embed=true" bgcolor="#000000"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/08/15/vietrio-%e0%b8%a7%e0%b8%b5%e0%b8%97%e0%b8%a3%e0%b8%b5%e0%b9%82%e0%b8%ad-%e0%b9%80%e0%b8%a5%e0%b9%88%e0%b8%99%e0%b8%aa%e0%b8%94/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Apache Status Codes และ Error Codes</title>
		<link>http://voice.zeednetwork.com/2008/06/23/apache-status-codes-%e0%b9%81%e0%b8%a5%e0%b8%b0-error-codes/</link>
		<comments>http://voice.zeednetwork.com/2008/06/23/apache-status-codes-%e0%b9%81%e0%b8%a5%e0%b8%b0-error-codes/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 07:57:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.net/?p=11</guid>
		<description><![CDATA[ 

Informational 
100 Continue 
101 Switching Protocols 
Successful 
200 OK 
201 Created 
202 Accepted 
203 Non-Authoritative Information 
204 No Content 
205 Reset Content 
206 Partial Content 
Redirection 
300 Multiple Choices 
301 Moved Permanently 
302 Moved Temporarily 
303 See Other 
304 Not Modified 
305 Use Proxy 
Client Error 
400 Bad Request 
401 Unauthorized 
402 Payment Required 
403 [...]]]></description>
			<content:encoded><![CDATA[<p> <a href="http://voice.zeednetwork.com/wp-content/uploads/2008/08/faboslogoapache20015011.jpg"><img class="alignnone size-thumbnail wp-image-31" title="faboslogoapache20015011" src="http://voice.zeednetwork.com/wp-content/uploads/2008/08/faboslogoapache20015011-150x150.jpg" alt="" width="150" height="150" /></a></p>
<dl style="width: 160px;">
<dt><a href="http://voice.zeednetwork.com/wp-content/uploads/2008/08/feather.gif"></a><a href="http://voice.zeednetwork.com/wp-content/uploads/2008/08/faboslogoapache20015011.jpg"></a><a href="http://voice.zeednetwork.com/wp-content/uploads/2008/08/faboslogoapache20015011.jpg"></a>Informational </dt>
<dd>100 Continue </dd>
<dd>101 Switching Protocols </dd>
<dt>Successful </dt>
<dd>200 OK </dd>
<dd>201 Created </dd>
<dd>202 Accepted </dd>
<dd>203 Non-Authoritative Information </dd>
<dd>204 No Content </dd>
<dd>205 Reset Content </dd>
<dd>206 Partial Content </dd>
<dt>Redirection </dt>
<dd>300 Multiple Choices </dd>
<dd>301 Moved Permanently </dd>
<dd>302 Moved Temporarily </dd>
<dd>303 See Other </dd>
<dd>304 Not Modified </dd>
<dd>305 Use Proxy </dd>
<dt>Client Error </dt>
<dd>400 Bad Request </dd>
<dd>401 Unauthorized </dd>
<dd>402 Payment Required </dd>
<dd>403 Forbidden </dd>
<dd>404 Not Found </dd>
<dd>405 Method Not Allowed </dd>
<dd>406 Not Acceptable </dd>
<dd>407 Proxy Authentication Required </dd>
<dd>408 Request Timeout </dd>
<dd>409 Conflict </dd>
<dd>410 Gone </dd>
<dd>411 Length Required </dd>
<dd>412 Precondition Failed </dd>
<dd>413 Request Entity Too Large </dd>
<dd>414 Request-URI Too Long </dd>
<dd>415 Unsupported Media Type </dd>
<dt>Server Error 5xx </dt>
<dd>500 Internal Server Error </dd>
<dd>501 Not Implemented </dd>
<dd>502 Bad Gateway </dd>
<dd>503 Service Unavailable </dd>
<dd>504 Gateway Timeout </dd>
<dd>505 HTTP Version Not Supported </dd>
</dl>
<p> </p>
<p>ref : <a href="http://www.gootum.com"><span style="color: #003366;">http://www.gootum.com</span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/06/23/apache-status-codes-%e0%b9%81%e0%b8%a5%e0%b8%b0-error-codes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>บีบอัด แตก ไฟล์แต่ล่ะแบบ gz bz2</title>
		<link>http://voice.zeednetwork.com/2008/05/29/%e0%b8%9a%e0%b8%b5%e0%b8%9a%e0%b8%ad%e0%b8%b1%e0%b8%94-%e0%b9%81%e0%b8%95%e0%b8%81-%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%81%e0%b8%95%e0%b9%88%e0%b8%a5%e0%b9%88%e0%b8%b0%e0%b9%81%e0%b8%9a%e0%b8%9a/</link>
		<comments>http://voice.zeednetwork.com/2008/05/29/%e0%b8%9a%e0%b8%b5%e0%b8%9a%e0%b8%ad%e0%b8%b1%e0%b8%94-%e0%b9%81%e0%b8%95%e0%b8%81-%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%81%e0%b8%95%e0%b9%88%e0%b8%a5%e0%b9%88%e0%b8%b0%e0%b9%81%e0%b8%9a%e0%b8%9a/#comments</comments>
		<pubDate>Wed, 28 May 2008 19:50:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://voice.zeednetwork.net/?p=9</guid>
		<description><![CDATA[
ฟอร์แมตแรกที่จะแนะนำก็คือ gzip ย่อมาจาก GNU zip คำสั่งก็ตรงไปตรงมาครับ ก็คือ
gzip filename.txt
หลังจากกด enter ไปไฟล์ filename.txt ของเราจะหายไป แล้วกลายร่างเป็น filename.txt.gz เสียแล้ว
แต่ใครยังอยากเก็บไฟล์ต้นฉบับไว้อยู่ก็ให้ใส่ -c เข้าไปซึ่งเป็นการบอกให้ gzip แสดงเข้ามาออกทาง
standard output จากนั้นเราก็ทำการเปลี่ยนทิศทางไปยังไฟล์ที่เราต้องการ
gzip -c filename.txt &#62; filename.txt.gz
ผลลัพธ์ที่ได้ก็จะเหมือนกับคำสั่งแรกต่างกันที่ต้นฉบับเรายังอยู่ ไม่ไปไหน
และถ้าเราอยากให้ไฟล์ที่ได้บีบกันแบบสุดๆ ก็ให้ใส่ -9 แต่ถ้าอยากได้ความเร็วก็ใส่ -1
จริงแล้วเราสามารถใช้ค่าได้ตั้งแต่ -1 ถึง -9 อย่างเช่น
gzip -9 filename.txt
แต่ถ้าใครอยากใช้ -9 ตลอดแต่ไม่อยากพิมพ์ทุกครั้งก็ให้เซ็น environment variable ดังนี้
export GZIP=&#8221;-9&#8243;
อะพอเราบีบเสร็จ ก็ต้องทำการแตกไฟล์ ก็ทำโดย
gunzip filename.txt.gz
และเหมือนเดิมไฟล์ .gz จะหายไป ถ้าไม่อยากให้หายก็ต้องทำอย่างนี้
gzip -c filename.txt.gz &#62; filename.txt
เป็นยังไงสำหรับฟอร์แมตแรก ใช้ไม่อยากเลย อะฟอร์แมตที่สองที่จะแนะนำก็คงเป็น bzip2 [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_25" class="wp-caption alignleft" style="width: 188px"><a href="http://voice.zeednetwork.com/wp-content/uploads/2008/08/beastie.png"><img class="size-medium wp-image-25 " title="beastie" src="http://voice.zeednetwork.com/wp-content/uploads/2008/08/beastie.png" alt="" width="178" height="196" /></a><p class="wp-caption-text">null</p></div>
<p><a title="dell sc1435" href="http://voice.zeednetwork.net/wp-content/uploads/2008/06/sc1435_500.jpg"></a>ฟอร์แมตแรกที่จะแนะนำก็คือ gzip ย่อมาจาก GNU zip คำสั่งก็ตรงไปตรงมาครับ ก็คือ</p>
<p>gzip filename.txt<a href="http://voice.zeednetwork.com/wp-content/uploads/2008/08/beastie.png"></a></p>
<p>หลังจากกด enter ไปไฟล์ filename.txt ของเราจะหายไป แล้วกลายร่างเป็น filename.txt.gz เสียแล้ว<br />
แต่ใครยังอยากเก็บไฟล์ต้นฉบับไว้อยู่ก็ให้ใส่ -c เข้าไปซึ่งเป็นการบอกให้ gzip แสดงเข้ามาออกทาง<br />
standard output จากนั้นเราก็ทำการเปลี่ยนทิศทางไปยังไฟล์ที่เราต้องการ</p>
<p>gzip -c filename.txt &gt; filename.txt.gz</p>
<p>ผลลัพธ์ที่ได้ก็จะเหมือนกับคำสั่งแรกต่างกันที่ต้นฉบับเรายังอยู่ ไม่ไปไหน<br />
และถ้าเราอยากให้ไฟล์ที่ได้บีบกันแบบสุดๆ ก็ให้ใส่ -9 แต่ถ้าอยากได้ความเร็วก็ใส่ -1<br />
จริงแล้วเราสามารถใช้ค่าได้ตั้งแต่ -1 ถึง -9 อย่างเช่น</p>
<p>gzip -9 filename.txt</p>
<p>แต่ถ้าใครอยากใช้ -9 ตลอดแต่ไม่อยากพิมพ์ทุกครั้งก็ให้เซ็น environment variable ดังนี้</p>
<p>export GZIP=&#8221;-9&#8243;</p>
<p>อะพอเราบีบเสร็จ ก็ต้องทำการแตกไฟล์ ก็ทำโดย</p>
<p>gunzip filename.txt.gz</p>
<p>และเหมือนเดิมไฟล์ .gz จะหายไป ถ้าไม่อยากให้หายก็ต้องทำอย่างนี้</p>
<p>gzip -c filename.txt.gz &gt; filename.txt</p>
<p>เป็นยังไงสำหรับฟอร์แมตแรก ใช้ไม่อยากเลย อะฟอร์แมตที่สองที่จะแนะนำก็คงเป็น bzip2 นั่นเอง<br />
ซึ่งอันนี้มาทีหลัง gzip แต่บีบได้เล็กกว่า รูปแบบคำสั่งก็จะคล้ายกัน ดังนี้</p>
<p>bzip2 filename.txt</p>
<p>เราก็จะได้ filename.txt.bz2 มา แต่ไฟล์ต้นฉบับก็จะหายไป<br />
ถ้าไม่อยากให้หายไม่ต้องทำการเปลี่ยนทิศทางให้เมื่อยเหมือน gzip เพราะมี option -k มาให้ k ย่อมาจาก<br />
keep ก็ใช้ง่ายๆ ดังนี้</p>
<p>bzip2 -k filename.txt</p>
<p>และเหมือนกันกับ gzip ซึ่งมีระดับการบีบอัด ตั้งแต่ 1 ถึง 9 ซึ่ง 1 จะใช้เวลาน้อยที่สุด ส่วน 9<br />
จะบีบอัดได้สูงสุด</p>
<p>bzip2 -9 filename.txt</p>
<p>ไหนๆ ก็เหมือนกันมาเยอะแล้ว ก็ต้องกำหนดค่า default ได้โดย</p>
<p>export BZIP2=&#8221;-9&#8243;</p>
<p>และถ้าเราอยากแตกไฟล์ออกก็ใช้คำสั่ง</p>
<p>bunzip2 filename.txt.bz2</p>
<p>ซึ่งไฟล์ .bz2 ก็จะหายไป ถ้าไม่อยากให้หายก็ใส่ -k ไปด้วยน้า</p>
<p>มาถึงคำสั่งสำคัญอีกคำสั่ง คือ คำสั่ง tar คำสั่งนี้ไม่ได้มีการบีบอัดใดๆ แต่จะเป็นการรวมไฟล์หลายๆ<br />
ไฟล์ไว้เป็นไฟล์เดียวกัน รูปแบบคำสั่งก็จะเป็นดังนี้</p>
<p>tar -cvf test.tar filename.txt mydir</p>
<p>คำสั่งขั้นบนจะเป็นการนำไฟล์ filename และไดเร็กทอรี่ mydir มา tar แล้วเก็บไว้ในชื่อไฟล์ text.tar โดย<br />
option c หมายถึงเป็นการสร้างไฟล์ tar -v เป็นการแสดงรายละเอียดขณะทำงาน และ -f<br />
หมายถึงระบุชื่อไฟล์ที่เราต้องซึ่งก็คือ test.tar</p>
<p>อะและถ้าเราต้องการ extract ไฟล์ก็ทำได้โดย</p>
<p>tar -xvf test.tar</p>
<p>ซึ่ง -x หมายถึงการ extract นั่นเอง ขั้นตอนต่อไปจะเป็นการรวมพลังกันระหว่างการบีบอัดและการ tar<br />
ถ้าเราต้องการรวมพลัง tar กับ gzip ก็ใช้คำสั่ง</p>
<p>tar -cvzf test.tar.gz filename.txt mydir</p>
<p>ซึ่งเราจะ tar ไฟล์ filename.txt และไดเร็กทอรี่ก่อน แล้วจึงทำการบีบอัดด้วย gzip แต่ถ้าใครชอบ bzip2<br />
ก็ให้ใช้คำสั่</p>
<p>tar -cvjf test.tar.bz2 filename.txt mydir</p>
<p>จะเห็นว่าถ้าเป็น gzip เราจะใช้ option -z แต่ถ้าเป็น bzip2 จะเป็น -j อะดังนั้นถ้าเราต้องการ extract<br />
ก็ให้ใช้คำสั่ง สำหรับ gzip</p>
<p>tar -xvzf test.tar.gz</p>
<p>และ bzip2 ก็จะเป็น</p>
<p>tar -xvjf test.tar.gz</p>
<p>เรียบร้อยครับ เป็นยังไงใช้กันไม่อยากครับ ตรงไปตรงมา ไปและ</p>
<p>ref : <a href="http://www.logicdream.com/">http://www.logicdream.com</a></p>
<p><a title="dell sc1435" rel="attachment wp-att-10" href="http://voice.zeednetwork.com/2008/05/29/%e0%b8%9a%e0%b8%b5%e0%b8%9a%e0%b8%ad%e0%b8%b1%e0%b8%94-%e0%b9%81%e0%b8%95%e0%b8%81-%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%81%e0%b8%95%e0%b9%88%e0%b8%a5%e0%b9%88%e0%b8%b0%e0%b9%81%e0%b8%9a%e0%b8%9a/dell-sc1435/"></a><a title="dell sc1435" rel="attachment wp-att-10" href="http://voice.zeednetwork.com/2008/05/29/%e0%b8%9a%e0%b8%b5%e0%b8%9a%e0%b8%ad%e0%b8%b1%e0%b8%94-%e0%b9%81%e0%b8%95%e0%b8%81-%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%81%e0%b8%95%e0%b9%88%e0%b8%a5%e0%b9%88%e0%b8%b0%e0%b9%81%e0%b8%9a%e0%b8%9a/dell-sc1435/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://voice.zeednetwork.com/2008/05/29/%e0%b8%9a%e0%b8%b5%e0%b8%9a%e0%b8%ad%e0%b8%b1%e0%b8%94-%e0%b9%81%e0%b8%95%e0%b8%81-%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%81%e0%b8%95%e0%b9%88%e0%b8%a5%e0%b9%88%e0%b8%b0%e0%b9%81%e0%b8%9a%e0%b8%9a/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
