<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>丫忠的伺服器</title>
	<atom:link href="http://homeserver.com.tw/feed/" rel="self" type="application/rss+xml" />
	<link>http://homeserver.com.tw</link>
	<description>提供工作心得，教學文件的部落格</description>
	<lastBuildDate>Wed, 28 Jul 2010 06:42:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>mysql proxy讀寫分流(二)-加入RW splitting</title>
		<link>http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/</link>
		<comments>http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 07:39:47 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysq loadbalance]]></category>
		<category><![CDATA[mysql proxy]]></category>
		<category><![CDATA[mysql rw splitting]]></category>
		<category><![CDATA[mysql 負載]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=1045</guid>
		<description><![CDATA[上一篇中提到 安裝LUA及MySQL Proxy後，接下來就是RW splitting(讀寫分流)的部份了
整體的概念圖跟上一篇MySQL Proxy安裝方式相同，丫忠再補上一個對應port的圖表：

針對上圖的架構，首先需要了解幾點基本的觀念：

所有寫入(ADD、UPDATE、DELETE)的動作都是針對MySQL Master
所有讀取(SELECT)的動作都是大部分都是在MySQL Slave(部份在MySQL Master，因為涉及到是否同步完成的關係，請見下面 MySQL Proxy如何解決同步延遲問題 的說明)
MySQL Master與MySQL Slave已經建立起 同步(Replication)的機制
MySQL Proxy也一個MySQL 的客戶端(Client)，也是一個MySQL的伺服器端(Server)

如果你對於上面的觀念都已經清楚後，對於上圖的流程我想應該很容易了解。丫忠就流程架構做個簡單說明：
1. 以往 所有應用程式(PHP)存取MySQL都是直接對應至MySQL Master，有了 MySQL Proxy當代理後，現在所有應用程式的連線都是連接至MySQL Proxy
2. 當MySQL Proxy接收到應用程式的SQL語法後，會自動判斷SQL語法是讀取還是寫入，再分別將寫入的SQL語法對應至MySQL Master、將讀取的SQL語法對應至MySQL Slave
3. 寫入MySQL Master的資料會透過Replication機制(binlog)同步至所有的MySQL Slave
看到這裡好像一切都很順利也沒有任何問題，如果你有意識到【當應用程式透過MySQL Proxy寫入資料到MySQL Master後， 此時應用程式又立即讀取剛寫入的資料；但是，MySQL Master還沒有同步至MySQL Slave，那麼應用程式讀取的資料不就是舊的資料嗎？】沒錯，當你有這樣的疑問時，表示你已經深入了解這個架構了，底下先針對MySQl Proxy如何解決同步延遲問題做說明
MySQL Proxy如何解決同步延遲問題
解決方式是在MySQL Master上新增一個自增表(count table)，當MySQL Master接收到更新資料的動作時便會觸發這個觸發器，這個觸發器會更新自增表(count table)中的記錄，如下圖所示：

(圖片來源：http://hi.baidu.com)
因為自增表(count table)也會一起同步(replication)至MySQL Slave，當應用程式透過MySQL Proxy讀取資料時，MySQL Proxy會先向MySQL Master和MySQL Slave的自增表(count table)發送查詢請求，當MySQL Master和MySQL Slave的資料相同時，MySQL Proxy就可以認定MySQL Master和MySQL Slave的資料是一致的，接著把應用程式的請求對應至MySQL Slave主機上，否則就將請求發送至MySQL Master上，如下圖所示：

(圖片來源：http://hi.baidu.com)
透過自增表(count table)的方式就可以解決同步延遲的問題，ok~了解整個架構及克服同步延遲的問題後，再來就是實做的部份啦，底下將說明如何啟動MySQL Proxy及設定相關參數
本章應用一個範例架構來說明RW [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/mysql/mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81%e4%b8%80-mysql-proxy%e7%9a%84%e5%ae%89%e8%a3%9d%e6%96%b9%e5%bc%8f/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(一)-mysql proxy的安裝方式'>mysql proxy讀寫分流(一)-mysql proxy的安裝方式</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/' rel='bookmark' title='Permanent Link: MySQL Replication(Master Slave負載平衡)'>MySQL Replication(Master Slave負載平衡)</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e%e4%ba%8c/' rel='bookmark' title='Permanent Link: mysql(my.cnf)設定檔說明(二)'>mysql(my.cnf)設定檔說明(二)</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql proxy讀寫分流(一)-mysql proxy的安裝方式</title>
		<link>http://homeserver.com.tw/mysql/mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81%e4%b8%80-mysql-proxy%e7%9a%84%e5%ae%89%e8%a3%9d%e6%96%b9%e5%bc%8f/</link>
		<comments>http://homeserver.com.tw/mysql/mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81%e4%b8%80-mysql-proxy%e7%9a%84%e5%ae%89%e8%a3%9d%e6%96%b9%e5%bc%8f/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 02:42:19 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql proxy]]></category>
		<category><![CDATA[mysql rw splitting]]></category>
		<category><![CDATA[mysql負載]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=1036</guid>
		<description><![CDATA[丫忠在上一篇文章中描述到 MySQL Replication 的架構，接著此篇將延伸那個架構再加入 MySQL Proxy來當mysql的代理，那麼要代理那些工作呢？主要是將讀寫分開，讓MySQL Proxy自動判斷來源的指令中是讀取(SELECT)還是寫入(ADD、UPDATE、DELETE)，然後再將寫入的動作移至Master主機，讀取的動作平均移至多台的Slave主機。
當然，如果你的程式中已經將讀取跟寫入的動作已經自動分配至各個不同的mysql，那麼你就可以忽略本篇文章。
MySQL Proxy整體架構的概念圖如下：

(圖片來源：http://kaj.arno.fi)
讓我們先來看一下 MySQL Proxy官網 對於MySQL Proxy的功能及特性的說法如下：
MySQL Proxy is a simple program that sits between your client and MySQL server(s) that can monitor, analyze or transform their communication. Its flexibility allows for unlimited uses; common ones include:

load balancing
failover (故障恢復)
query analysis
query filtering and modification
RW Splitting (http://forge.mysql.com/wiki/MySQL_Proxy_RW_Splitting)
&#8230; and many more

要使用MySQL Proxy除了先了解MySQL Proxy的功能外，再來就是MySQL [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(二)-加入RW splitting'>mysql proxy讀寫分流(二)-加入RW splitting</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/' rel='bookmark' title='Permanent Link: MySQL Replication(Master Slave負載平衡)'>MySQL Replication(Master Slave負載平衡)</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-telnet-ip-3306%e6%b2%92%e6%9c%89%e5%9b%9e%e6%87%89/' rel='bookmark' title='Permanent Link: mysql-telnet ip 3306沒有回應'>mysql-telnet ip 3306沒有回應</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/mysql/mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81%e4%b8%80-mysql-proxy%e7%9a%84%e5%ae%89%e8%a3%9d%e6%96%b9%e5%bc%8f/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL Replication(Master Slave負載平衡)</title>
		<link>http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/</link>
		<comments>http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 09:43:55 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql master slave]]></category>
		<category><![CDATA[mysql replication]]></category>
		<category><![CDATA[mysql 備援]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=1025</guid>
		<description><![CDATA[前陣子丫忠一直在尋找MySQL負載平衡的方式，搞了一陣子後終於暫告一個段落，趁著記憶猶新時趕快做個筆記，給有需要的人參考，自己日後也可以參考啦!
網路上有很多人提供MySQL的負載方式，例如：Master Slave架構、MySQL MMM架構、DRBD、Cluster、HeartBeat&#8230;等一堆MySQL負載平衡的架構，一直MySQL負載平衡的架構，到底要選擇那一個方式才是最好的？
丫忠認為符合自己個人(公司)需求的架構最好，再來是穩定及簡單好維護；如果只是單純的公司形象網站或者是一般個人的Blog，總不能想著要架構Master + Slave，外加MySQL Proxy做讀寫分流，再替Master做個HeartBeat的備援，再後再加幾台memcached來加快搜尋速度&#8230;.等，如果只是為了測試架構倒是可以玩一玩，如果是要用在運作中的主機的話，那丫忠勸您要3思 再3思了，不要搞到後來出問題時找不到問題，或者資料不一致時，到時候拜再多的神也沒用囉&#8230;
講了一堆哩哩扣扣都還沒進入主題，MySQL 的M/S架構(Master Slave)是負載平衡中最基礎的架構，也就是很多的架構都是從此延伸出去，這也是丫忠認為最簡單的架構之一了。如果可以閱讀英文的網友可以直接參考MySQL官網的資料 http://dev.mysql.com/doc/refman/5.0/en/replication.html
MySQL M/S架構的原理大致如下：
1.  新增(Add)、刪除(delete)、修改(update)的動作必須移至Master
2. Master會針對這些動作的語法自動產生binlog 檔案
3. Master會將binlog檔案同步(Replication)至所有的Slave
4. Slave會執行binlog檔案中的SQL語法
原理的圖形概念如下：

(圖形來源：http://baoz.net)
看到這個架構的原理，或者有些網友就想到了，程式中針對MySQL的動作(SELECT、UPDATE、DELETE、ADD&#8230;)都是固定在同一台MySQL中運作，除非是修改程式，否則要怎樣將讀寫分開呢？這個部份就要加入MySQL Proxy的概念了，MySQL Proxy可以自動將讀寫分開，不用修改程式碼，不過本章的重點不是在MySQL Proxy，有興趣的網友可以先參考 http://forge.mysql.com/wiki/MySQL_Proxy
了解MySQL M/S的運作原理之後，再來就是MySQL的設定了，假設要完成的架構如下：

Master：192.168.10.2
Slave：192.168.10.3
只有同步(Replication) 資料庫mytest

MySQL Replication Master設定
Master要做的流程大概如下：
1. 設定 一個同步的帳號(如果是用root，可以忽略此步驟)
2. 設定my.cnf
3. 將資料庫變成唯讀(read only)
4. 將mytest資料匯出(mysqldump或tar)
5.  解除資料唯讀狀態
6. 重新啟動mysql讓剛設定的my.cnf 生效
7. 將匯出的資料拷貝(scp)至slave
下面針對Master流程的部份，做個詳細說明：
1. 設定一個同步的帳號repl，密碼為slavepass，讓repl具有REPLICATION的權限，相關指令如下：
$mysql -u root -p    #進入mysql
mysql&#62;CREATE USER &#8216;repl&#8217;@'%&#8217; IDENTIFIED BY &#8217;slavepass&#8217;;
mysql&#62;GRANT REPLICATION SLAVE ON *.* TO &#8216;repl&#8217;@'%&#8217;;
2. Master主機必須產生binlog檔案，並且指定只有同步 mytest 這個資料庫，/etc/my.cnf 的修改如下：
[mysqld]
server-id [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(二)-加入RW splitting'>mysql proxy讀寫分流(二)-加入RW splitting</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-%e5%90%84%e7%a8%aebinlog_format%e5%84%aa%e7%bc%ba%e9%bb%9e%e6%af%94%e8%bc%83/' rel='bookmark' title='Permanent Link: mysql 各種binlog_format優缺點比較'>mysql 各種binlog_format優缺點比較</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81%e4%b8%80-mysql-proxy%e7%9a%84%e5%ae%89%e8%a3%9d%e6%96%b9%e5%bc%8f/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(一)-mysql proxy的安裝方式'>mysql proxy讀寫分流(一)-mysql proxy的安裝方式</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>mysql(my.cnf)設定檔說明(二)</title>
		<link>http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e%e4%ba%8c/</link>
		<comments>http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e%e4%ba%8c/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 04:12:32 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[my.cnf]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=1018</guid>
		<description><![CDATA[丫忠最近一直在搞mysql的東東，不得不參考大量的設定檔及說明，剛又看到一個關於mysql設定檔相關的說明，再次的轉貼到此給自己及大家參考看看囉!
MySQL資料庫5.0的my.cnf配置選項概述:
 
mysqld程序&#8211;目錄和文件
 basedir = path 使用給定目錄作為根目錄(安裝目錄)。
 character-sets-dir = path 給出存放著字符集的目錄。
 datadir = path 從給定目錄讀取資料庫文件。
 pid-file = filename 為mysqld程序指定一個存放進程ID的文件(僅適用於UNIX/Linux系統)
Init-V腳本需要使用這個文件裡的進程ID結束mysqld進程。
 socket = filename 為MySQL客戶程序與服務器之間的本地通信指定一個套接字文件
(僅適用於UNIX/Linux系統; 默認設置一般是/var/lib/mysql/mysql.sock文件)。
在Windows環境下，如果MySQL客戶與服務器是通過命名管道進行通信的，&#8211;sock選項給出的將是該命名管道的名字(默認設置是MySQL)。
 lower_case_table_name = 1/0 新目錄和資料表的名字是否只允許使用小寫字母; 這個選項在Windows環境下的默認設置是1(只允許使用小寫字母)。
 
mysqld程序&#8211;語言設置
 character-sets-server = name 新資料庫或資料表的默認字符集。為了與MySQL的早期版本保持兼容，這個字符集也可以用&#8211;default-character-set選項給出; 但這個選項已經顯得有點過時了。
 collation-server = name 新資料庫或資料表的默認排序方式。
 lanuage = name 用指定的語言顯示出錯信息。
 
mysqld程序&#8211;通信、網絡、信息安全
 enable-named-pipes 允許Windows 2000/XP環境下的客戶和服務器使用命名管道(named pipe)進行通信。這個命名管道的默認名字是MySQL，但可以用&#8211;socket選項來改變。
 local-infile [=0] 允許/禁止使用LOAD DATA LOCAL語句來處理本地文件。
 myisam-recover [=opt1, opt2, [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e/' rel='bookmark' title='Permanent Link: mysql(my.cnf)設定檔說明'>mysql(my.cnf)設定檔說明</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(二)-加入RW splitting'>mysql proxy讀寫分流(二)-加入RW splitting</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/' rel='bookmark' title='Permanent Link: MySQL Replication(Master Slave負載平衡)'>MySQL Replication(Master Slave負載平衡)</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e%e4%ba%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql 各種binlog_format優缺點比較</title>
		<link>http://homeserver.com.tw/mysql/mysql-%e5%90%84%e7%a8%aebinlog_format%e5%84%aa%e7%bc%ba%e9%bb%9e%e6%af%94%e8%bc%83/</link>
		<comments>http://homeserver.com.tw/mysql/mysql-%e5%90%84%e7%a8%aebinlog_format%e5%84%aa%e7%bc%ba%e9%bb%9e%e6%af%94%e8%bc%83/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 08:05:11 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=1008</guid>
		<description><![CDATA[MySQL 5.1 中，在復制(Replication)方面的改進就是引進了新的複制技術：基於行的複制。 簡言之，這種新技術就是關注表中發生變化的記錄，而非以前的照抄 binlog 模式。 從 MySQL 5.1.12 開始，可以用以下三種模式來實現：基於SQL語句的複制(statement-based replication, SBR)，基於行的複制(row-based replication, RBR)，混合模式複制(mixed-based replication, MBR)。 相應地，binlog的格式也有三種：STATEMENT，ROW，MIXED。MBR 模式中，SBR 模式是默認的。
在運行時可以動態低改變binlog的格式，除了以下幾種情況：
1. 存儲過程或者觸發器中間
2. 啟用了NDB
3. 當前會話試用 RBR 模式，並且已打開了臨時表
如果binlog採用了 MIXED 模式，那麼在以下幾種情況下會自動將binlog的模式由 SBR 模式改成 RBR 模式。
1. 當DML語句更新一個NDB表時
2. 當函數中包含 UUID() 時
3. 2個及以上包含 AUTO_INCREMENT 字段的表被更新時
4. 行任何 INSERT DELAYED 語句時
5. 用 UDF 時
6. 視圖中必須要求使用 RBR 時，例如創建視圖是使用了 UUID() 函數
設定主從復制(Replication)模式的方法非常簡單，只要在以前設定複製配置的基礎上，再加一個參數：
binlog_format=&#8217;STATEMENT&#8217;
#binlog_format=&#8217;ROW&#8217;
#binlog_format=&#8217;MIXED&#8217;
當然了，也可以在運行時動態修改binlog的格式。 例如
mysql> SET SESSION binlog_format = &#8216;STATEMENT&#8217;;
mysql> [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/' rel='bookmark' title='Permanent Link: MySQL Replication(Master Slave負載平衡)'>MySQL Replication(Master Slave負載平衡)</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81%e4%b8%80-mysql-proxy%e7%9a%84%e5%ae%89%e8%a3%9d%e6%96%b9%e5%bc%8f/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(一)-mysql proxy的安裝方式'>mysql proxy讀寫分流(一)-mysql proxy的安裝方式</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(二)-加入RW splitting'>mysql proxy讀寫分流(二)-加入RW splitting</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/mysql/mysql-%e5%90%84%e7%a8%aebinlog_format%e5%84%aa%e7%bc%ba%e9%bb%9e%e6%af%94%e8%bc%83/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql(my.cnf)設定檔說明</title>
		<link>http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e/</link>
		<comments>http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 07:31:57 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[mysql replication]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=1004</guid>
		<description><![CDATA[丫忠最近要來實做mysql Replication的架構，在做之前當然是要先把參考資料都找出來，底下丫忠從網路上爬出來的文章，有針對mysql的設定檔(my.cnf)做中文的說明，剛好可以參考的到!
#BEGIN CONFIG INFO
#DESCR: 4GB RAM,只使用InnoDB, ACID,少量的連接,隊列負載大
#TYPE: SYSTEM
#END CONFIG INFO
#
#此mysql配置文件例子針對4G內存
#主要使用INNODB
#處理複雜隊列並且連接數量較少的mysql服務器
#
#將此文件複製到/etc/my.cnf 作為全局設置,
# mysql-data-dir/my.cnf 作為服務器指定設置
# (@localstatedir@ for this installation) 或者放入
# ~/.my.cnf 作為用戶設置.
#
# 在此配置文件中, 你可以使用所有程序支持的長選項.
# 如果想獲悉程序支持的所有選項
#請在程序後加上』&#8211;help』參數運行程序.
#
# 關於獨立選項更多的細節信息可以在手冊內找到
#
#
#以下選項會被MySQL客戶端應用讀取.
#注意只有MySQL附帶的客戶端應用程序保證可以讀取這段內容.
#如果你想你自己的MySQL應用程序獲取這些值
#需要在MySQL客戶端庫初始化的時候指定這些選項
#
[client]
#password    = [your_password]
port        = @MYSQL_TCP_PORT@
socket        = @MYSQL_UNIX_ADDR@
# *** 應用定制選項***
#
# MySQL 服務端
#
[mysqld]
# 一般配置選項
port    [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e%e4%ba%8c/' rel='bookmark' title='Permanent Link: mysql(my.cnf)設定檔說明(二)'>mysql(my.cnf)設定檔說明(二)</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-replication-master-slave%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1/' rel='bookmark' title='Permanent Link: MySQL Replication(Master Slave負載平衡)'>MySQL Replication(Master Slave負載平衡)</a></li>
<li><a href='http://homeserver.com.tw/mysql/mysql-proxy-rw-splitting-%e8%ae%80%e5%af%ab%e5%88%86%e6%b5%81-%e8%b2%a0%e8%bc%89/' rel='bookmark' title='Permanent Link: mysql proxy讀寫分流(二)-加入RW splitting'>mysql proxy讀寫分流(二)-加入RW splitting</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/mysql/mysqlmy-cnf%e8%a8%ad%e5%ae%9a%e6%aa%94%e8%aa%aa%e6%98%8e/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nohup 讓ssh執行的command在背景執行並且不中斷</title>
		<link>http://homeserver.com.tw/%e7%b6%b2%e8%b7%af%e5%b7%a5%e5%85%b7/nohup-%e8%ae%93ssh%e5%9f%b7%e8%a1%8c%e7%9a%84command%e5%9c%a8%e8%83%8c%e6%99%af%e5%9f%b7%e8%a1%8c%e4%b8%a6%e4%b8%94%e4%b8%8d%e4%b8%ad%e6%96%b7/</link>
		<comments>http://homeserver.com.tw/%e7%b6%b2%e8%b7%af%e5%b7%a5%e5%85%b7/nohup-%e8%ae%93ssh%e5%9f%b7%e8%a1%8c%e7%9a%84command%e5%9c%a8%e8%83%8c%e6%99%af%e5%9f%b7%e8%a1%8c%e4%b8%a6%e4%b8%94%e4%b8%8d%e4%b8%ad%e6%96%b7/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 10:08:27 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[網路工具]]></category>
		<category><![CDATA[nohub]]></category>
		<category><![CDATA[ssh 不中斷]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=1000</guid>
		<description><![CDATA[不知道大家有沒有像丫忠一樣的情況，那就是經常使用ssh遠端執行command在背景執行時，當我ssh client端(putty)關閉後，背景執行的command也會跟著中斷。
這種情況對於遠端執行 command 的管理者而言是多大的困擾丫，假設有一個command要執行24小時，要嘛就是準備好咖啡，等待command執行完畢(應該不會有人這麼做吧Orz)，要嘛就是讓電腦一直開著，等待command執行完畢(現在是講求環保的時代，這樣做一點都不環保)。好在可以在執行command前面加入【nohup】來讓command持續執行不中斷，詳細指令如下：
nohup 如何讓ssh執行的command在背景執行並且不中斷

?View Code BASH1
nohub wget http://mirrors.kernel.org/fedora/releases/12/Fedora/x86_64/iso/Fedora-12-x86_64-DVD.iso &#62; /dev/null &#38;

預設nohub會將command的輸出寫到nohub.out，加入【 &#62; /dev/null】不輸出訊息


本文相關的文章高效能負載平衡器-HAProxy介紹
Cacti 安裝教學
PDF 轉 Flash(SWF)的工具-SWFTools(支援正體中文)



本文相關的文章<ol><li><a href='http://homeserver.com.tw/proxy-server/%e9%ab%98%e6%95%88%e8%83%bd%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1%e5%99%a8-haproxy%e4%bb%8b%e7%b4%b9/' rel='bookmark' title='Permanent Link: 高效能負載平衡器-HAProxy介紹'>高效能負載平衡器-HAProxy介紹</a></li>
<li><a href='http://homeserver.com.tw/%e7%b6%b2%e8%b7%af%e5%a5%97%e4%bb%b6%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/cacti-%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/' rel='bookmark' title='Permanent Link: Cacti 安裝教學'>Cacti 安裝教學</a></li>
<li><a href='http://homeserver.com.tw/%e7%b6%b2%e8%b7%af%e5%a5%97%e4%bb%b6%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/pdf-%e8%bd%89-flashswf%e7%9a%84%e5%b7%a5%e5%85%b7-swftools%e6%94%af%e6%8f%b4%e6%ad%a3%e9%ab%94%e4%b8%ad%e6%96%87/' rel='bookmark' title='Permanent Link: PDF 轉 Flash(SWF)的工具-SWFTools(支援正體中文)'>PDF 轉 Flash(SWF)的工具-SWFTools(支援正體中文)</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/%e7%b6%b2%e8%b7%af%e5%b7%a5%e5%85%b7/nohup-%e8%ae%93ssh%e5%9f%b7%e8%a1%8c%e7%9a%84command%e5%9c%a8%e8%83%8c%e6%99%af%e5%9f%b7%e8%a1%8c%e4%b8%a6%e4%b8%94%e4%b8%8d%e4%b8%ad%e6%96%b7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>兵甲龍痕 搶先看 01,02</title>
		<link>http://homeserver.com.tw/%e9%9c%b9%e9%9d%82%e4%b8%ab%e5%bf%a0/%e5%85%b5%e7%94%b2%e9%be%8d%e7%97%95-%e6%90%b6%e5%85%88%e7%9c%8b-0102/</link>
		<comments>http://homeserver.com.tw/%e9%9c%b9%e9%9d%82%e4%b8%ab%e5%bf%a0/%e5%85%b5%e7%94%b2%e9%be%8d%e7%97%95-%e6%90%b6%e5%85%88%e7%9c%8b-0102/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 03:19:52 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[霹靂丫忠]]></category>
		<category><![CDATA[兵甲龍痕 搶先看]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=998</guid>
		<description><![CDATA[

沒有相關文章


沒有相關文章]]></description>
		<wfw:commentRss>http://homeserver.com.tw/%e9%9c%b9%e9%9d%82%e4%b8%ab%e5%bf%a0/%e5%85%b5%e7%94%b2%e9%be%8d%e7%97%95-%e6%90%b6%e5%85%88%e7%9c%8b-0102/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php 判斷行動裝置來源(mobile device)</title>
		<link>http://homeserver.com.tw/php-example/php-%e5%88%a4%e6%96%b7%e8%a1%8c%e5%8b%95%e8%a3%9d%e7%bd%ae%e4%be%86%e6%ba%90mobile-device/</link>
		<comments>http://homeserver.com.tw/php-example/php-%e5%88%a4%e6%96%b7%e8%a1%8c%e5%8b%95%e8%a3%9d%e7%bd%ae%e4%be%86%e6%ba%90mobile-device/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 06:11:23 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[PHP程式範例]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php 並斷行動裝置]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=993</guid>
		<description><![CDATA[一般的Web網站的都是針對PC來設計，如果要設計行動裝置(Mobile device)的頁面，通常web 程式必須要先判斷Client端是否為行動裝置，丫忠認為此需求增加的幅度應該會蠻大的，因為現在智慧型手機、行動裝置越來越普通了，上網的習慣不再只是坐在電腦面前，而是隨時隨地都可以立即上網的時代來臨了&#8230;(扯遠了)。
因為丫忠有這個需求，於是爬了一下文章，有一個PHP的程式還不錯，將程式碼貼下來給有需要的人，此程式不複雜，只是要把這裝行動裝置的特性都抓出來，還真是件麻煩的事，而且連iPad裝置都有了，真是要感謝整理這段程式的人囉，省了很多時間!

?View Code PHP1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
function mobile_device_detect($iphone=true,$ipad=true,$android=true,$opera=true,$blackberry=true,$palm=true,$windows=true,$mobileredirect=false,$desktopredirect=false){
&#160;
  $mobile_browser   = false;
  $user_agent       = $_SERVER['HTTP_USER_AGENT'];
  $accept           = $_SERVER['HTTP_ACCEPT'];
&#160;
  switch(true){
&#160;
    case (preg_match('/ipad/i',$user_agent));
      $mobile_browser = $ipad;
     [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/php-example/php%e5%88%a4%e6%96%b7%e6%98%af%e5%90%a6%e7%82%barobotis_robot/' rel='bookmark' title='Permanent Link: php判斷是否為robot(is_robot)'>php判斷是否為robot(is_robot)</a></li>
<li><a href='http://homeserver.com.tw/php-example/%e7%94%a8-php-%e9%80%b2%e8%a1%8c-http%e8%aa%8d%e8%ad%89http-authentication/' rel='bookmark' title='Permanent Link: 用 php 進行 http認證(http Authentication)'>用 php 進行 http認證(http Authentication)</a></li>
<li><a href='http://homeserver.com.tw/php-example/%e5%88%a9%e7%94%a8curl%e5%8f%96%e5%be%97http-header%e8%a8%8a%e6%81%af/' rel='bookmark' title='Permanent Link: 利用curl取得http header訊息'>利用curl取得http header訊息</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/php-example/php-%e5%88%a4%e6%96%b7%e8%a1%8c%e5%8b%95%e8%a3%9d%e7%bd%ae%e4%be%86%e6%ba%90mobile-device/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx 負載平衡相關參數設定</title>
		<link>http://homeserver.com.tw/proxy-server/nginx-%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1%e7%9b%b8%e9%97%9c%e5%8f%83%e6%95%b8%e8%a8%ad%e5%ae%9a/</link>
		<comments>http://homeserver.com.tw/proxy-server/nginx-%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1%e7%9b%b8%e9%97%9c%e5%8f%83%e6%95%b8%e8%a8%ad%e5%ae%9a/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 07:10:25 +0000</pubDate>
		<dc:creator>丫忠</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[代理伺服器]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://homeserver.com.tw/?p=977</guid>
		<description><![CDATA[丫忠最近在修改一些 Nginx 的設定，也看到了一篇關於 Nginx 不錯的文章，是一篇關於Nginx代理Web伺服器設定的測試文章，順便轉貼過來作為以後參考用。

測試目的
（1）弄清楚HTTP Upstream模塊中Server指令的max_fails與fail_timeout參數的關係、它們對後端服務器健康情況的檢查起到了什麼作用、它們的取值對Http proxy模塊中的其它指令是否有直接或間接的影響等……
（2）測試HTTP Proxy模塊中proxy_next_upstream、proxy_connect_timeout、proxy_read_timeout、proxy_send_timeout指令的作用、對nginx性能的影響、對後端服務器響應的處理等……
測試方法
本文測試不會使用壓力測試，所有的測試都是通過瀏覽器手動刷新來實現的。 後端服務器使用簡單的php程序來實現。
測試環境
Nginx負載均衡/反向代理服務器
系統：CentOS 5.4 64bit
Nginx：0.7.65
IP:192.168.108.10
後端web服務器
系統：CentOS 5.4 64bit
Web環境：apache+php
Web-1 IP:192.168.108.163
Web-2 IP:192.168.108.164

本次測試主要針對HTTP Upstream和HTTP Proxy模塊進行，下面測試環境中http upstream 和http proxy模塊參數的初始化設置，後文會針對測試的參數進行相應的修改：
…
upstream test  {
server 192.168.108.163 ;
server 192.168.108.164:80;
}
server {
listen          80;
server_name     .test.com;
index           index.php index.html index.htm;
location [...]


本文相關的文章<ol><li><a href='http://homeserver.com.tw/proxy-server/nginx-location%e8%a8%ad%e5%ae%9a%e7%af%84%e4%be%8b/' rel='bookmark' title='Permanent Link: nginx-location設定範例'>nginx-location設定範例</a></li>
<li><a href='http://homeserver.com.tw/proxy-server/%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1%e5%99%a8%e5%84%aa%e7%bc%ba%e9%bb%9e%e6%af%94%e8%bc%83nginx-vs-haproxy-vs-lvs/' rel='bookmark' title='Permanent Link: 負載平衡器優缺點比較(Nginx vs HAProxy vs LVS)'>負載平衡器優缺點比較(Nginx vs HAProxy vs LVS)</a></li>
<li><a href='http://homeserver.com.tw/%e7%b6%b2%e8%b7%af%e5%b7%a5%e5%85%b7/%e5%81%b5%e6%b8%ac%e7%b6%b2%e7%ab%99%e6%98%af%e5%90%a6%e6%9c%89%e6%94%af%e6%8f%b4%e7%b8%ae%e5%a3%93mod_deflatemod_gzipob_gzhandlerzlib/' rel='bookmark' title='Permanent Link: 偵測網站是否有支援壓縮(mod_deflate,mod_gzip,ob_gzhandler,zlib)'>偵測網站是否有支援壓縮(mod_deflate,mod_gzip,ob_gzhandler,zlib)</a></li>
</ol>]]></description>
		<wfw:commentRss>http://homeserver.com.tw/proxy-server/nginx-%e8%b2%a0%e8%bc%89%e5%b9%b3%e8%a1%a1%e7%9b%b8%e9%97%9c%e5%8f%83%e6%95%b8%e8%a8%ad%e5%ae%9a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
