<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3151182563722312857</id><updated>2024-09-01T14:22:50.508+08:00</updated><category term="android"/><category term="c"/><category term="driver"/><category term="kernel"/><category term="mysql"/><category term="UEFI"/><category term="big data"/><category term="nosql"/><category term="java"/><category term="ubuntu"/><category term="C#"/><category term="C++"/><category term="Windows 8 Metro"/><category term="git"/><category term="hadoop"/><category term="Docker"/><category term="SurfaceFlinger"/><category term="arm"/><category term="backup"/><category term="glusterfs"/><category term="ha"/><category term="hardening"/><category term="iscsi"/><category term="openstack"/><category term="performance"/><category term="repo"/><category term="security"/><title type='text'>Joe&#39;s Blog----TECH</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>65</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-4443107411594439837</id><published>2015-09-04T22:42:00.002+08:00</published><updated>2015-09-04T22:42:58.027+08:00</updated><title type='text'>新Blog</title><content type='html'>最近覺得blogger編輯畫面真的很難寫含有程式碼的文章，因此花了點時間 survey octopress. 接下來文章應該都會放在那邊了。 &lt;a href=&quot;http://clhjoe.github.io/blog/&quot;&gt;連結&lt;/a&gt;是 &lt;a href=&quot;http://clhjoe.github.io/blog/&quot;&gt;http://clhjoe.github.io/blog/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/4443107411594439837/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/4443107411594439837' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/4443107411594439837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/4443107411594439837'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2015/09/blog.html' title='新Blog'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-7561026900004829603</id><published>2014-11-04T11:43:00.000+08:00</published><updated>2014-11-14T14:21:41.606+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Docker"/><title type='text'>Docker on Ubuntu 14.04</title><content type='html'>&lt;b&gt;Install Docker&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# echo deb https://get.docker.io/ubuntu docker main &amp;gt; /etc/apt/sources.list.d/docker.list&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# apt-get update&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# apt-get install -y lxc-docker&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Pull Ubuntu image&lt;/b&gt;&lt;br /&gt;
[with proxy]&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# service docker stop&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# HTTP_PROXY=[proxy] docker -d&amp;amp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# docker pull ubuntu&lt;/span&gt;&lt;br /&gt;
[without proxy]&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# docker pull ubuntu&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Run a Docker Container&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;# docker run -i -t ubuntu /bin/bash&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Frequently used commands&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;1.列出所有image&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker images&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;2.列出所有運作中的container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker ps&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;3.列出所有container 包含暫停中或已結束的container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker ps -a&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;4.刪除container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker rm [container id]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;5.刪除image&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker rmi [image id]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;note:如果image正在被某個container使用的話，&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;就必須先刪除使用的container才能刪除image&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;6.build image&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker build .&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;note:此指令必須跟Dockerfile同一層&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;6-1. build image時加入tag&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker build -t [tag] .&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;6-2. build image不使用cache&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker build --no-cache .&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;note:假設上一次build的時候發生錯誤(either Dockerfile寫錯 或是環境出錯等等),如果仍使用cache則會停留在出錯的狀態。另一個避免錯誤的方式是如6-3 不保留過程產生的container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;6-3. build image但不保留過程中產生的container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker build --rm .&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;7. 啟動container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker run [image id or tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;7-1. 啟動container with (I)nteractive and (T)ty&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker run -t -i&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[image id or tag] /bin/bash&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#note 啟動container並進入bash shell&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;7-2. 啟動container 並在背景執行&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker run -i -t -d&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[image id or tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#note 要返回container 則執行 docker attach [container id] 回去&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;7-3. 啟動container 並掛載local 資料夾&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker run -v /local/dir:/docker/dir [image id or tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;7-4. 啟動container 並forward port&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker run -p&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;host_port:container_port&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;-p&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;host_port:container_port&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;/udp&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[image id or tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#note -p 後面接一組 host_port:container_port，如果是udp則在後面加上/udp&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;7-5. 啟動container並與host時間同步&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker run&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;-v /etc/localtime:/etc/localtime:ro&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[image id or tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;7-6. 啟動container並傳入環境變數&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker run&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;--env var_name=var_value&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[image id or tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;7-7. 啟動container並給予tag&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker run&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;--name [tag]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[image id or tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;8. 跳出container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;當進入container後，想要回到host的shell但&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;不想結束container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ctrl+ p + q&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;9. 跳回container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker attach [container id]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;10. 啟動container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker start [container id]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#note 當container是在exit狀態時，在attach必須先start container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;11. Commit 變更&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker commit -m &quot;commit msg&quot; -a &quot;author&quot; [container id] [repository]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#note -a和&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;repository非必要&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;12. 列出image/container 資訊&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker&amp;nbsp;inspect [image or container id]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#note 可以利用執行完docker inspect後檢查$?來判斷image or container是否已經存在&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;13. 匯出container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# docker export [container id] &amp;gt;image_name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#note 如果要順便壓縮的話&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;docker export [container id] |gzip -c &amp;gt;image_name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;14. 匯入container&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# cat [image path] |docker import - [tag]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#note 匯入壓縮的image &amp;nbsp;#&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;gzip -dc [image path] | docker import - tag&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#15 限制container的memory 使用量&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# docker run -m [memory size ex. -m 2g]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;#note:如果有出現&quot;&lt;/span&gt;&lt;span style=&quot;color: #783f04; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&quot;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;則必須修改/etc/default/grub&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;將&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;GRUB_CMDLINE_LINUX=&quot;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;更改成&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;GRUB_CMDLINE_LINUX=&quot;cgroup_enable=memory swapaccount=1&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;執行sudo update-grub 並重新開機&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/7561026900004829603/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/7561026900004829603' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/7561026900004829603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/7561026900004829603'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/11/docker-on-ubuntu-1404.html' title='Docker on Ubuntu 14.04'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-5817439214835453047</id><published>2014-10-30T21:45:00.001+08:00</published><updated>2014-10-30T21:45:40.740+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><title type='text'>Illegal instruction 追蹤</title><content type='html'>&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;某天執行程式的時候遇到Illegal instruction，這時候如果執行&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# dmesg&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;應該會看到類似如下的訊息&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;XXXX[4444] trap invalid opcode rip:42a016 rsp:415104b8 error:0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;這個問題通常是因為程式使用了CPU不支援的instruction set(也有例外)，那我們要怎麼知道是使用到哪個instruction(opcode)呢？&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;1. 開啟core dump&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; Ubuntu預設是不會產生core dump file的，要讓系統產生必須執行下面的指令&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# ulimit -c unlimited&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; 在執行後，當遇到Illegal instruction的錯誤時，在執行的資料夾應該會出現core.XXX的檔案及為core dump file了&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;2. 使用gdb追蹤&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; 使用gdb 可以讓我們知道在哪邊發生了錯誤&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# gdb [程式] &amp;nbsp;[core dump file]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; 以我遇到的例子如下：&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; Program terminated with signal 4, Illegal instruction.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; #0 &amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;0x000000000042a016&lt;/span&gt; in &lt;b&gt;FUNCTION_NAME&lt;/b&gt; ()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; 我們就可以發現錯誤是在 0x000000000042a016的地方&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;3. 檢視assembly code&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;同樣在gdb裡面執行&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;(gdb) disassemble &lt;b&gt;FUNCTION_NAME&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;0x000000000042a00d &amp;lt;blake2b_init_param_avx+45&amp;gt;:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cmp &amp;nbsp; &amp;nbsp;%rax,%rdx&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;0x000000000042a010 &amp;lt;blake2b_init_param_avx+48&amp;gt;:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;jbe &amp;nbsp; &amp;nbsp;0x42a0c0 &amp;lt;blake2b_init_param_avx+224&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;0x000000000042a016&lt;/span&gt; &amp;lt;blake2b_init_param_avx+54&amp;gt;:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;vmovdqu (%rsi),%xmm1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;就可以發現到底是什麼instruction造成錯誤了。&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/5817439214835453047/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/5817439214835453047' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5817439214835453047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5817439214835453047'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/10/illegal-instruction.html' title='Illegal instruction 追蹤'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-3750826567607653597</id><published>2014-05-27T21:15:00.000+08:00</published><updated>2014-05-27T21:15:58.015+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ha"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="openstack"/><title type='text'>OpenStack High Availability I-MySQL, RabbitMQ HA</title><content type='html'>OpenStack HA的方式主要分為兩種，一是Master-Master另外一種是Master-Slave的架構。顧名思義，Master-Master就是同時有兩組Control/Network Node提供服務。在這裡要介紹的是Master-Slave的佈署方式。&lt;br /&gt;
&lt;br /&gt;
對於MySQL的HA, 我們必須佈署DRBD, corosync和pacemaker來達成。DRBD就像是軟體的RAID I，同步兩台電腦間的partition。而corosync則是用來在cluster間傳遞訊息和heartbeat，最後pacemaker則是負責管理應用程式的切換(例如MySQL要開在哪一台，另外一台standby)。&lt;br /&gt;
&lt;br /&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;DRBD安裝&lt;/span&gt;&lt;/h2&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;安裝DRBD只需要安裝drbd8-utils&lt;/span&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-db2bb897-3dc6-c9a5-3d66-9d0157d57fb4&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# apt-get install drbd8-utils&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;DRBD設定&lt;/span&gt;&lt;/h2&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;假設我們要新增一個resource給mysql/rabbitmq使用，在master&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; 分別新增&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;檔案 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/etc/drbd.d/mysql.res 和&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/etc/drbd.d/rabbitmq.res&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;resource &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;mysql&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; on &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;master&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;device /dev/drbd0; &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;disk &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;i&gt;/dev/mapper/master-mysql&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; #master要拿來同步的partition&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;address &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;10.109.36.58:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;7788&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#master的IP&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;meta-disk internal;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; on &lt;/span&gt;&lt;span style=&quot;background-color: transparent; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;slave&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;device /dev/drbd0;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;disk &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;i&gt;/dev/mapper/master-mysql;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#slave要拿來同步的&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 13px; line-height: 13px; white-space: pre-wrap;&quot;&gt;partition&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;address &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;10.109.36.59:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;7788&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#slave的IP&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;meta-disk internal;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;resource &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;rabbitmq&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; on &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;master&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;device /dev/drbd1; &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;disk /&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;i&gt;dev/mapper/master-rabbitmq&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; #master要拿來同步的partition&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;address &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;10.109.36.58:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;7789&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#master的IP&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;meta-disk internal;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; on&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 13px; line-height: 13px; white-space: pre-wrap;&quot;&gt;slave&lt;/span&gt;&lt;span style=&quot;color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; line-height: 1; white-space: pre-wrap;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;device /dev/drbd1;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;disk &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;i&gt;/dev/mapper/master-rabbitmq&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#slave要拿來同步的&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 13px; line-height: 13px; white-space: pre-wrap;&quot;&gt;partition&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;address &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;10.109.36.59:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;7789&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#slave的IP&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;meta-disk internal;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#將設定檔從master copy到slave&lt;/span&gt;&lt;/h3&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# scp /etc/drbd.d/mysql.res slave:/etc/drbd.d/&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# scp /etc/drbd.d/rabbitmq.res slave:/etc/drbd.d/&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#在master及slave 啟動DRBD&lt;/span&gt;&lt;/h3&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# /etc/init.d/drbd start&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#初始化metadata storage&lt;/span&gt;&lt;/h3&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;master:&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm create-md mysql&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm create-md rabbitmq&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#將master設定為primary&lt;/span&gt;&lt;/h3&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;master:&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm -- --overwrite-data-of-peer primary mysql&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm -- --overwrite-data-of-peer primary rabbitmq&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#確認安裝狀態&lt;/span&gt;&lt;/h3&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;執行&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# service drbd status&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;應該可以看到&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;master:&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;drbd driver loaded &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;OK&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;; device status:&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;version: 8.3.13 (api:88/proto:86-96)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;srcversion: 697DE8B1973B1D8914F04DB &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;m:res &amp;nbsp;&amp;nbsp;cs &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ro &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ds &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p &amp;nbsp;mounted &amp;nbsp;fstype&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;0:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;mysql&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;Connected &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Primary&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/Secondary &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;UpToDate&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/UpToDate &amp;nbsp;C&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;1:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;rabbitmq&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;Connected &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Primary&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/Secondary &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;UpToDate&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/UpToDate &amp;nbsp;C&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;slave:&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;drbd driver loaded &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;OK&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;; device status:&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;version: 8.3.11 (api:88/proto:86-96)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;srcversion: 2931F0123213F7DB1364EA7 &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;m:res &amp;nbsp;&amp;nbsp;cs &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ro &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ds &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p &amp;nbsp;mounted &amp;nbsp;fstype&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;0:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;mysql&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;Connected &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Secondary&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/Primary &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;UpToDate&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/UpToDate &amp;nbsp;C&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;1:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;rabbitmq&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;Connected &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Primary&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/Secondary &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;UpToDate&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/UpToDate &amp;nbsp;C&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;DRBD問題排除&lt;/span&gt;&lt;/h2&gt;
&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;執行service drbd status出現 &#39;0:mysql &amp;nbsp;StandAlone &amp;nbsp;Secondary/Unknown &amp;nbsp;UpToDate/DUnknown &amp;nbsp;r-----’&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;如果執行dmesg 有看到&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;kernel: block drbd0: Split-Brain detected, dropping connection!&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;代表遇到split-brain的問題,解決的方法如下:&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: white; color: black; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: circle; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Disconnect resource(on secondary node)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm disconnect mysql&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: white; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: circle; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;將node轉為secondary(on secondary node)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm secondary mysql&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: white; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: circle; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;強至取消所有修改(on secondary node)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm -- --discard-my-data connect mysql&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: white; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: circle; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;重新連線(on primary node)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# drbdadm connect mysql &lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Reference&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;a href=&quot;https://help.ubuntu.com/10.04/serverguide/drbd.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;https://help.ubuntu.com/10.04/serverguide/drbd.html&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.3; margin-bottom: 12pt; margin-top: 0pt;&quot;&gt;
&lt;a href=&quot;http://www.hastexo.com/resources/hints-and-kinks/solve-drbd-split-brain-4-steps&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Solve a DRBD split-brain in 4 steps&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 21px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Corosync Installation&lt;/span&gt;&lt;/h1&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Corosync安裝&lt;/span&gt;&lt;/h2&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Corosync安裝只需要安裝corosync套件&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: #434343;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: #434343;&quot;&gt;both master &amp;amp; master-1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# apt-get install corosync&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Corosync設定&lt;/span&gt;&lt;/h2&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#編輯/etc/corosync/corosync.conf&lt;/span&gt;&lt;/h3&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;both master &amp;amp; master-1&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# Please read the openais.conf.5 manual page&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;totem {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;version: 2&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# How long before declaring a token lost (ms)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;token: 3000&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# How many token retransmits before forming a new configuration&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;token_retransmits_before_loss_const: 10&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# How long to wait for join messages in the membership protocol (ms)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;join: 60&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# How long to wait for consensus to be achieved before starting a new round of membership configuration (ms)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;consensus: 3600&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# Turn off the virtual synchrony filter&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;vsftype: none&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# Number of messages that may be sent by one processor on receipt of the token&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;max_messages: 20&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# Limit generated nodeids to 31-bits (positive signed integers)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;clear_node_high_bit: yes&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# Disable encryption&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;secauth: off&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# How many threads to use for encryption/decryption&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;threads: 0&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# Optionally assign a fixed node id (integer)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# nodeid: 1234&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# This specifies the mode of redundant ring, which may be none, active, or passive.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;rrp_mode: none&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;interface {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# The following values need to be set based on your environment &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;ringnumber: 0&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;bindnetaddr: &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;i&gt;&lt;b&gt;10.109.36.0&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;mcastaddr: 226.94.1.1&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;mcastport: 5405&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;amf {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;mode: disabled&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;service {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# Load the Pacemaker Cluster Resource Manager&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;ver: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;name: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pacemaker&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;aisexec {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;user: &amp;nbsp;&amp;nbsp;root&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;group: &amp;nbsp;root&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;logging {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileline: off&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;to_stderr: yes&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;to_logfile: no&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;to_syslog: yes&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;syslog_facility: daemon&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;debug: off&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;timestamp: on&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;logger_subsys {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;subsys: AMF&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;debug: off&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tags: enter|leave|trace1|trace2|trace3|trace4|trace6&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#將設定檔複製到Slave&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# scp -r /etc/corosync master-1:/etc/&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;設定開機自動啟動&lt;/span&gt;&lt;/h3&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;編輯 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/etc/default/corosync&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; 將內容的&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;no&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;’ 改成’&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;yes&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;’&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 8pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;確認安裝狀態&lt;/span&gt;&lt;/h3&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;在Master執行 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# corosync-objctl runtime.totem.pg.mrp.srp.members &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;應該可以看到如下畫面&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;runtime.totem.pg.mrp.srp.1763994890.ip=r(0) ip(10.109.36.105) &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;runtime.totem.pg.mrp.srp.1763994890.join_count=1&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;runtime.totem.pg.mrp.srp.1763994890.status=&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;joined&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;runtime.totem.pg.mrp.srp.1797549322.ip=r(0) ip(10.109.36.107) &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;runtime.totem.pg.mrp.srp.1797549322.join_count=1&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;runtime.totem.pg.mrp.srp.1797549322.status=&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;joined&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Reference&lt;/span&gt;&lt;/h2&gt;
&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;a href=&quot;http://docs.openstack.org/trunk/openstack-ha/content/_setting_up_corosync.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;OpenStack HA&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 21px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Pacemaker Installation&lt;/span&gt;&lt;/h1&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;驗證系統&lt;/span&gt;&lt;/h2&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;在重新啟動Master及Slave之後在兩台執行 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# crm_mon&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;應該可以看到&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Master&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;============&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Last updated: Wed Jun 19 16:52:11 2013&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Last change: Wed Jun 19 13:14:15 2013 via crmd on master-1&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Stack: openais&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Current DC: master - partition with quorum&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Version: 1.1.6-9971ebba4494012a93c03b40a2c58ec0eb60f50c&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;2 Nodes configured, 2 expected votes&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;0 Resources configured.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;============&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Online: [ master master-1 ]&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Slave&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;============&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Last updated: Wed Jun 19 16:52:11 2013&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Last change: Wed Jun 19 13:14:15 2013 via crmd on master-1&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Stack: openais&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Current DC: master - partition with quorum&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Version: 1.1.6-9971ebba4494012a93c03b40a2c58ec0eb60f50c&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;2 Nodes configured, 2 expected votes&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;0 Resources configured.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;============&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Online: [ master master-1 ]&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;基本設定&lt;/span&gt;&lt;/h2&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#在master執行 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# crm configure &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;接著輸入 &lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;crm(live)configure# property no-quorum-policy=&quot;ignore&quot; \ &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pe-warn-series-max=&quot;1000&quot; \ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pe-input-series-max=&quot;1000&quot; \&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pe-error-series-max=&quot;1000&quot; \&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cluster-recheck-interval=&quot;5min&quot; \&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;crm(live)configure# commit&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 21px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;HA for MySQL&lt;/span&gt;&lt;/h1&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Trebuchet MS&#39;; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#編輯pacemaker&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;執行&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;# crm configure&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;crm(live)configure# &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;edit&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #a61c00; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;接著輸入&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_drbd_mysql ocf:linbit:drbd \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params drbd_resource=&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;mysql&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op start interval=&quot;0&quot; timeout=&quot;90s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op stop interval=&quot;0&quot; timeout=&quot;180s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op promote interval=&quot;0&quot; timeout=&quot;180s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op demote interval=&quot;0&quot; timeout=&quot;180s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;30s&quot; role=&quot;Slave&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;29s&quot; role=&quot;Master&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_drbd_rabbitmq ocf:linbit:drbd \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params drbd_resource=&quot;rabbitmq&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op start interval=&quot;0&quot; timeout=&quot;90s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op stop interval=&quot;0&quot; timeout=&quot;180s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op promote interval=&quot;0&quot; timeout=&quot;180s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op demote interval=&quot;0&quot; timeout=&quot;180s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;30s&quot; role=&quot;Slave&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dcd-3b12-ef42-2f17b77b6d75&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;29s&quot; role=&quot;Master&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_fs_mysql ocf:heartbeat:Filesystem \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params device=&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;/dev/drbd/by-res/mysql&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot; directory=&quot;/var/lib/mysql&quot; fstype=&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;xfs&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot; options=&quot;relatime&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op start interval=&quot;0&quot; timeout=&quot;60s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op stop interval=&quot;0&quot; timeout=&quot;180s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;60s&quot; timeout=&quot;60s&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_fs_rabbitmq ocf:heartbeat:Filesystem \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dcd-8229-7bbc-e454a6f25345&quot;&gt;&lt;span style=&quot;color: black; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params device=&quot;/dev/drbd/by-res/rabbitmq&quot; \   &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small; line-height: 1; white-space: pre-wrap;&quot;&gt;        directory=&quot;/var/lib/rabbitmq&quot; fstype=&quot;xfs&quot; &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_ip_mysql ocf:heartbeat:IPaddr2 \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params ip=&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;10.109.36.198&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot; cidr_netmask=&quot;24&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;30s&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_ip_rabbitmq ocf:heartbeat:IPaddr2 \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params ip=&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small; line-height: 13px;&quot;&gt;10.109.36.198&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&quot; cidr_netmask=&quot;24&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dcd-f760-c4f5-aabd805387ca&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;10s&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_rabbitmq ocf:rabbitmq:rabbitmq-server \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params nodename=&quot;rabbit@localhost&quot; mnesia_base=&quot;/var/lib/rabbitmq&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dce-3698-44bc-ef76f488df14&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;20s&quot; timeout=&quot;10s&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;primitive p_mysql ocf:heartbeat:mysql \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;params additional_parameters=&quot;--bind-address=&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;0.0.0.0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; config=/etc/mysql/my.cnf&quot; pid=&quot;/var/run/mysqld/mysqld.pid&quot; socket=&quot;/var/run/mysqld/mysqld.sock&quot; log=&quot;/var/log/mysql/mysqld.log&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op monitor interval=&quot;20s&quot; timeout=&quot;10s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op start interval=&quot;0&quot; timeout=&quot;120s&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;op stop interval=&quot;0&quot; timeout=&quot;120s&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;roup g_rabbitmq p_ip_rabbitmq p_fs_rabbitmq p_rabbitmq \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dce-7a95-168d-b89220739b53&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;meta target-role=&quot;Started&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;group g_mysql p_ip_mysql p_fs_mysql p_mysql&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ms ms_drbd_mysql p_drbd_mysql \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;meta notify=&quot;true&quot; clone-max=&quot;2&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ms ms_drbd_rabbitmq p_drbd_rabbitmq \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dce-9e46-2775-863da7d31df6&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;meta notify=&quot;true&quot; master-max=&quot;1&quot; clone-max=&quot;2&quot; target-role=&quot;Started&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;colocation c_mysql_on_drbd inf: g_mysql ms_drbd_mysql:Master&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dce-bf23-1756-dafb979c9cfd&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;colocation c_rabbitmq_on_drbd inf: g_rabbitmq ms_drbd_rabbitmq:Master&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;order o_drbd_before_rabbitmq inf: ms_drbd_rabbitmq:promote g_rabbitmq:start&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;order o_drbd_before_mysql inf: ms_drbd_mysql:promote g_mysql:start&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span id=&quot;docs-internal-guid-db2bb897-3dcf-757d-0c07-b6b837471296&quot;&gt;&lt;span style=&quot;color: black; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;order order1 inf: g_rabbitmq:start g_mysql&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;property $id=&quot;cib-bootstrap-options&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dc-version=&quot;1.1.6-9971ebba4494012a93c03b40a2c58ec0eb60f50c&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cluster-infrastructure=&quot;openais&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;expected-quorum-votes=&quot;3&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;no-quorum-policy=&quot;ignore&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pe-warn-series-max=&quot;1000&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pe-input-series-max=&quot;1000&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pe-error-series-max=&quot;1000&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cluster-recheck-interval=&quot;5min&quot; \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stonith-enabled=&quot;false&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;crm(live)configure# &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: red; font-family: &#39;Courier New&#39;; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;commit&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
接著再執行 # crm_mon 應該就可以看到MySQL和RabbitMQ開起來了。</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/3750826567607653597/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/3750826567607653597' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/3750826567607653597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/3750826567607653597'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/05/openstack-high-availability-i-mysql.html' title='OpenStack High Availability I-MySQL, RabbitMQ HA'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-6347379780572657372</id><published>2014-04-21T20:17:00.001+08:00</published><updated>2014-04-21T20:20:56.439+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="glusterfs"/><title type='text'>GlusterFS Performance Tuning</title><content type='html'>&lt;h2&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
前言&lt;/span&gt;&lt;/h2&gt;
GlusterFS 是一套OpenSource的Distributed File System. 簡單來說，他可以把多台多個儲存資源串連起來變成一個或多個Pool。每一個Pool支援Global Namespace/Common Namespace的特性，也就是說，在不同地方掛載同一個Pool看到的會是相同的東西。&lt;br /&gt;
&lt;br /&gt;
有使用過GlusterFS的人都會發現，以Default的Configuration來跑GlusterFS將會得到慘不忍睹的笑能。因此在這邊分享及驗證透過修改GlusterFS不同的參數對於效能的幫助&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
Configurations&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
修改的參數我把他分為三類，分別是IO，Cache和Network的參數修改。&lt;/div&gt;
&lt;h3&gt;
I/O&amp;nbsp;&lt;/h3&gt;
&lt;h4&gt;
io-thread-count (16-&amp;gt; 64)&lt;/h4&gt;
最多同時IO的Thread個數。數字越大就允許越多同時的R/W。特別是當你有RAID的時候可以調高這參數。Default值是16&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
write-behind-window-size(1MB-&amp;gt; 1GB)&lt;/div&gt;
per-file的write behind buffer. Default值是1MB。&lt;br /&gt;
&lt;h3&gt;
&lt;br /&gt;&lt;/h3&gt;
&lt;h3&gt;
Cache&amp;nbsp;&lt;/h3&gt;
&lt;h4&gt;
cache-size (32MB-&amp;gt; 2GB)&lt;/h4&gt;
&lt;div&gt;
read cache的Size。Default值是32MB&lt;/div&gt;
&lt;h4&gt;
&lt;br /&gt;&lt;/h4&gt;
&lt;h4&gt;
cache-max-file-size (-&amp;gt; 16384PB)&lt;/h4&gt;
&lt;div&gt;
設定最多file cached的大小。&lt;/div&gt;
&lt;h4&gt;
&lt;br /&gt;&lt;/h4&gt;
&lt;h4&gt;
cache-min-file-size (-&amp;gt; 0)&lt;/h4&gt;
&lt;div&gt;
cached file最小的大小。&lt;/div&gt;
&lt;h3&gt;
Network&lt;/h3&gt;
&lt;h4&gt;
auto tuning(-&amp;gt; disable)&lt;/h4&gt;
&lt;div&gt;
OS會根據網路的throughput來動態調整TCP的window size。但是如果是在穩定的Lan環境這功能是用不到的，因此關閉他來避免奇怪的問題。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
Performance Testing&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
上述列了幾個Tuning的參數，接下來實際針對每個參數的調整來驗證改善的成效。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Experiment Environment and Method&lt;/h3&gt;
&lt;div&gt;
實驗的環境是兩台Server串成一個GlusterFS cluster。 然後在一台Server mount起來，利用iozone來驗證效能。三台的規格都一樣如下圖。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkUez73f4ElR6QnOfzVqV3R2JWvgeV-B1DPzL5Eb0YkPdYSw8pBiBKh8cexAasseoZqeutRFp5hh0sPrPV4YHkAQgnDC6h7G3hbgRZvesk9_pRqOSR7j48QcHjSqjT8BeM4iCdThhqsaY/s1600/gluster1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkUez73f4ElR6QnOfzVqV3R2JWvgeV-B1DPzL5Eb0YkPdYSw8pBiBKh8cexAasseoZqeutRFp5hh0sPrPV4YHkAQgnDC6h7G3hbgRZvesk9_pRqOSR7j48QcHjSqjT8BeM4iCdThhqsaY/s1600/gluster1.png&quot; height=&quot;251&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
Experiment Configuration&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
重新歸納一下調整個參數並且給每一個case做編號。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_BW-sEgd6IZpqd3cbiI9O9I1zShTrUJW_TSxoX2tJ2i2MR7eeNRcnXNUfMJAoQpAD9uGF8RCt-RhEKFpspuXqAMeQknSa7YE47bv9JZa8dsh2pyReDVAt4I5EYtxgDKZZqPU1gibqe4U/s1600/Screenshot+from+2014-04-21+19:57:33.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_BW-sEgd6IZpqd3cbiI9O9I1zShTrUJW_TSxoX2tJ2i2MR7eeNRcnXNUfMJAoQpAD9uGF8RCt-RhEKFpspuXqAMeQknSa7YE47bv9JZa8dsh2pyReDVAt4I5EYtxgDKZZqPU1gibqe4U/s1600/Screenshot+from+2014-04-21+19:57:33.png&quot; height=&quot;228&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
Experiment Result&lt;/span&gt;&lt;/h3&gt;
&lt;h3&gt;
Write&lt;/h3&gt;
&lt;div&gt;
從寫入的結果來看，在調整了&lt;b&gt;write-behind-buffer&lt;/b&gt;後效能有得到非常大的改善。而理所當然的，record size會影響整個throughput。在record=1024KB的時候有較好的結果。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcMRAsibtHoiCfMGJwiIrMxbZVPP9cY9y5HTQtrjM3LVqqJT_qJTZwY7xah2z97eY_gg4jh4XjPmpq4vYmomgx_X7MRiInnY1bd4fF9WdOwVRn6t8JZXftkho9jZJi2mC4WjLa3GVsPao/s1600/write.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcMRAsibtHoiCfMGJwiIrMxbZVPP9cY9y5HTQtrjM3LVqqJT_qJTZwY7xah2z97eY_gg4jh4XjPmpq4vYmomgx_X7MRiInnY1bd4fF9WdOwVRn6t8JZXftkho9jZJi2mC4WjLa3GVsPao/s1600/write.png&quot; height=&quot;245&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
ReWrite&lt;/h3&gt;
&lt;div&gt;
在rewrite的實驗和write有相近的結果。一樣是透過調整&lt;b&gt;write-behind-buffer &lt;/b&gt;來得到效能的改善。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUs8VFSOg5LaSB-r14yQeu_glgpUPvuplSnmw2J77ZJF7MgWt-jj7Rof94viIyCfrK5QyS7-q7bhCsLuKhfMY9fgGhsyGwYZDKR3Cjl4IntCGO5ctFS2og_q-4Nk9lnphaJFwFMT0eoCk/s1600/rewrite.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUs8VFSOg5LaSB-r14yQeu_glgpUPvuplSnmw2J77ZJF7MgWt-jj7Rof94viIyCfrK5QyS7-q7bhCsLuKhfMY9fgGhsyGwYZDKR3Cjl4IntCGO5ctFS2og_q-4Nk9lnphaJFwFMT0eoCk/s1600/rewrite.png&quot; height=&quot;220&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
Read&lt;/h3&gt;
&lt;div&gt;
在Read測試當中，可以發現在record size比較小的時候，關閉tso, gro和gso會有較快的效能。不過這個結果應該與網卡及driver有關。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRg3bLEAjz64aT7H5dXTV1OfL1ZBQWx4dQMkikeVRT9T-HIXfH3eyek_m4CVGCfzvcxXeylHTrZRcWIZyKO23Oqf8YHKXo4Ic1TmSi10sWVgV-qQl2Bjg8mC9f5BXdfnLfAtwbHJJZq7Y/s1600/read.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRg3bLEAjz64aT7H5dXTV1OfL1ZBQWx4dQMkikeVRT9T-HIXfH3eyek_m4CVGCfzvcxXeylHTrZRcWIZyKO23Oqf8YHKXo4Ic1TmSi10sWVgV-qQl2Bjg8mC9f5BXdfnLfAtwbHJJZq7Y/s1600/read.png&quot; height=&quot;201&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
Re-read&lt;/h3&gt;
&lt;div&gt;
Reread與read有相近的結果。在大record size時一樣能得到較好的throughput。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo7wEneO8uVq2Rr96Qxt27Eu5JXfYskN6e2rkL_AwQLID_Gfp1l-ZUPk4VTvX7NzBmaslMVr167nbcToyf7nDJJQTbsWFaqIv9cVhJQMEiZVO9ltO3iY1gFmh-ekn8A8FC6ZQeQbvbkKc/s1600/reread.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo7wEneO8uVq2Rr96Qxt27Eu5JXfYskN6e2rkL_AwQLID_Gfp1l-ZUPk4VTvX7NzBmaslMVr167nbcToyf7nDJJQTbsWFaqIv9cVhJQMEiZVO9ltO3iY1gFmh-ekn8A8FC6ZQeQbvbkKc/s1600/reread.png&quot; height=&quot;235&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
Conclusion&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;b&gt;write-behind-buffer&lt;/b&gt;很明顯的改善了寫入的速度。我想這就跟在NFS sync/async的差別一樣吧。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
在這次的實驗中，沒有RAID 卡也沒有做multi-IO的測試。猜想應該是這個原因才看不出io-thread-count的效果。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/6347379780572657372/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/6347379780572657372' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6347379780572657372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6347379780572657372'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/glusterfs-performance-tuning.html' title='GlusterFS Performance Tuning'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkUez73f4ElR6QnOfzVqV3R2JWvgeV-B1DPzL5Eb0YkPdYSw8pBiBKh8cexAasseoZqeutRFp5hh0sPrPV4YHkAQgnDC6h7G3hbgRZvesk9_pRqOSR7j48QcHjSqjT8BeM4iCdThhqsaY/s72-c/gluster1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-8890729755796788418</id><published>2014-04-18T11:12:00.004+08:00</published><updated>2014-04-18T11:12:44.761+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="backup"/><title type='text'>Delete Symantec Netbackup Disk Pool </title><content type='html'>The process is :&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Expire all backup image&lt;/li&gt;
&lt;li&gt;Delete all image fragment&lt;/li&gt;
&lt;li&gt;Delete Disk Pool&lt;/li&gt;
&lt;/ol&gt;
So fist, issue &lt;i&gt;bpimmedia&lt;/i&gt; to get &amp;nbsp;&lt;i&gt;backup_id&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# bpimmedia -L -client &lt;i&gt;[client name]&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and then expire the image&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# bpexpdate -backupid &lt;i&gt;[backupid]&lt;/i&gt; -d 0&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Second, delete all image fragment by issue &lt;i&gt;nbdelete&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# nbdelete --allvolumes -force&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Finally, delete disk pool from Administration console or Administrator JAVA console&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/8890729755796788418/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/8890729755796788418' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/8890729755796788418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/8890729755796788418'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/delete-symantec-netbackup-disk-pool.html' title='Delete Symantec Netbackup Disk Pool '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-1897274258960915830</id><published>2014-04-11T15:46:00.004+08:00</published><updated>2014-04-11T15:46:36.438+08:00</updated><title type='text'>No Dropbox icon in Ubuntu 13.10</title><content type='html'>1. Install package&lt;br /&gt;
# sudo apt-get install libappindicator1&lt;br /&gt;
2. &amp;nbsp;Log out, and then log back in (or issue dropbox stop &amp;amp;&amp;amp; dropbox start at the command line)&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://askubuntu.com/questions/358913/no-dropbox-icon-in-ubuntu-13-10&quot;&gt;REF&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/1897274258960915830/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/1897274258960915830' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/1897274258960915830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/1897274258960915830'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/no-dropbox-icon-in-ubuntu-1310.html' title='No Dropbox icon in Ubuntu 13.10'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-3198894059712167280</id><published>2014-04-11T15:18:00.001+08:00</published><updated>2014-04-11T15:37:53.446+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hardening"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><title type='text'>Linux Kernel Performance Tuning and Hardening</title><content type='html'>[Security]Deactivates automatic answers to ICMP broadcasts and protects against smurf attacks.
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;net.ipv4.icmp_echo_ignore_broadcasts=1&lt;/pre&gt;
[Security]Enable source validation by reversed path, as specified in RFC1812
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;
/*
0 - No source validation.
1 - Strict mode as defined in RFC3704 Strict Reverse Path. 
    Each incoming packet is tested against the FIB and if the interface
    is not the best reverse path the packet check will fail. 
    By default failed packets are discarded.
2 - Loose mode as defined in RFC3704 Loose Reverse Path. 
    Each incoming packet&#39;s source address is also tested against the FIB
    and if the source address is not reachable via any interface the packet check will fail.
*/
net.ipv4.conf.all.rp_filter = 1&lt;/pre&gt;
[Performance]The number of possible inotify(7) watches
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;fs.inotify.max_user_watches = 65536&lt;/pre&gt;
[Tuning]Avoid deleting secondary IPs on deleting the primary IP. 
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;
/*
If you remove the primary IP address, all secondary addresses are purged by default as well. 
*/
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1&quot;&lt;/pre&gt;
[Security]Not allow source route
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;net.ipv4.conf.default.accept_source_route = 0&lt;/pre&gt;
[Tuning]Disable listen for router advertisements in order to choose an IPV6 address and router 
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.all.accept_ra = 0&lt;/pre&gt;
[Security]Do not allow redirect
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0&lt;/pre&gt;
[Tuning]Avoid tcp timeout
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;net.ipv4.tcp_timestamps = 0&lt;/pre&gt;
[Performance]Maximum amount for the receive socket memory
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.ipv4.tcp_rmem = 32768 262144 33554432
net.ipv4.tcp_wmem = 32768 262144 33554432&lt;/pre&gt;
[Performance]Max open file
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;fs.file-max = 200000&lt;/pre&gt;
[Performance]The number of IPC message queue resources allowed
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;kernel.msgmni = 1024&lt;/pre&gt;
[Performance]How many semaphore arrays, semaphores can be allocate and how many semaphores can be in a single semaphore array
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;kernel.sem = 400 307200 128 1024&lt;/pre&gt;
[Performance]Keepalive time
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;net.ipv4.tcp_keepalive_time = 900
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 10&lt;/pre&gt;
[Performance] Page cache limit.
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;
/*Some app use large amounts of memory for accelerated access to business data
Parts of this memory are seldom accessed. When a user request then needs to
access paged out memory, the response time is poor. It is even worse, when an
SAP solution running on Java incurs a Java garbage collection. The system
starts heavy page-in (disc I/O) activity and has a poor response time for an
extended period of time.*/
vm.pagecache_limit_mb = 41000&lt;/pre&gt;
Max number of open file
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;* hard nofile 32768
* soft nofile 32768&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/3198894059712167280/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/3198894059712167280' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/3198894059712167280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/3198894059712167280'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/linux-kernel-performance-tuning-and.html' title='Linux Kernel Performance Tuning and Hardening'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-6382097429530935237</id><published>2014-04-09T13:20:00.001+08:00</published><updated>2014-04-09T13:20:11.326+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="git"/><title type='text'>Setup git server</title><content type='html'>以前在使用git的時候都是同事幫忙架設，這次剛好有機會順便紀錄一下&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Git Server&lt;/span&gt;&lt;/h2&gt;
&lt;h3&gt;
1. 安裝必要套件&lt;/h3&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# &amp;nbsp;apt-get install git-core&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
2. 建立repository&lt;/h3&gt;
假設所有的project都欲放置/opt/git 並且建立名為project1的git&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;a. # mkdir /opt/git&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;b. # mkdir /opt/git/project1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; # cd /opt/git/project1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; # git --bare init&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Git Client&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
在使用者端，假設project的位置是~/projectA&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# mkdir ~/projectA&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# cd ~/projectA&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# git init&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# echo &quot;project init&quot;&amp;gt;&amp;gt;init&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# git add .&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# git commit -m &quot;init project&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# git remote add origin user@[IP]:/opt/git/project1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# git push origin master&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/6382097429530935237/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/6382097429530935237' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6382097429530935237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6382097429530935237'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/setup-git-server.html' title='Setup git server'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-8566194789159291667</id><published>2014-04-08T16:50:00.002+08:00</published><updated>2014-04-08T16:52:22.337+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="iscsi"/><title type='text'>iSCSI Target and Initiator</title><content type='html'>iSCSI Target是Server端，提供iSCSI 空間。&lt;br /&gt;
iSCSI Initiator是Client端，連接既有的iSCSI空間來使用。&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
iSCSI Target&lt;/span&gt;&lt;/h2&gt;
在Ubuntu上安裝&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
1. 選擇要提供空間的裝置&lt;/h3&gt;
&lt;h3&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;提供服務的空間可以是一個硬碟、一個partition、一個LVM的LV或是使用DD產生一個空間。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;使用以下的方法可以在/media下產生一個20G名稱為volume0的空間。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;#&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;&amp;nbsp;dd if=/dev/zero of=/media/volume0 count=0 obs=1 seek=20G&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3&gt;
2. 安裝必要套件&lt;/h3&gt;
使用APT來安裝必要套件&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#&amp;nbsp;apt-get install &amp;nbsp;iscsitarget iscsitarget-dkms&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
3. 設定iSCSI&amp;nbsp;&lt;/h3&gt;
&lt;div&gt;
a. 設定開機自動啟動&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Edit /etc/default/iscsitarget&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;change&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ISCSITARGET_ENABLE=&lt;span style=&quot;color: red;&quot;&gt;false&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;to&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ISCSITARGET_ENABLE=&lt;span style=&quot;color: red;&quot;&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
b. 設定iSCSI Target&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Edit&amp;nbsp;/etc/iet/ietd.conf&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
加入&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;Target &lt;/b&gt;iqn.2010-12.nl.ytec.arbiter:arbiter.blabla.lun1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;Lun &lt;/b&gt;0 &lt;b&gt;Path&lt;/b&gt;=/media/volume0,&lt;b&gt;Type&lt;/b&gt;=fileio,&lt;b&gt;ScsiId&lt;/b&gt;=lun0,&lt;b&gt;ScsiSN&lt;/b&gt;=lun0&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
其中，需要修改的參數是:&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;I.&lt;/b&gt; Target 後面接的名字，可自訂。&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;II.&lt;/b&gt; Lun一定要從0開始。&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;III.&lt;/b&gt; PATH後面接的參數是空間的位置，如果是剛剛使用dd 產生出來的則為/media/volume0否則更改為實際的空間例如/dev/sdb1 etc.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
4. 重新啟動iSCSI Target&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#&amp;nbsp;/etc/init.d/iscsitarget restart&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;
iSCSI Initiator&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
以OpenSuse為例&lt;/div&gt;
&lt;h3&gt;
1. 安裝必要套件&lt;/h3&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# yast -i&amp;nbsp;open-iscsi&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
2. 搜尋可用iSCSI Lun&lt;/h3&gt;
&lt;div&gt;
使用iscsiadm來搜尋可用的裝置&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# iscsiadm -m discovery --type=st --portal=[iscsi target的IP]&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;sample output:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;192.168.1.101:3260,1 iqn.2010-12.nl.ytec.arbiter:arbiter.blabla.lun1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
3. 連接裝置&lt;/h3&gt;
&lt;div&gt;
確定找的到裝置之後就可以連接iSCSI裝置&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#&amp;nbsp;iscsiadm &amp;nbsp;-m &amp;nbsp;node &amp;nbsp;-T iqn.2010-12.nl.ytec.arbiter:arbiter.blabla.lun1 --login&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
使用lsscsi來檢查是否有連接成功&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# lsscsi&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Sample output:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;[0:2:0:0] &amp;nbsp; &amp;nbsp;disk &amp;nbsp; &amp;nbsp;Intel &amp;nbsp; &amp;nbsp;MegaSR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.0 &amp;nbsp; /dev/sda&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;[1:2:0:0] &amp;nbsp; &amp;nbsp;disk &amp;nbsp; &amp;nbsp;Intel &amp;nbsp; &amp;nbsp;RMS25CB080 &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.22 &amp;nbsp;/dev/sdb&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;[18:0:0:0] &amp;nbsp; disk &amp;nbsp; &amp;nbsp;IET &amp;nbsp; &amp;nbsp; &amp;nbsp;VIRTUAL-DISK &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; /dev/sdc&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
4. 掛載裝置&lt;/h3&gt;
&lt;div&gt;
假設我們欲將裝置format成XFS並掛載到/opt/iscsi&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# mkfs.xfs /dev/sdc&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# mkdir /opt/iscsi&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# mount -t xfs /dev/sdc /opt/iscsi&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/8566194789159291667/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/8566194789159291667' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/8566194789159291667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/8566194789159291667'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/iscsi-target-and-initiator.html' title='iSCSI Target and Initiator'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-4224947256682576114</id><published>2014-04-04T21:06:00.000+08:00</published><updated>2014-04-07T19:19:44.970+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>大資料資料庫儲存-NoSQL比較及效能差異(VII)</title><content type='html'>在大資料資料庫儲存的最終篇將比較各NoSQL的差異和效能的比較。&lt;br /&gt;
&lt;h2&gt;
NoSQL 比較&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI9bSly0AdQOO0viHJgOqfboZX0nkWsb_z15BdkfVh215JQe7xT8jzM-XtI1athmzLh2NmPoNUpGI2yofl7nlvjHeK0-Np-MRzFC58ihqvNniS_di3cY-QrzHUoFeBNwCDAa-p_tH-8Ko/s1600/nosql+difference.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI9bSly0AdQOO0viHJgOqfboZX0nkWsb_z15BdkfVh215JQe7xT8jzM-XtI1athmzLh2NmPoNUpGI2yofl7nlvjHeK0-Np-MRzFC58ihqvNniS_di3cY-QrzHUoFeBNwCDAa-p_tH-8Ko/s1600/nosql+difference.PNG&quot; height=&quot;225&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;
Experiment Environment&lt;/h2&gt;
&lt;h3&gt;
Hardware and Network Topology&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0NKoMDa86nCbXy7fIb98rWaJvXxhIgis6kz9G6XjgTbEOLUgpyLdTWEYKpeHH-8uLZiBcQGwZmOCL_8SOInddsmpeblHGH4E7tIVAX1vNtLfLIzAEg2jmFsnSRICtkvu-Co5wjb4gJaI/s1600/hw.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0NKoMDa86nCbXy7fIb98rWaJvXxhIgis6kz9G6XjgTbEOLUgpyLdTWEYKpeHH-8uLZiBcQGwZmOCL_8SOInddsmpeblHGH4E7tIVAX1vNtLfLIzAEg2jmFsnSRICtkvu-Co5wjb4gJaI/s1600/hw.PNG&quot; height=&quot;212&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Software Version&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAoJelT4w8Zr9CFmxxQB0NRxjfrf1mzMyzRf9f3916PWFW4MM6SakYE3VErO5s47rXUoxkAdwsABchJSGJVu1Q875husmDg7F6pPsaq5t_A3r6qQOM3fjfai9SwaMEDKwd1hAK8CngUpM/s1600/sw.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAoJelT4w8Zr9CFmxxQB0NRxjfrf1mzMyzRf9f3916PWFW4MM6SakYE3VErO5s47rXUoxkAdwsABchJSGJVu1Q875husmDg7F6pPsaq5t_A3r6qQOM3fjfai9SwaMEDKwd1hAK8CngUpM/s1600/sw.PNG&quot; height=&quot;157&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;clear: both; text-align: left;&quot;&gt;
MySQL VS Big Data&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmLC9TRCwQrxEp-oKdUx3rfWVwN5SbfcuyyD5rwaL1iGs5kSFG7Jd7bA9BsZyhO21nnnFrC-4YW5OU95K4MrEl9laaO2fELuWFRApqC5yJBVXYeqyGAX-Wvb0rxVtffUA-u9Lxdpt5iws/s1600/mysql+test.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmLC9TRCwQrxEp-oKdUx3rfWVwN5SbfcuyyD5rwaL1iGs5kSFG7Jd7bA9BsZyhO21nnnFrC-4YW5OU95K4MrEl9laaO2fELuWFRApqC5yJBVXYeqyGAX-Wvb0rxVtffUA-u9Lxdpt5iws/s1600/mysql+test.PNG&quot; height=&quot;266&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&amp;nbsp;Insert Data&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmR8mVe3Gb_f-0Mvuw6ERoK8vtI8MfUKBlcijZ6I55Y7-QqWKLhgxqAZxv6uNmIGMa-_ofrYaHeg7Wrm9IcMOD_Cp-umfrXKRF7Hxs5vNE16kezi04v7u_guBj6qrD88o9GcX7a6LpgJw/s1600/insert.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmR8mVe3Gb_f-0Mvuw6ERoK8vtI8MfUKBlcijZ6I55Y7-QqWKLhgxqAZxv6uNmIGMa-_ofrYaHeg7Wrm9IcMOD_Cp-umfrXKRF7Hxs5vNE16kezi04v7u_guBj6qrD88o9GcX7a6LpgJw/s1600/insert.PNG&quot; height=&quot;262&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;h3&gt;
&amp;nbsp;Update Data&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0pj90tA_3fMUX6aTKf6J2FrUiud3Ws0irnYIdMLEfX7s2lf23v77JQW4PSUphCuKpiT3CivXWEUqE8asc1Y7y_E1M7TVRZ_mif416uUPv5h-ZRE5w3kxhuxJE9Sse7TpQWwHJvdOub-I/s1600/update.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0pj90tA_3fMUX6aTKf6J2FrUiud3Ws0irnYIdMLEfX7s2lf23v77JQW4PSUphCuKpiT3CivXWEUqE8asc1Y7y_E1M7TVRZ_mif416uUPv5h-ZRE5w3kxhuxJE9Sse7TpQWwHJvdOub-I/s1600/update.PNG&quot; height=&quot;270&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
Look-up Data&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgljE9EpdO7K4YU5lG4l7TRJrY-ELsmdu4FFFO9cOq8Fh3oHqIpIbViHElcL6D-4lrzDjjnsW1-6kdhBbfo1XP9nrUbIO6A548MK4PZBGcEEqgGCKWxtuTmnUrchXs4zy6aRB3PwHMIjUw/s1600/search.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgljE9EpdO7K4YU5lG4l7TRJrY-ELsmdu4FFFO9cOq8Fh3oHqIpIbViHElcL6D-4lrzDjjnsW1-6kdhBbfo1XP9nrUbIO6A548MK4PZBGcEEqgGCKWxtuTmnUrchXs4zy6aRB3PwHMIjUw/s1600/search.PNG&quot; height=&quot;261&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
Delete Data&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL9FoIAAGTydkjHVa1-JTzFuWi2YqzvB76VIB9HKCkbt_YHmb5rO6-EuzYRtZoCrIdbfG9w_jLDueTsJFolDeEAWKpuWTts-M9D6RgUaNcR124QqqZmk_agD8p02-IaUlUJNk6z0BKaBw/s1600/delete.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL9FoIAAGTydkjHVa1-JTzFuWi2YqzvB76VIB9HKCkbt_YHmb5rO6-EuzYRtZoCrIdbfG9w_jLDueTsJFolDeEAWKpuWTts-M9D6RgUaNcR124QqqZmk_agD8p02-IaUlUJNk6z0BKaBw/s1600/delete.PNG&quot; height=&quot;263&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/4224947256682576114/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/4224947256682576114' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/4224947256682576114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/4224947256682576114'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/nosqlvii.html' title='大資料資料庫儲存-NoSQL比較及效能差異(VII)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI9bSly0AdQOO0viHJgOqfboZX0nkWsb_z15BdkfVh215JQe7xT8jzM-XtI1athmzLh2NmPoNUpGI2yofl7nlvjHeK0-Np-MRzFC58ihqvNniS_di3cY-QrzHUoFeBNwCDAa-p_tH-8Ko/s72-c/nosql+difference.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-5519555229351062872</id><published>2014-04-04T20:54:00.001+08:00</published><updated>2014-04-07T19:19:56.737+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>大資料資料庫儲存-Memcache和Redis介紹(VI)</title><content type='html'>Memcahce和Redis都是大多數被拿來當Cache system用途的NoSQL。他們的共通點是都是以Key-Value的形式將資料存在記憶體中。因此R/W的IO非常的快。&lt;br /&gt;
&lt;br /&gt;
而兩個比較大的差別是，Redis可以將資料儲存在Local Drive中，而Memcache只能存在memory。另外一點則是，Memcache的value沒有型別而Redis則支援多種型別ex. map, set, list etc.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Memcahce&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqd8jB8zpFhwPghyphenhyphen9qeB16ho9PWLDyxxnOK5Gr5y_bzCi_5pRmewkh_Uj0-M0Z0kSXhqmobFUrLPmkmx2pgjTMHWLuJN2QqnispB3N_-xqy-hcUqrPNEGkeI9En0E3o-RooVlqcaW0fvE/s1600/memcache.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqd8jB8zpFhwPghyphenhyphen9qeB16ho9PWLDyxxnOK5Gr5y_bzCi_5pRmewkh_Uj0-M0Z0kSXhqmobFUrLPmkmx2pgjTMHWLuJN2QqnispB3N_-xqy-hcUqrPNEGkeI9En0E3o-RooVlqcaW0fvE/s1600/memcache.PNG&quot; height=&quot;150&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
Memcache Use Scenario&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8UOmGHo2A85ZkPoeDrH-R-w2V2jKjGeYaqRmGy007HhyphenhyphenrVSIyRlZQFfDhqwEQBG5HkLeWmiquaOC-te8OxAga1Wew6mqIt17WRWwvx0OuesauL5IpFmgMeLYLQYTxyCZjlCeGFhwQo5w/s1600/memcache+scenario.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8UOmGHo2A85ZkPoeDrH-R-w2V2jKjGeYaqRmGy007HhyphenhyphenrVSIyRlZQFfDhqwEQBG5HkLeWmiquaOC-te8OxAga1Wew6mqIt17WRWwvx0OuesauL5IpFmgMeLYLQYTxyCZjlCeGFhwQo5w/s1600/memcache+scenario.PNG&quot; height=&quot;280&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;
REDIS&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSIIdWweRwR0s2PVo9Sqa6CQx-8YHMygmnFgZZvM8WC-Q3_l1lk4Tn8riBI139lvou_CkREHxMoXB57Uij65bo6vnEV-38Jg8MIPqxhd7XcS763Zsu4M5C6u7XTRc-ZZEG_9T7Lqgy87M/s1600/redis.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSIIdWweRwR0s2PVo9Sqa6CQx-8YHMygmnFgZZvM8WC-Q3_l1lk4Tn8riBI139lvou_CkREHxMoXB57Uij65bo6vnEV-38Jg8MIPqxhd7XcS763Zsu4M5C6u7XTRc-ZZEG_9T7Lqgy87M/s1600/redis.PNG&quot; height=&quot;137&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;
REDIS Data Type&lt;/h2&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3dblCW13fakTSrBcnsucvyGS0Hkukj4_FiL7owtddxqlcRbNHwhKA24CubDgQBOAgmGb8yBSYwh2buL8cVR6k9tDbLx7_0KeP7X81GhBoq5Dgk-StebKY7iI22S7fMSDXnrLalOGIfPA/s1600/redis+data+model.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3dblCW13fakTSrBcnsucvyGS0Hkukj4_FiL7owtddxqlcRbNHwhKA24CubDgQBOAgmGb8yBSYwh2buL8cVR6k9tDbLx7_0KeP7X81GhBoq5Dgk-StebKY7iI22S7fMSDXnrLalOGIfPA/s1600/redis+data+model.PNG&quot; height=&quot;194&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/5519555229351062872/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/5519555229351062872' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5519555229351062872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5519555229351062872'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/memcacheredisvi.html' title='大資料資料庫儲存-Memcache和Redis介紹(VI)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqd8jB8zpFhwPghyphenhyphen9qeB16ho9PWLDyxxnOK5Gr5y_bzCi_5pRmewkh_Uj0-M0Z0kSXhqmobFUrLPmkmx2pgjTMHWLuJN2QqnispB3N_-xqy-hcUqrPNEGkeI9En0E3o-RooVlqcaW0fvE/s72-c/memcache.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-5164339055994467246</id><published>2014-04-04T20:40:00.001+08:00</published><updated>2014-04-07T19:20:19.953+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>大資料資料庫儲存--MongoDB介紹(V)</title><content type='html'>&lt;a href=&quot;http://clhjoe.blogspot.tw/2014/04/hbaseiv.html&quot;&gt;前一篇&lt;/a&gt;介紹了HBase，接著將繼續介紹MongoDB&lt;br /&gt;
&lt;h2&gt;
MongoDB&lt;/h2&gt;
&lt;div&gt;
MongoDB是由10gen這一家公司開發的，與Cassandra和Hbase不同的是，MongoDB是一個document base的一個NoSQL。他支援Auto-sharding的功能另外一個比較特別的是，它內建了以javascript來利用map-reduce的概念搜尋資料。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmqihI_RG1MyAgpIYmlTLKxw2VoqtYvRphsAOk_fLDTkI9dVBoKQjulAdi6x0QrFkuwxbEttC1Z0kqlfzqMbCqsbydJ3zPnccSA-_Kx5rddeF5d3ZMyr5faZt_5G23EOgNgo32s9tcWAE/s1600/mongodb.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmqihI_RG1MyAgpIYmlTLKxw2VoqtYvRphsAOk_fLDTkI9dVBoKQjulAdi6x0QrFkuwxbEttC1Z0kqlfzqMbCqsbydJ3zPnccSA-_Kx5rddeF5d3ZMyr5faZt_5G23EOgNgo32s9tcWAE/s1600/mongodb.PNG&quot; height=&quot;157&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;
Data Structure&lt;/h2&gt;
&lt;div&gt;
MongoDB既然說是一個Document base的資料庫，那麼舉個最簡單應用的例子來說明他的優點。假設我們有一個database是紀錄post文章和每個文章的comment。以RDBMS最簡單的方式就是建立兩個table分別存放文章和comment。因此要撈出某一筆文章和其留言就必須要兩個query。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
那麼MongoDB呢?既然他是Document base，那麼我們可以在一個document記錄了文章和留言，因此，撈出一篇文章和留言就只需要一個request！&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTkjrt_dyl7NWCWh3CHJB-XFRemowZUZSfCC8Y04PaNHRTwLP1SA4ry47CdPEIbOgs4b4fEjH0EGs_RMuYg9IutMQhZ8SkqebwjEfLC9TX9MApEFfr7p-MzEG-E7J3xnjoNQAwxxoMnkI/s1600/mongo+structure.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTkjrt_dyl7NWCWh3CHJB-XFRemowZUZSfCC8Y04PaNHRTwLP1SA4ry47CdPEIbOgs4b4fEjH0EGs_RMuYg9IutMQhZ8SkqebwjEfLC9TX9MApEFfr7p-MzEG-E7J3xnjoNQAwxxoMnkI/s1600/mongo+structure.PNG&quot; height=&quot;212&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;
Write Path&lt;/h2&gt;
&lt;div&gt;
MongoDB有三個角色，分別是存放Data的mongod、Cmongod存放shard key和mongos負責做load balance和將使用者的request導到對的shard server。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE4KIFrhdXHXltw0AZwzxJxy_y7WdssxqD6yLNzXK6K-KqRzF37xIeLU7gxj_gpDGYXndhsIPHbTP_OINNCOwqeUdmJljFCdTwBY3-wEFnAO3oo6aR2L8vtlmjbtNIM8A7IWbSFsqEiLU/s1600/mongo+data+path.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE4KIFrhdXHXltw0AZwzxJxy_y7WdssxqD6yLNzXK6K-KqRzF37xIeLU7gxj_gpDGYXndhsIPHbTP_OINNCOwqeUdmJljFCdTwBY3-wEFnAO3oo6aR2L8vtlmjbtNIM8A7IWbSFsqEiLU/s1600/mongo+data+path.PNG&quot; height=&quot;192&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
&amp;nbsp;When to use MongoDB?&lt;/h2&gt;
&lt;div&gt;
MongoDB可以非常lightweight(有人想要取代sqlite)，當你沒有複雜的transaction ex. 不是banking的系統就可以看看MongoDB。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBZ_I32qdYXNUcDJehBgZE0T_dntxPQeB7i889twvYjO0w-1hJeVhzPs7MKNn9gAKu8_OSYDBy0GzV0EmiHf4r7zVuSIyD2dQef8lTQd8G3PvqXzAXSCDCVBDAKXSmMmwboaUaLrIyeWU/s1600/whentousemongodb.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBZ_I32qdYXNUcDJehBgZE0T_dntxPQeB7i889twvYjO0w-1hJeVhzPs7MKNn9gAKu8_OSYDBy0GzV0EmiHf4r7zVuSIyD2dQef8lTQd8G3PvqXzAXSCDCVBDAKXSmMmwboaUaLrIyeWU/s1600/whentousemongodb.PNG&quot; height=&quot;166&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/5164339055994467246/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/5164339055994467246' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5164339055994467246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5164339055994467246'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/mongodbv.html' title='大資料資料庫儲存--MongoDB介紹(V)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmqihI_RG1MyAgpIYmlTLKxw2VoqtYvRphsAOk_fLDTkI9dVBoKQjulAdi6x0QrFkuwxbEttC1Z0kqlfzqMbCqsbydJ3zPnccSA-_Kx5rddeF5d3ZMyr5faZt_5G23EOgNgo32s9tcWAE/s72-c/mongodb.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-2027698770334580003</id><published>2014-04-04T20:18:00.002+08:00</published><updated>2014-04-04T20:18:53.640+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>大資料資料庫儲存--HBASE介紹(IV)</title><content type='html'>&lt;a href=&quot;http://clhjoe.blogspot.tw/2014/04/cassandra-iii.html&quot;&gt;前一篇&lt;/a&gt;介紹了Cassandra，而在這裡將繼續介紹Cassandra。&lt;br /&gt;
&lt;h2&gt;
HBase&lt;/h2&gt;
&lt;div&gt;
Hbase是一個Apache top-level的project。他強調的是CAP理論中的CP也就是consistency 和Partition tolerance。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilRfr9nCqWtKNb_wQjNbLZAz35T_if14yX4KooY7Yb2FLgGG0wZUhCJZ-tb1j211Ufw9ns-YjGzneqlnrUowiC65fA8ABa_Aa-gMI3TnBaq0oJynin9wz5qPpAYnA98R3pgTrgJr746Tg/s1600/hbase.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilRfr9nCqWtKNb_wQjNbLZAz35T_if14yX4KooY7Yb2FLgGG0wZUhCJZ-tb1j211Ufw9ns-YjGzneqlnrUowiC65fA8ABa_Aa-gMI3TnBaq0oJynin9wz5qPpAYnA98R3pgTrgJr746Tg/s1600/hbase.PNG&quot; height=&quot;107&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
HBase Data Model&lt;/h2&gt;
&lt;div&gt;
既然前一篇介紹了Cassandra，那麼在這裡就以Cassandra的範例來比較Hbase和Cassandra的不同。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Hbase最大的不同是，他的每一個CF(Column family)即為一個map，而每一筆資料的CF的ket set可以是不同的。而另外一點是，在hbase裡，所有的data都為byte array。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSKEuFJp_AScSpSNaXBGA3oiDjVqazwCVQqRqjWLMHbIBsQNr3o8CyTcttHIaJyBKI-cU2d1xDXjBBRxKXcqJ1lUeJB0dd8MoWxIfGg4GRmt0QuydEwEbicdOgw_7mPBZKj40kRbseBLE/s1600/hbase+data+model.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSKEuFJp_AScSpSNaXBGA3oiDjVqazwCVQqRqjWLMHbIBsQNr3o8CyTcttHIaJyBKI-cU2d1xDXjBBRxKXcqJ1lUeJB0dd8MoWxIfGg4GRmt0QuydEwEbicdOgw_7mPBZKj40kRbseBLE/s1600/hbase+data+model.PNG&quot; height=&quot;240&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
HBase Data Path&amp;nbsp;&lt;/h2&gt;
&lt;div&gt;
Hbase有一張很嚇人的圖，它的特點是箭頭特別多。但是我們可以很簡單的理解這張圖&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh06d6eg70p9sIJS9p86e18vuWK_1Gh_4hbhn7p6t89eNwo201WY97J1ZyRIj-J5zQiB31fjJLowkh-4jP5-ojy7hWF8TLT2CbZ284MFqjVExh5uouTxN312T6wn148hcAobzaRc5kSitM/s1600/data+path1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh06d6eg70p9sIJS9p86e18vuWK_1Gh_4hbhn7p6t89eNwo201WY97J1ZyRIj-J5zQiB31fjJLowkh-4jP5-ojy7hWF8TLT2CbZ284MFqjVExh5uouTxN312T6wn148hcAobzaRc5kSitM/s1600/data+path1.PNG&quot; height=&quot;208&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;nbsp;以下圖為例，Hadoop的Data node其實就是很多台可以存放data 的node。以上圖為例，負責回應request的Hbase 節點有兩個。&lt;br /&gt;
&lt;i&gt;P.S. Hbase是可以把資料存放在local disk而非HDFS不可的。&lt;/i&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOv8s5Hab4y9b0jxplAgNr8NycKaR7QmSwIZjuTNOEJLRxGFhfJjAvWJ0dWl5kY5sTNY79bseMNI-2ZMmWtXAsZ2a6YOH0jpLpq-UOJGf6VOEFlhyphenhyphenVstfTnEMuWVxSg73ThVjHIB7Smhc/s1600/data+path2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOv8s5Hab4y9b0jxplAgNr8NycKaR7QmSwIZjuTNOEJLRxGFhfJjAvWJ0dWl5kY5sTNY79bseMNI-2ZMmWtXAsZ2a6YOH0jpLpq-UOJGf6VOEFlhyphenhyphenVstfTnEMuWVxSg73ThVjHIB7Smhc/s1600/data+path2.PNG&quot; height=&quot;222&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp;使用者(client)會先留到zookeeper，zookeper會將使用者導到其中一台hbase server。使用者Insert依資料時，hbase會先存成hlog(在損毀時可以roll back)然後存到memstore(可以想像成memory 的小database)接著把資料存到HDFS中稱作Hfile。&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguB9FHvqocjaPK1tFgi8P17PegBw3w_SvvABrUdBVYZSDKzh_lO4O0jib3r_6CC4MdcW9TT3YSNs4q9xPFBHCBWijpYPNNKWVxUfMdL5ick4G30_eADPlkkhoTuRvZPTfk_05MVAbOG-A/s1600/data+path3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguB9FHvqocjaPK1tFgi8P17PegBw3w_SvvABrUdBVYZSDKzh_lO4O0jib3r_6CC4MdcW9TT3YSNs4q9xPFBHCBWijpYPNNKWVxUfMdL5ick4G30_eADPlkkhoTuRvZPTfk_05MVAbOG-A/s1600/data+path3.PNG&quot; height=&quot;223&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
NoSQL DON&#39;Ts&lt;/h2&gt;
&lt;div&gt;
在NoSQL風靡了幾年之後，開始有人反思：到底NoSQL真的有比傳統的RDBMS好嗎?或者說，我們真的需要NoSQL嗎?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
在選擇之前，必須要先了解NoSQL &lt;span style=&quot;color: red;&quot;&gt;做不到&lt;/span&gt;的事:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS0QkRAZj3zJNEYVEAP-r95pGscf9_N1WTMTDazwBdtUDZOM5p5f85zyycMXYTBAcQAfF2oM58Ibsbn3Z6VmmMx_8eo6GeQUNoe0JcmHcxOYObZxTrSYmIn3MvwA5gOFzENM49lhn9EKA/s1600/nosql+dont.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS0QkRAZj3zJNEYVEAP-r95pGscf9_N1WTMTDazwBdtUDZOM5p5f85zyycMXYTBAcQAfF2oM58Ibsbn3Z6VmmMx_8eo6GeQUNoe0JcmHcxOYObZxTrSYmIn3MvwA5gOFzENM49lhn9EKA/s1600/nosql+dont.PNG&quot; height=&quot;193&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
另外一個迷思是，很多人認為在大資料的時代下，傳統的RDBMS是無法應付的?真的是如此嗎? 以Facebook為例，他們是使用sharding來存放使用者的post。你的資料有比他多嗎?&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/2027698770334580003/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/2027698770334580003' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/2027698770334580003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/2027698770334580003'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/hbaseiv.html' title='大資料資料庫儲存--HBASE介紹(IV)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilRfr9nCqWtKNb_wQjNbLZAz35T_if14yX4KooY7Yb2FLgGG0wZUhCJZ-tb1j211Ufw9ns-YjGzneqlnrUowiC65fA8ABa_Aa-gMI3TnBaq0oJynin9wz5qPpAYnA98R3pgTrgJr746Tg/s72-c/hbase.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-820023184149198594</id><published>2014-04-04T19:44:00.000+08:00</published><updated>2014-04-07T19:21:10.693+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>大資料資料庫儲存--Cassandra 介紹(III)</title><content type='html'>&lt;a href=&quot;http://clhjoe.blogspot.tw/2014/04/what-is-nosqlii.html&quot;&gt;上一篇&lt;/a&gt; 我們介紹了什麼是NoSQL，在這裡，我們即將慢慢地介紹常見的NoSQL。&lt;br /&gt;
&lt;h2&gt;
Cassandra&lt;/h2&gt;
&lt;div&gt;
Cassandra是Apache Software foundation的top-level project。他是key-value的結構，比較不一樣的是它是tunable的consistency。什麼意思呢?就是說他可以選擇consistency的程度，例如確保2個data node的資料都被更新了才return 成功或是全部都更新了才回傳成功。&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjctKftwLGMCrCZcSe1hWeJJrSEIEm3p0VBdjZucTwijM3HCEDc8-Uf75LVlP34y672jZvQJpiRsb1jZA_Dgh-Vzw1U9WASVVCY4_-tj2R9sOaBIEKScef72tknOH-5-rvF28vfjjZDdWw/s1600/cassdra.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjctKftwLGMCrCZcSe1hWeJJrSEIEm3p0VBdjZucTwijM3HCEDc8-Uf75LVlP34y672jZvQJpiRsb1jZA_Dgh-Vzw1U9WASVVCY4_-tj2R9sOaBIEKScef72tknOH-5-rvF28vfjjZDdWw/s1600/cassdra.PNG&quot; height=&quot;117&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;
Cassandra Data Model&lt;/h2&gt;
&lt;div&gt;
Cassandra的Data model主要有Keyspace對應RDBMS的database、Column family對應Table、Row key對應Primary key和Column name/key對應Column name。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
我們可以簡單地把Keyspace裡面的column family(RDBMS的Table)看成是一個map of a sorted map。一個column family是一個sorted map，他的key就是每個row的row key，而value是一個map，存放每一個column 的value e.g. map&amp;lt;column name, column value&amp;gt;。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivEaStknSECX6DmlzrNYIsAA5qKu2ltCwFJ6uPhZxAHvSLSP_Y7JI9YcFvitgtnMAMwtN2Kv1pADqIgu6YKRm5eGmpebUUYyeNQbOCt8SiUetR1RVG4SIWVodgnSgVQr6cOqAYuBuItxY/s1600/cassandra-keyspace.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivEaStknSECX6DmlzrNYIsAA5qKu2ltCwFJ6uPhZxAHvSLSP_Y7JI9YcFvitgtnMAMwtN2Kv1pADqIgu6YKRm5eGmpebUUYyeNQbOCt8SiUetR1RVG4SIWVodgnSgVQr6cOqAYuBuItxY/s1600/cassandra-keyspace.PNG&quot; height=&quot;255&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Cassandra的Column family有兩種分別是Static column Family和Dynamic column family。Static column Family和RDBMS很像，在create column family(table)的時候就定義好schema。而Dynamic column family則是在Insert data的時候，data的你仍舊可以插入未定義的column。舉例來說，假設我們的schema定義了name, email, address，你仍舊可以插入一個叫state的column的data。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
另外一個不一樣的是，在RDBMS插入一個空的內容仍舊會佔去空間的。舉例來說，假設插入了一筆資料，其中一個定義4 byte char的欄位是空的，仍舊會佔去4 byte。Cassandra則沒有這個問題。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMs5OTtXdJTR3g9Fl-BS2Ofx-tCs8HvQRrS-o6Sb5kVPSAJSV8_TXxGfpxULr_-DLTax-2IlcD-l1v1zO0xznT0Nu7ymcGqkvnojh-Cz0ln59aXRrcjbKnqFtSvwWWaj_1YrvQgNUU6cM/s1600/column+family.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMs5OTtXdJTR3g9Fl-BS2Ofx-tCs8HvQRrS-o6Sb5kVPSAJSV8_TXxGfpxULr_-DLTax-2IlcD-l1v1zO0xznT0Nu7ymcGqkvnojh-Cz0ln59aXRrcjbKnqFtSvwWWaj_1YrvQgNUU6cM/s1600/column+family.PNG&quot; height=&quot;243&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
Cassandra write path&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi16JE09xlOXJEuSSyU-MquVkHxvoqeWOQ1JmtFBMq36X7SF76zy-E7fOeZ5vKE6pXFdVV5Pz7ei2N0SEXknm6L8uguexZCi8_d0QzpQC3lplfIuRH9CW8EYC566cdcV_bOhatpgO-WEJw/s1600/cassandra+write+path.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi16JE09xlOXJEuSSyU-MquVkHxvoqeWOQ1JmtFBMq36X7SF76zy-E7fOeZ5vKE6pXFdVV5Pz7ei2N0SEXknm6L8uguexZCi8_d0QzpQC3lplfIuRH9CW8EYC566cdcV_bOhatpgO-WEJw/s1600/cassandra+write+path.PNG&quot; height=&quot;211&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;clear: both; text-align: left;&quot;&gt;
Cassandra Tunable Consistency&lt;/h3&gt;
&lt;div&gt;
Cassandra分了6個consistency level如下表:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieawPB9viy5hRLqZuamlYocA02Vlq8Er8KvepqeegeoSLVm_31MPrfoH5S-4G8LTArNXlkv7Ruxxzek0Qo5g7eUl-vCzb02kj_3nJSgnck3bEcLijV7SYQhWPVgUL9dE_VZ_an2TZkrTA/s1600/cassandra+tunable+consistency.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieawPB9viy5hRLqZuamlYocA02Vlq8Er8KvepqeegeoSLVm_31MPrfoH5S-4G8LTArNXlkv7Ruxxzek0Qo5g7eUl-vCzb02kj_3nJSgnck3bEcLijV7SYQhWPVgUL9dE_VZ_an2TZkrTA/s1600/cassandra+tunable+consistency.PNG&quot; height=&quot;250&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/820023184149198594/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/820023184149198594' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/820023184149198594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/820023184149198594'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/cassandra-iii.html' title='大資料資料庫儲存--Cassandra 介紹(III)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjctKftwLGMCrCZcSe1hWeJJrSEIEm3p0VBdjZucTwijM3HCEDc8-Uf75LVlP34y672jZvQJpiRsb1jZA_Dgh-Vzw1U9WASVVCY4_-tj2R9sOaBIEKScef72tknOH-5-rvF28vfjjZDdWw/s72-c/cassdra.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-5836910861720417592</id><published>2014-04-04T19:24:00.003+08:00</published><updated>2014-04-07T19:21:30.710+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>大資料資料庫儲存--What is NoSQL(II)</title><content type='html'>在上一篇&lt;span style=&quot;background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;a href=&quot;http://clhjoe.blogspot.tw/2014/04/i.html&quot;&gt;大資料資料庫儲存--傳統的解決方案(I)&lt;/a&gt;&lt;/span&gt;介紹了在傳統在大資料量的解決方法，而前幾年開始熱門的NoSQL又是什麼東西?對於大資料量又有什麼不一樣的解決方式呢?&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
The CAP Theorem&lt;/h2&gt;
在聊NoSQL之前有必要先介紹有名的CAP理論。Wiki是這樣說的:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; color: #252525; line-height: 21px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;In&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Theoretical_computer_science&quot; style=&quot;background-image: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Theoretical computer science&quot;&gt;theoretical computer science&lt;/a&gt;, the&amp;nbsp;&lt;b&gt;CAP theorem&lt;/b&gt;, also known as&amp;nbsp;&lt;b&gt;Brewer&#39;s theorem&lt;/b&gt;, states that it is impossible for a&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Distributed_computing&quot; style=&quot;background-image: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Distributed computing&quot;&gt;distributed computer system&lt;/a&gt;&amp;nbsp;to simultaneously provide all three of the following guarantees:&lt;sup class=&quot;reference&quot; id=&quot;cite_ref-Lynch_1-0&quot; style=&quot;line-height: 1; unicode-bidi: -webkit-isolate;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/CAP_theorem#cite_note-Lynch-1&quot; style=&quot;background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; text-decoration: none; white-space: nowrap;&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;sup class=&quot;reference&quot; id=&quot;cite_ref-2&quot; style=&quot;line-height: 1; unicode-bidi: -webkit-isolate;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/CAP_theorem#cite_note-2&quot; style=&quot;background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; text-decoration: none; white-space: nowrap;&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;background-color: white; color: #252525; line-height: 21px;&quot;&gt;
&lt;li style=&quot;margin-bottom: 0.1em;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;Consistency&lt;/i&gt;&amp;nbsp;(all nodes see the same data at the same time)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;background-color: white; color: #252525; line-height: 21px;&quot;&gt;
&lt;li style=&quot;margin-bottom: 0.1em;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Availability&quot; style=&quot;background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; text-decoration: none;&quot; title=&quot;Availability&quot;&gt;Availability&lt;/a&gt;&lt;/i&gt;&amp;nbsp;(a guarantee that every request receives a response about whether it was successful or failed)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;background-color: white; color: #252525; line-height: 21px;&quot;&gt;
&lt;li style=&quot;margin-bottom: 0.1em;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;a class=&quot;mw-redirect&quot; href=&quot;http://en.wikipedia.org/wiki/Network_partitioning&quot; style=&quot;background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; text-decoration: none;&quot; title=&quot;Network partitioning&quot;&gt;Partition tolerance&lt;/a&gt;&lt;/i&gt;&amp;nbsp;(the system continues to operate despite arbitrary message loss or failure of part of the system)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
簡單來說就是在一個分散式的系統裡面只可能同時間滿足consistency, availability和partition tolerance中的其二。&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAM-Xb-85u7BnzdEbsHHZyiL3VPEPeBDhr-n7_OVZ84LnJYDRsNBL91KMfMv5GS9w0GI39Evm8-zjAh7KIlwO0YYf1ZdV0XDKcVcC5sWcVzTZxPY2GLAFpgitHKSUhhyF7p63Zh6wKE-g/s1600/cap.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAM-Xb-85u7BnzdEbsHHZyiL3VPEPeBDhr-n7_OVZ84LnJYDRsNBL91KMfMv5GS9w0GI39Evm8-zjAh7KIlwO0YYf1ZdV0XDKcVcC5sWcVzTZxPY2GLAFpgitHKSUhhyF7p63Zh6wKE-g/s1600/cap.PNG&quot; height=&quot;235&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
What is NoSQL?&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&amp;nbsp;較早之前有人會以為NoSQL就是字面上的意思e.g. 不要SQL。事實上，NoSQL應該被解釋為not only relational database。意思是說有別於關聯式資料庫的資料庫。&lt;br /&gt;
&lt;br /&gt;
NoSQL要解決的是傳統的Relational Database比較難解決(非不能解決)的scalability-尤其是scale-out的方式。當資料量及Request一多的時候怎麼存放這麼多的資料及應付龐大的資料存取問題。而另外一個很大的差別則是schemaless，也就是不像Relational Database在Insert data之前一定要有定義好的schema。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK3cKw6iYe100ap8Zaq8Os8AndrjnqYW26hMiNo7I8GYLJGbEy_MwbdbUyfhiuyzmKHZbaG_6Y9PQl2mYCRscYXzUbgHL0smjaQ5g9wvksOSHJbR8cm6e1cqhg3zb1DNSUGie5dC5ubfw/s1600/whatisnosql.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK3cKw6iYe100ap8Zaq8Os8AndrjnqYW26hMiNo7I8GYLJGbEy_MwbdbUyfhiuyzmKHZbaG_6Y9PQl2mYCRscYXzUbgHL0smjaQ5g9wvksOSHJbR8cm6e1cqhg3zb1DNSUGie5dC5ubfw/s1600/whatisnosql.PNG&quot; height=&quot;265&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://clhjoe.blogspot.tw/2014/04/cassandra-iii.html&quot;&gt;下一篇&lt;/a&gt;我們將開始介紹常見的NoSQL&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/5836910861720417592/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/5836910861720417592' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5836910861720417592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5836910861720417592'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/what-is-nosqlii.html' title='大資料資料庫儲存--What is NoSQL(II)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAM-Xb-85u7BnzdEbsHHZyiL3VPEPeBDhr-n7_OVZ84LnJYDRsNBL91KMfMv5GS9w0GI39Evm8-zjAh7KIlwO0YYf1ZdV0XDKcVcC5sWcVzTZxPY2GLAFpgitHKSUhhyF7p63Zh6wKE-g/s72-c/cap.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-6765412313584920536</id><published>2014-04-04T17:41:00.000+08:00</published><updated>2014-04-07T19:19:28.827+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>大資料資料庫儲存--傳統的解決方案(I)</title><content type='html'>&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;
The problem&lt;/h2&gt;
&lt;div&gt;
以MySQL為例，在一個table裡面存放10,000筆資料絕對不是問題。但是，當我們的資料上升到十萬筆、一百萬筆甚至一千萬筆，這個時候對資料庫的影響是什麼?當使用者數量一多，資料庫是否依舊能夠在一定的時間內回覆使用者的要求呢?&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEganmZyHCIZ53auabpB5Ji3myT-pBTE8sVJrsxsoOW5qIkxSeyQtApbpYWkM8TLmswHNWqifZPs3Z0O1rfHth8BwtwKtzK4-ZyQMIDbzfkrXWiZFPHMBkaT_T-K5LGKimZUgPWR3mdDkSs/s1600/few+data.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEganmZyHCIZ53auabpB5Ji3myT-pBTE8sVJrsxsoOW5qIkxSeyQtApbpYWkM8TLmswHNWqifZPs3Z0O1rfHth8BwtwKtzK4-ZyQMIDbzfkrXWiZFPHMBkaT_T-K5LGKimZUgPWR3mdDkSs/s1600/few+data.PNG&quot; height=&quot;320&quot; width=&quot;308&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxy7B5qE8hPP6I20iFA2-XsQpEYHqR8wvG9ZZbGqyrBUumosc9OHXM-JxgPgDjcopkHeAuvb1s72aH37QQj6QTQa5KNhqIAXB3GSCjCeY_3EhtmJnMSpkvPiu_A4KwkjAohB5Sgk86bis/s1600/many+data.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxy7B5qE8hPP6I20iFA2-XsQpEYHqR8wvG9ZZbGqyrBUumosc9OHXM-JxgPgDjcopkHeAuvb1s72aH37QQj6QTQa5KNhqIAXB3GSCjCeY_3EhtmJnMSpkvPiu_A4KwkjAohB5Sgk86bis/s1600/many+data.PNG&quot; height=&quot;320&quot; width=&quot;271&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;h2&gt;
Traditional Solution&lt;/h2&gt;
傳統的解決方法不代表是個落伍的、被淘汰的方法。相對的，是一個被證明可以有效解決是個能夠在Production中實作的一些方法。而事實上，大多數的網站仍舊使用這些方法來解決既有大資料量的問題。&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHGhOZRIbj4LO0vSpSIZYF4r8xFtW6DywB26UftXqOC7xy5_Wz2hKyELD2-EnylbVy4z8b6feaeF1yrnAoOb1a107QKK8Hddo8B61gg79hjLx5xBV_2e_a6UBUnTcdDzDuJrikb8Fx3GI/s1600/partitionand+sharding.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHGhOZRIbj4LO0vSpSIZYF4r8xFtW6DywB26UftXqOC7xy5_Wz2hKyELD2-EnylbVy4z8b6feaeF1yrnAoOb1a107QKK8Hddo8B61gg79hjLx5xBV_2e_a6UBUnTcdDzDuJrikb8Fx3GI/s1600/partitionand+sharding.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Partition和Sharing最大的差別在-Partition是將一個table的資料切割放置到多個table；而sharing則是將一個table的資料放置到多個database中(通常是多台資料庫實體)。&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Pros and Cons&lt;/h2&gt;
那麼，partition和sharing各有什麼優缺點呢?&lt;br /&gt;
&lt;h3&gt;
&amp;nbsp;Partition&lt;/h3&gt;
&lt;div&gt;
大多數的資料庫其實都已經支援了Partition。Partition的設定方式主要是告訴資料庫要以哪一個column為依據，設定切割的條件。例如int的欄位，可以設定成1~1000為一個table、2000~3000一個table、剩下的一個table。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Partition相對於sharding最大的好處是不需要重寫SQL Logic。資料庫會根據搜尋的條件至相對應的table做query。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
但最大的缺點是，儘管是切割成多個table但仍舊是放在同一個database。通常，隨著資料量增加也代表使用者變多了，當然request也變多了。資料庫的效能仍舊受限於該台資料庫所能提供的throughput。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjWeObjbq5PO3tickDt1OgzTOI7Jz_2PC8K-zWjdL16gycGcEnOKTvzdZfWynxYYuNXA3Rmil8NlhOSo-Shy8OJsDtFFXpe-JRAySd8NlI7gAVXvSTXxeL2srDMUEsIDvnFTjV0gE6xnM/s1600/partition.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjWeObjbq5PO3tickDt1OgzTOI7Jz_2PC8K-zWjdL16gycGcEnOKTvzdZfWynxYYuNXA3Rmil8NlhOSo-Shy8OJsDtFFXpe-JRAySd8NlI7gAVXvSTXxeL2srDMUEsIDvnFTjV0gE6xnM/s1600/partition.PNG&quot; height=&quot;228&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;clear: both; text-align: left;&quot;&gt;
Sharding&lt;/h3&gt;
&lt;div&gt;
Sharding顧名思義的就是將一個table的資料切割放置到多台資料庫中。在實作上，我們可以自己改寫SQL Logic根據我們切割的條件來決定該request要發送到哪一台database。或者，我們也可以看到有許多framework來幫助你完成這件事。例如，&lt;a href=&quot;http://dev.mysql.com/doc/mysql-utilities/1.4/en/fabric.html&quot;&gt;MySQL Fabric&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;https://github.com/youtube/vitess&quot; style=&quot;background-color: white; color: #4c44cc; font-family: tahoma, arial, sans-serif; font-weight: bold;&quot;&gt;Vitess&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;https://github.com/twitter/gizzard&quot; style=&quot;background-color: white; color: #4c44cc; font-family: tahoma, arial, sans-serif; font-weight: bold;&quot;&gt;Gizzard&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;https://github.com/tumblr/jetpants&quot; style=&quot;background-color: white; color: #4c44cc; font-family: tahoma, arial, sans-serif; font-weight: bold;&quot;&gt;Jetpants&lt;/a&gt;等等。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Sharding好處是資料庫的throughput可以隨著資料庫實體的增加而提升也就是scale out的solution。但最大的壞處是，因為資料散落在不同的資料庫，因此你可能做不到join沒有ACID transaction而且因為所有的查尋會因為資料切割的條件變得更複雜。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEfnA2VDTMoC-nyOtd6qc8ktN9X2PJmDxWJegEnnhuO3Tr-ItKEuiXDL3tn495n_Bkkg6MQhg_CxZlOq4XOVWQ3bpWho4rawHaodsQU-sFVkNl4KnE2XQua2eql2xviCW-vQavttm-LPY/s1600/sharding.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEfnA2VDTMoC-nyOtd6qc8ktN9X2PJmDxWJegEnnhuO3Tr-ItKEuiXDL3tn495n_Bkkg6MQhg_CxZlOq4XOVWQ3bpWho4rawHaodsQU-sFVkNl4KnE2XQua2eql2xviCW-vQavttm-LPY/s1600/sharding.PNG&quot; height=&quot;247&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;
How about Big Requests?&lt;/h2&gt;
&lt;div&gt;
前面有提到，資料量的提升通常也代表使用量變多隨之而來的request也變多了。假設我們已經把資料shard到不同資料庫了，我們要怎麼分散流量呢? Open Source的Load balancer solution是 &amp;nbsp;HAProxy, Nginx或是MySQL Proxy(beta)，當然也可以購買貴鬆鬆Hardware load balancer。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
另外，MySQL也有MySQL Cluster可以做到load balancer、auto sharding等等。不過就不在本篇的討論中了。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg36KvdTh5ad__bjEuCZcE0zPD1MeEwSxmxav0jGngbhGZC_UvNz1p9_AqILP_97iMP7SAO8-79t1VTZKha3aQHvJa68-8sj2bsFLeHX7fVpWezAUG0C_SCkIa3WUoiu7C5ACb5OpXKow8/s1600/big+request.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg36KvdTh5ad__bjEuCZcE0zPD1MeEwSxmxav0jGngbhGZC_UvNz1p9_AqILP_97iMP7SAO8-79t1VTZKha3aQHvJa68-8sj2bsFLeHX7fVpWezAUG0C_SCkIa3WUoiu7C5ACb5OpXKow8/s1600/big+request.PNG&quot; height=&quot;270&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/6765412313584920536/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/6765412313584920536' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6765412313584920536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6765412313584920536'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2014/04/i.html' title='大資料資料庫儲存--傳統的解決方案(I)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEganmZyHCIZ53auabpB5Ji3myT-pBTE8sVJrsxsoOW5qIkxSeyQtApbpYWkM8TLmswHNWqifZPs3Z0O1rfHth8BwtwKtzK4-ZyQMIDbzfkrXWiZFPHMBkaT_T-K5LGKimZUgPWR3mdDkSs/s72-c/few+data.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-162079948577741784</id><published>2012-07-27T15:47:00.001+08:00</published><updated>2012-07-30T16:59:54.755+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><title type='text'>Design Pattern: Singleton in JAVA, C#, C++</title><content type='html'>&lt;b&gt;定義:&lt;/b&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;保證一個class只有一個實體(Instance),並為它提供一個全域的訪問點(global access point)。&lt;br /&gt;
&lt;br /&gt;
有的時候我們希望某個Class只會有一個Instance被產生。例如，Android中如果多個thread去access同一個DB就會產生錯誤。因此我們可能會希望透過一個Instance統一由他去Access 同一個DB。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;在&lt;span style=&quot;color: red;&quot;&gt;JAVA&lt;/span&gt;中實作的方式如下:
&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;brush :java&quot;&gt;public class Singleton {
    private volatile Singleton instance = null;
        public Singleton getInstance() {
            if (instance == null) {
                synchronized(this) {
                    if (instance == null)
                        instance = new Singleton();
                }
            }
            return instance;
        }
    }

&lt;/pre&gt;
&lt;b&gt;深入探討:&lt;/b&gt;&lt;br /&gt;
為了避免multi-thread 的race condition發生及效率，這裡使用double check locking。避免race condtion的發生所以使用synchronized()。但是synchronized()可能造成performance的低落。因此在外層先判斷如果真的是null才進入critical section否則直接return。&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
在JDK 4（包含）以下的版本不支援volatile。volatile保證再每次取此變數的值時會去memory抓取而非從cache讀取。不加volatile有可能導致程式碼執行順序被 re-order。進而發生其他thread執行實可能看到非null的instance(但他這個時候明明是null)。&lt;br /&gt;
&lt;br /&gt;
另外，上述的作法是lazy-Initialization的作法。也就是說當真正需要的時候才會被new出來。但是如果我們很確定程式中一定會去new這個物件，其實先把他new 出來也不會有什麼損失。
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;Singleton without Lazy-Initialization&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush :java&quot;&gt;public class Singleton {
    private volatile Singleton instance = new Singleton();
        public Singleton getInstance() {
            return instance;
        }
    }

&lt;/pre&gt;
這樣做的另外一個好處 程式碼看起來也比較清爽。&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
_____________________________________________________________________________________________________________&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;在&lt;span style=&quot;color: red;&quot;&gt;C#&lt;/span&gt;方式如下:
&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: c#&quot;&gt;using System;

public sealed class Singleton
{
   private static volatile Singleton instance;
   private static object syncRoot = new Object();

   private Singleton() {}

   public static Singleton Instance
   {
      get 
      {
         if (instance == null) 
         {
            lock (syncRoot) 
            {
               if (instance == null) 
                  instance = new Singleton();
            }
         }

         return instance;
      }
   }
}
&lt;/pre&gt;
&lt;br /&gt;
在上面的code中，使用sealed來避免被繼承進而發生可能產生多個instance。另外使用lock的方法來避免multi-thread的race condition。如同在JAVA說的，volatile可以避免out of order所造成的問題。另外，如果不需要lazy-initialization我們可以這樣寫:&lt;br /&gt;
&lt;pre class=&quot;brush:c#&quot;&gt;public sealed class Singleton
{
   private static readonly Singleton instance = new Singleton();
   
   private Singleton(){}

   public static Singleton Instance
   {
      get 
      {
         return instance; 
      }
   }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
使用readonly來保證instance只會在static initialization過程時或是在class constructor裡被建立。&lt;br /&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;_____________________________________________________________________________________________________________&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;&lt;b&gt;在&lt;span style=&quot;color: red;&quot;&gt;C++&lt;/span&gt;的實作就比較簡單了&lt;/b&gt;：&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:c++&quot;&gt;class Singleton {
public: 
    static Singleton* Instance(){
    if (_instance == 0) {
        _instance = new Singleton;
    }
    return _instance;
}
protected: 
    Singleton();
private:
    static Singleton* _instance=0;
}

&lt;/pre&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;然而這個作法不是thread safe的。在C++使用如上面提到的Double checked locking方法及使用volatile並不能保證out of order的問題。也就是說在C++上面使用volatile並無法像C#/JAVA上面來保證使用volatile的variable 不會被re-order。因此像下面的DCL的code還是無法保證Thread-Safe。&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:c++&quot;&gt;class  Singleton {  
public :  
    static  Singleton* Instance() {  
        Lock lock;  
        if  (_instance == 0) {  
            _instance =  new  Singleton;  
        }  
        return  _instance;  
    }  
private :  
    static  Singleton *  volatile  _instance;  
    Singleton(){  
    }  
};  
&lt;/pre&gt;
&lt;br /&gt;
最後看到Solstice使用pthread解決這問題，如下：&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:c++&quot;&gt;#include &lt;pthread.h&gt;
template&amp;lt;typename T&amp;gt;
class Singleton : boost::noncopyable
{
public:
    static T&amp;amp; instance()
    {
        pthread_once(&amp;amp;ponce_, &amp;amp;Singleton::init);
        return *value_;
    }
    static void init()
    {
        value_ = new T();
    }
private:
    static pthread_once_t ponce_;
    static T* value_;
};
template&amp;lt;typename T&amp;gt;
pthread_once_t Singleton&amp;lt;T&amp;gt;::ponce_ = PTHREAD_ONCE_INIT;
template&amp;lt;typename T&amp;gt;
T* Singleton&amp;lt;T&amp;gt;::value_ = NULL;&lt;/pthread.h&gt;&lt;/pre&gt;
&lt;br /&gt;
Reference:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/DesignPattern/SingletonPattern.htm&quot;&gt;Gossip@caterpillar&amp;nbsp;Design Pattern: Simple Factory 模式&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html&quot;&gt;The &quot;Double-Checked Locking is Broken&quot; Declaration&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ff650316.aspx&quot;&gt;MSDN:Implementing Singleton in C#&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://files.cppblog.com/Solstice/multithreaded_server.pdf&quot;&gt;多线程服务器的常用编程模型&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/162079948577741784/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/162079948577741784' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/162079948577741784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/162079948577741784'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/design-pattern-singleton-in-java-c.html' title='Design Pattern: Singleton in JAVA, C#, C++'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-5308354300806912547</id><published>2012-07-20T13:40:00.000+08:00</published><updated>2012-07-20T13:40:21.638+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="driver"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><title type='text'>i2c 設備模型</title><content type='html'>在&lt;a href=&quot;http://chxxxyg.blog.163.com/blog/static/150281193201082623428605/&quot;&gt;http://chxxxyg.blog.163.com/blog/static/150281193201082623428605/&lt;/a&gt;看到下面這兩張 畫的真好&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://img.ph.126.net/eE-FeoToepcF4WsWFkBxtA==/2366641604183583467.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://img.ph.126.net/eE-FeoToepcF4WsWFkBxtA==/2366641604183583467.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://img.ph.126.net/BZkpw0k4LFmbPEaQn7szPA==/1507017025309382378.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://img.ph.126.net/BZkpw0k4LFmbPEaQn7szPA==/1507017025309382378.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/5308354300806912547/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/5308354300806912547' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5308354300806912547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/5308354300806912547'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/i2c_20.html' title='i2c 設備模型'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-4423380988926974041</id><published>2012-07-18T17:43:00.002+08:00</published><updated>2012-07-18T17:43:53.354+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="driver"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><title type='text'>I2C簡介(二)</title><content type='html'>&lt;a href=&quot;http://clhjoe.blogspot.tw/2012/07/i2c.html&quot;&gt;前一篇&lt;/a&gt;簡單說明了如果寫I2C device的driver。這篇主要要介紹I2C adapter(controller的Driver)。在這裡我們直接以Tegra3的I2C Controller為例來說明。要注意的是，一個板子可能會有很多controller，而一個controller可能會有多條bus。每一個bus會對應一個adapter。&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Board-Specific Code&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Tegra3的board-specific code在arch/arm/mach-tegra/device.c 及arch/arm/mach-tegra/board-cardhu.c中。從source code我們可以看出Tegra 3有五組I2C controller。我們先看device.c的部份，在這裡主要是填寫platform_device的資料如下：
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;//arch/arm/mach-tegra/device.c
static struct resource i2c_resource1[] = {
 [0] = {
  .start = INT_I2C,
  .end = INT_I2C,
  .flags = IORESOURCE_IRQ,
 },
 [1] = {
  .start = TEGRA_I2C_BASE,
  .end = TEGRA_I2C_BASE + TEGRA_I2C_SIZE-1,
  .flags = IORESOURCE_MEM,
 },
};
                               .
                               .
                               .

static struct resource i2c_resource5[] = {
 [0] = {
  .start  = INT_I2C5,
  .end    = INT_I2C5,
  .flags  = IORESOURCE_IRQ,
 },
 [1] = {
  .start = TEGRA_I2C5_BASE,
  .end = TEGRA_I2C5_BASE + TEGRA_I2C5_SIZE-1,
  .flags = IORESOURCE_MEM,
 },
};
#endif

static struct tegra_i2c_platform_data tegra_i2c1_platform_data = {
 .bus_clk_rate   = { 400000 },
};
                               .
                               .
                               .

static struct tegra_i2c_platform_data tegra_dvc_platform_data = {
 .bus_clk_rate   = { 400000 },
};

struct platform_device tegra_i2c_device1 = {
 .name  = &quot;tegra-i2c&quot;,
 .id  = 0,
 .resource = i2c_resource1,
 .num_resources = ARRAY_SIZE(i2c_resource1),
 .dev = {
  .platform_data = &amp;amp;tegra_i2c1_platform_data,
 },
};
                               .
                               .
                               .

struct platform_device tegra_i2c_device5 = {
 .name  = &quot;tegra-i2c&quot;,
 .id  = 4,
 .resource = i2c_resource5,
 .num_resources = ARRAY_SIZE(i2c_resource5),
 .dev = {
  .platform_data = 0,
 },
};
&lt;/pre&gt;
接著我們繼續看board-cardhu.c。不知道為什麼，在這邊又把platform_data蓋掉＠＠。
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;static struct tegra_i2c_platform_data cardhu_i2c1_platform_data = {
 .adapter_nr = 0,
        //設定這個controller有幾個bus
 .bus_count = 1,
 .bus_clk_rate = { 100000, 0 },
 .scl_gpio  = {TEGRA_GPIO_PC4, 0},
 .sda_gpio  = {TEGRA_GPIO_PC5, 0},
 .arb_recovery = arb_lost_recovery,
};

                               .
                               .
                               .

static struct tegra_i2c_platform_data cardhu_i2c5_platform_data = {
 .adapter_nr = 4,
 .bus_count = 1,
 .bus_clk_rate = { 400000, 0 },
 .scl_gpio  = {TEGRA_GPIO_PZ6, 0},
 .sda_gpio  = {TEGRA_GPIO_PZ7, 0},
 .arb_recovery = arb_lost_recovery,
};

static struct i2c_board_info __initdata cardhu_codec_wm8903_info = {
 I2C_BOARD_INFO(&quot;wm8903&quot;, 0x1a),
 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
 .platform_data = &amp;amp;cardhu_wm8903_pdata,
};

static struct i2c_board_info __initdata cardhu_codec_aic326x_info = {
 I2C_BOARD_INFO(&quot;aic3262-codec&quot;, 0x18),
 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
};

static struct i2c_board_info __initdata cardhu_codec_max98095_info = {
 I2C_BOARD_INFO(&quot;max98095&quot;, 0x10),
 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
 .platform_data = &amp;amp;cardhu_max98095_pdata,
};

static void cardhu_i2c_init(void)
{
 tegra_i2c_device1.dev.platform_data = &amp;amp;cardhu_i2c1_platform_data;
                        .
                               .
                               .

 tegra_i2c_device5.dev.platform_data = &amp;amp;cardhu_i2c5_platform_data;

 platform_device_register(&amp;amp;tegra_i2c_device5);
                        .
                               .
                               .

 platform_device_register(&amp;amp;tegra_i2c_device1);

        
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;I2C Controller Driver&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
看完了platform_device的宣告後，我們理所當然的去看platform_driver的地方。實作的位置在driver/i2c/busses/i2c-tegra.c。這裡我們從tegra_i2c_init_driver（）看起。
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;static int tegra_i2c_probe(struct platform_device *pdev)
{
 struct tegra_i2c_dev *i2c_dev;
 struct tegra_i2c_platform_data *plat = pdev-&amp;gt;dev.platform_data;
 struct resource *res;
 struct resource *iomem;
 struct clk *div_clk;
 struct clk *fast_clk = NULL;
 const unsigned int *prop;
 void *base;
 int irq;
 int nbus;
 int i = 0;
 int ret = 0;

        //取得定義在device.c的platform_device 的resource且flag為IORESOURCE_MEM 的資料
 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
        //檢查從res-&amp;gt;start~res-&amp;gt;start+ resource_size(res)是否可用
        iomem = request_mem_region(res-&amp;gt;start, resource_size(res), pdev-&amp;gt;name);
 
        //mapping到kernel虛擬空間
 base = ioremap(iomem-&amp;gt;start, resource_size(iomem));
 
 div_clk = clk_get(&amp;amp;pdev-&amp;gt;dev, &quot;i2c-div&quot;);
 
 fast_clk = clk_get(&amp;amp;pdev-&amp;gt;dev, &quot;i2c-fast&quot;);
 
        i2c_dev = kzalloc(sizeof(struct tegra_i2c_dev) +
     (nbus-1) * sizeof(struct tegra_i2c_bus), GFP_KERNEL);
 

 i2c_dev-&amp;gt;base = base;
 i2c_dev-&amp;gt;div_clk = div_clk;
 i2c_dev-&amp;gt;fast_clk = fast_clk;
 i2c_dev-&amp;gt;iomem = iomem;
 i2c_dev-&amp;gt;irq = irq;
 i2c_dev-&amp;gt;cont_id = pdev-&amp;gt;id;
 i2c_dev-&amp;gt;dev = &amp;amp;pdev-&amp;gt;dev;
 i2c_dev-&amp;gt;is_clkon_always = plat-&amp;gt;is_clkon_always;

 i2c_dev-&amp;gt;last_bus_clk_rate = 100000; /* default clock rate */
 i2c_dev-&amp;gt;last_bus_clk_rate = plat-&amp;gt;bus_clk_rate[0];
        i2c_dev-&amp;gt;is_high_speed_enable = plat-&amp;gt;is_high_speed_enable;
 i2c_dev-&amp;gt;last_bus_clk_rate = plat-&amp;gt;bus_clk_rate[0] ?: 100000;
 i2c_dev-&amp;gt;msgs = NULL;
 i2c_dev-&amp;gt;msgs_num = 0;
 rt_mutex_init(&amp;amp;i2c_dev-&amp;gt;dev_lock);
 spin_lock_init(&amp;amp;i2c_dev-&amp;gt;fifo_lock);

 i2c_dev-&amp;gt;slave_addr = plat-&amp;gt;slave_addr;
 i2c_dev-&amp;gt;hs_master_code = plat-&amp;gt;hs_master_code;
 i2c_dev-&amp;gt;is_dvc = plat-&amp;gt;is_dvc;
 i2c_dev-&amp;gt;arb_recovery = plat-&amp;gt;arb_recovery;
 init_completion(&amp;amp;i2c_dev-&amp;gt;msg_complete);

 if (irq == INT_I2C || irq == INT_I2C2 || irq == INT_I2C3)
  i2c_dev-&amp;gt;is_slave = true;

 platform_set_drvdata(pdev, i2c_dev);

 if (i2c_dev-&amp;gt;is_clkon_always)
  tegra_i2c_clock_enable(i2c_dev);

 ret = tegra_i2c_init(i2c_dev);
 if (ret) {
  dev_err(&amp;amp;pdev-&amp;gt;dev, &quot;Failed to initialize i2c controller&quot;);
  goto err_free;
 }

 

 for (i = 0; i &amp;lt; nbus; i++) {
  struct tegra_i2c_bus *i2c_bus = &amp;amp;i2c_dev-&amp;gt;busses[i];

  i2c_bus-&amp;gt;dev = i2c_dev;
  i2c_bus-&amp;gt;mux = plat-&amp;gt;bus_mux[i];
  i2c_bus-&amp;gt;mux_len = plat-&amp;gt;bus_mux_len[i];
  i2c_bus-&amp;gt;bus_clk_rate = plat-&amp;gt;bus_clk_rate[i] ?: 100000;

  i2c_bus-&amp;gt;scl_gpio = plat-&amp;gt;scl_gpio[i];
  i2c_bus-&amp;gt;sda_gpio = plat-&amp;gt;sda_gpio[i];

  i2c_bus-&amp;gt;adapter.dev.of_node = pdev-&amp;gt;dev.of_node;
  i2c_bus-&amp;gt;adapter.algo = &amp;amp;tegra_i2c_algo;
  i2c_set_adapdata(&amp;amp;i2c_bus-&amp;gt;adapter, i2c_bus);
  i2c_bus-&amp;gt;adapter.owner = THIS_MODULE;
  i2c_bus-&amp;gt;adapter.class = I2C_CLASS_HWMON;
  strlcpy(i2c_bus-&amp;gt;adapter.name, &quot;Tegra I2C adapter&quot;,
   sizeof(i2c_bus-&amp;gt;adapter.name));
  i2c_bus-&amp;gt;adapter.dev.parent = &amp;amp;pdev-&amp;gt;dev;
  i2c_bus-&amp;gt;adapter.nr = plat-&amp;gt;adapter_nr + i;

                //!!將此bus註冊進kernel中
  ret = i2c_add_numbered_adapter(&amp;amp;i2c_bus-&amp;gt;adapter);
                //註冊此bus的adapter
  of_i2c_register_devices(&amp;amp;i2c_bus-&amp;gt;adapter);

  i2c_dev-&amp;gt;bus_count++;
 }

 return 0;
        ...
}

static struct platform_driver tegra_i2c_driver = {
 .probe   = tegra_i2c_probe,
 .remove  = tegra_i2c_remove,
 .driver  = {
  .name  = &quot;tegra-i2c&quot;,
  .owner = THIS_MODULE,
  .of_match_table = tegra_i2c_of_match,
  .pm    = TEGRA_I2C_DEV_PM_OPS,
 },
};

static int __init tegra_i2c_init_driver(void)
{
        //註冊tegra_i2c_driver，跳到tegra_i2c_probe繼續看
 return platform_driver_register(&amp;amp;tegra_i2c_driver);
}
subsys_initcall(tegra_i2c_init_driver);&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.uchobby.com/index.php/2008/09/16/introduction-to-i2c/&quot;&gt;Introduction to I2C&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://huenlil.pixnet.net/blog/post/23359925-linux-i2c-driver%3A-what&#39;s-new-style-!%3F&quot;&gt;Linux I2C driver: what&#39;s new-style !?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.blogabc.net/i1266_I2C%E6%80%BB%E7%BA%BF%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95%E7%BB%A7%E7%BB%AD%E7%A0%94%E7%A9%B6.htm&quot;&gt;I2C总线使用方法继续研究&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://nv-tegra.nvidia.com/gitweb/&quot;&gt;nVidia Tegra Kernel Source&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/4423380988926974041/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/4423380988926974041' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/4423380988926974041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/4423380988926974041'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/i2c_18.html' title='I2C簡介(二)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-1245109217077608165</id><published>2012-07-18T15:07:00.001+08:00</published><updated>2012-07-18T17:44:29.723+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="driver"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><title type='text'>I2C簡介(一)</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;I2C簡介&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
I2C 全名是Inter IC，原先是Phillips發展的一個two-wire 的serial bus protocol。他是一種半雙工同步多組設備匯流排。只需要兩條線:串列資料線(SDA)與串列時脈線(SCL or SCK)。I2C 提供兩種定址模式與三種傳輸模式。定址方面分成10-bit（允許連接1024個裝置）與&amp;nbsp;7-bit （允許連接128個裝置）。傳輸方面則有10kbps 的低速模式、100kbps 的標準模式、及 400kbps 的快速模式。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
I2C連接的裝置都是Open Drain的接腳，也就是說導通的時候電位是low，而不導通時為high。I2C通常用在嵌入式系統與不同的裝置溝通。在PC，I2C通常用來與不同的sensor 連結例如取得系統風扇的轉速、CPU的溫度等等。&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;I2C in Linux&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
I2C 在kernel 2.x的時候開始支援。在Linux Kernel中，I2C的code拆成四個部份: I2C core、I2C bus drivers、I2C algorithm drivers 和 I2C chip drivers。&lt;br /&gt;
&lt;br /&gt;
舉一個例子，一個PMU(power management unit)利用I2C與SOC連結。要使PMU能夠正確運作我們必須先撰寫I2C adapter(controller)的driver，讓I2C bus可以正常運作。I2C adapter(controller)可能是外接的chip也可能是在SOC裡頭例如Tegra3擁有五組I2C controller。再來，我們必須撰寫PMU的driver，註冊進正確的I2C bus中。透過adapter(controller)與device溝通。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
這一篇的介紹是在於如何撰寫下圖的i2c client driver來控制(R/W)i2c device。&lt;br /&gt;
一個板子可能會有很多controller，而一個controller可能會有多條bus。每一個bus會對應一個adapter。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0kafiFUqc8GLNsaphQpSGZiGXRKgh24hsDw6B_UmHcPCm_qZOP5D45uIgv83g2aULjJxEXY7Rmk7_9W75AqBbkXEZbgeKq4Mv8iDWFY7ajEoaxUAgspk5vSy8kV2gy9A12ZlziBmO_j8/s1600/i2c+%25281%2529.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0kafiFUqc8GLNsaphQpSGZiGXRKgh24hsDw6B_UmHcPCm_qZOP5D45uIgv83g2aULjJxEXY7Rmk7_9W75AqBbkXEZbgeKq4Mv8iDWFY7ajEoaxUAgspk5vSy8kV2gy9A12ZlziBmO_j8/s400/i2c+%25281%2529.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;撰寫I2C Device Driver&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
在這裡我們直接以TI的PMU tps6591為例子說明。原始碼一樣可以透過下面 reference中抓取。&lt;br /&gt;
我們首先先看看tps6591 board-specific code的地方。我們看cardhu_regulator_init()。
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;//arch/arm/mach-tegra/board-cardhu-power.c
static struct tps6591x_platform_data tps_platform = {
        //pmu的irq起始編號
 .irq_base = TPS6591X_IRQ_BASE,
        //gpio的起始編號
 .gpio_base = TPS6591X_GPIO_BASE,
 .dev_slp_en = true,
 .slp_keepon = &amp;amp;tps_slp_keepon,
 .use_power_off = true,
};

static struct i2c_board_info __initdata cardhu_regulators[] = {
    {
        //設定pmu的i2c device number
        I2C_BOARD_INFO(&quot;tps6591x&quot;, 0x2D),
        .irq    = INT_EXTERNAL_PMU,
        .platform_data = &amp;amp;tps_platform,
    },
};

int __init cardhu_regulator_init(void){
    ...
    /**註冊i2c device進list: __i2c_board_list
      *bus number=4  
      *device info=cardhu_regulators
      *#device=1 
    */
    i2c_register_board_info(4, cardhu_regulators, 1);
    ...
}
&lt;/pre&gt;
接著在tps6591的driver中，我們從tps6591x_init()看起。
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;//driver/mfd/tps6591x.c

static int __devinit tps6591x_i2c_probe(struct i2c_client *client,
     const struct i2c_device_id *id)
{
 struct tps6591x_platform_data *pdata = client-&amp;gt;dev.platform_data;
 struct tps6591x *tps6591x;
 int ret;

 if (!pdata) {
  dev_err(&amp;amp;client-&amp;gt;dev, &quot;tps6591x requires platform data\n&quot;);
  return -ENOTSUPP;
 }

 ret = i2c_smbus_read_byte_data(client, TPS6591X_VERNUM);
 if (ret &amp;lt; 0) {
  dev_err(&amp;amp;client-&amp;gt;dev, &quot;Silicon version number read&quot;
    &quot; failed: %d\n&quot;, ret);
  return -EIO;
 }

 dev_info(&amp;amp;client-&amp;gt;dev, &quot;VERNUM is %02x\n&quot;, ret);

 
        //same as dev_set_drvdata(&amp;amp;dev-&amp;gt;dev, data);
 i2c_set_clientdata(client, tps6591x);

 mutex_init(&amp;amp;tps6591x-&amp;gt;lock);

 ...

 tps6591x_i2c_client = client;

 return 0;

err_add_devs:
 if (client-&amp;gt;irq)
  free_irq(client-&amp;gt;irq, tps6591x);
err_irq_init:
 kfree(tps6591x);
 return ret;
}

static struct i2c_driver tps6591x_driver = {
 .driver = {
  .name = &quot;tps6591x&quot;,
  .owner = THIS_MODULE,
 },
 .probe  = tps6591x_i2c_probe,
 .remove  = __devexit_p(tps6591x_i2c_remove),
#ifdef CONFIG_PM
 .suspend = tps6591x_i2c_suspend,
 .resume  = tps6591x_i2c_resume,
#endif
 .id_table = tps6591x_id_table,
};

static int __init tps6591x_init(void)
{
        /**註冊I2C device driver
         *將這個driver與bus做配對並呼叫probe
        */
 return i2c_add_driver(&amp;amp;tps6591x_driver);
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;R/W VIA I2C&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
如何從I2C device讀取資料呢？我們以 tps6591x_read為例：&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;static inline int __tps6591x_read(struct i2c_client *client,
      int reg, uint8_t *val)
{
 int ret;
        //read data from address:reg
 ret = i2c_smbus_read_byte_data(client, reg);
 if (ret &amp;lt; 0) {
  dev_err(&amp;amp;client-&amp;gt;dev, &quot;failed reading at 0x%02x\n&quot;, reg);
  return ret;
 }

 *val = (uint8_t)ret;

 return 0;
}


&lt;/pre&gt;
讀取資料呢？我們以&amp;nbsp;tps6591x_write為例：&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;static inline int __tps6591x_write(struct i2c_client *client,
     int reg, uint8_t val)
{
 int ret;
        //write value:val to address:reg
 ret = i2c_smbus_write_byte_data(client, reg, val);
 if (ret &amp;lt; 0) {
  dev_err(&amp;amp;client-&amp;gt;dev, &quot;failed writing 0x%02x to 0x%02x\n&quot;,
    val, reg);
  return ret;
 }

 return 0;
}
&lt;/pre&gt;
&lt;br /&gt;
其他的 read/write可以參考driver/i2c/i2c-core.c
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.uchobby.com/index.php/2008/09/16/introduction-to-i2c/&quot;&gt;Introduction to I2C&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://huenlil.pixnet.net/blog/post/23359925-linux-i2c-driver%3A-what&#39;s-new-style-!%3F&quot;&gt;Linux I2C driver: what&#39;s new-style !?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.blogabc.net/i1266_I2C%E6%80%BB%E7%BA%BF%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95%E7%BB%A7%E7%BB%AD%E7%A0%94%E7%A9%B6.htm&quot;&gt;I2C总线使用方法继续研究&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://nv-tegra.nvidia.com/gitweb/&quot;&gt;nVidia Tegra Kernel Source&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;http://clhjoe.blogspot.tw/2012/07/i2c_18.html&quot;&gt;下一篇:I2C簡介(二)&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/1245109217077608165/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/1245109217077608165' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/1245109217077608165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/1245109217077608165'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/i2c.html' title='I2C簡介(一)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0kafiFUqc8GLNsaphQpSGZiGXRKgh24hsDw6B_UmHcPCm_qZOP5D45uIgv83g2aULjJxEXY7Rmk7_9W75AqBbkXEZbgeKq4Mv8iDWFY7ajEoaxUAgspk5vSy8kV2gy9A12ZlziBmO_j8/s72-c/i2c+%25281%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-370928618630503249</id><published>2012-07-11T15:09:00.002+08:00</published><updated>2012-07-17T10:45:17.836+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="driver"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><title type='text'>Linux Kernel Portability-Data type &amp; Data Structure in Linux kernel (二)</title><content type='html'>在&lt;a href=&quot;http://clhjoe.blogspot.tw/2012/07/linux-kernel-portability-data-type-data.html&quot;&gt;上一篇&lt;/a&gt;著重於Linux Kernel 的Portability。這一篇將著重於Linux Kernel的Data Structure。這裡要介紹的Data Structure包括了&lt;span style=&quot;background-color: white;&quot;&gt;Linked lists、&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Queues、&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Maps、及&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Binary trees。&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Linked List&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
這裡直接講用法。Linux Kernel的Linked List是Double Linked List，而且List裡面的元素必須是list_head的structure。舉個例好了，我們要做到如下圖(A B C都是struct sample好了):&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVbKfUt5LwEsJfRNz01JpswCq3w-sk3PjNPocjGFn4EIbBDgCJRt0ZE5ytDKmPX7jAe15sipxjuoc0ExUZ25-_9LQpGV4W-dMO-GeZJO4JY5vgHMAjPgTwVv9mMpZYd-oCypchip6zoJE/s1600/double+linked+list+(1).png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVbKfUt5LwEsJfRNz01JpswCq3w-sk3PjNPocjGFn4EIbBDgCJRt0ZE5ytDKmPX7jAe15sipxjuoc0ExUZ25-_9LQpGV4W-dMO-GeZJO4JY5vgHMAjPgTwVv9mMpZYd-oCypchip6zoJE/s640/double+linked+list+(1).png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;struct sample{
    struct list_head link;
    vold *content;
}
struct sample *A,*B,*C;
&lt;/pre&gt;
現在我們要把ABC串起來。首先我們建立一個叫list_head的Linked list的變數，並初始化它。常見的方法有兩種，結果是一樣的。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;/**
*1. LIST_HEAD(name)
*2. INIT_LIST_HEAD
*/
//method 1
static LIST_HEAD(list_head);

//method 2
struct list_head list_head;
INIT_LIST_HEAD(&amp;amp;list_head);
&lt;/pre&gt;
接著假設我們要先加入A和C，利用list_add()將A加入到list_head後面。然後在將C加入到A後面。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//Add A after list_head,list_head is the head of the list
//e.g list_head-&amp;gt;A
list_add(&amp;amp;A-&amp;gt;link,&amp;amp;list_head);

//Add C after A e.g list_head-&amp;gt;A-&amp;gt;C
list_add(&amp;amp;C-&amp;gt;link,&amp;amp;A-&amp;gt;link);
&lt;/pre&gt;
接著，我們要利用list_add_tail將B加在C之前
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//Add B before C e.g list_head-&amp;gt;A-&amp;gt;B-&amp;gt;C
list_add_tail(&amp;amp;B-&amp;gt;link,&amp;amp;C-&amp;gt;link);
&lt;/pre&gt;
加完了之後我們要怎麼列出List裡面的項目呢？可以利用list_for_each來達成。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//list_for_each(struct list_head *cursor, struct list_head *list)
list_for_each(&amp;amp;A-&amp;gt;link,&amp;amp;list_head){

}
&lt;/pre&gt;
更多的用法可見&amp;lt;linux/list.h&amp;gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Queue&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Linux Kernel的queue叫做kfifo實做在kernel/kfifo.c 宣告在&amp;lt;linux/kfifo.h&amp;gt;。與我們所知的queue相同，kfifo支援enqueue(函式命名成inqueue)跟dequeue。同樣的，kfifo有兩個offset分別是記錄下一個插入位置的enqueue offset跟下一個取出位置的dequeue offset。&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/5/52/Data_Queue.svg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;261&quot; src=&quot;http://upload.wikimedia.org/wikipedia/commons/5/52/Data_Queue.svg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
接下來介紹kfifo的使用方式分為 1. &lt;b&gt;Declare&lt;/b&gt; &amp;nbsp;2. &lt;b&gt;Enqueue&lt;/b&gt;/&lt;b&gt;Dequeue 3&lt;/b&gt;. &lt;b&gt;Other operation&lt;/b&gt;。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Declare&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
a. 利用kfifo_alloc() 動態宣告 &amp;nbsp;&amp;nbsp;
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;struct kfifo fifo;
int ret;
      //宣告一個大小為PAGE_SIZE的queue
ret = kfifo_alloc(&amp;amp;kifo, PAGE_SIZE, GFP_KERNEL);
if (ret)
return ret;

&lt;/pre&gt;
b. 利用DECLARE_KFIFO(name, size)建立 INIT_KFIFO(name)初始化。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Enqueue/Dequeue&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_in(fifo, buf, n)&lt;/b&gt; 將n byte的buf讓入fifo裡。如果fifo free的大小&amp;lt;n 則只會copy free 的size的資料&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_out(fifo, buf, n)&lt;/b&gt;&amp;nbsp;copy n byte到buf中。如果fifo的大小&amp;lt;n 則只會copy fifo大小的data&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_out_peek(fifo, buf, n)&lt;/b&gt;&amp;nbsp;kfifo_out執行後data就會從fifo中刪除。如果想保留可以使用kfifo_out_peek&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Other Operation&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_size(fifo)&lt;/b&gt; 取得fifo大小 &lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_len(fifo)&lt;/b&gt; 取得fifo已使用大小&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_avail(fifo)&lt;/b&gt; 取得fifo可使用大小&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_is_empty(fifo)&lt;/b&gt; 判斷fifo是否為空&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_is_full(fifo) &lt;/b&gt;判斷fifo是否已滿&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_reset(fifo)&lt;/b&gt; 清空fifo。&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;kfifo_free(fifo)&lt;/b&gt; free掉fifo&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
實際的操作範例
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;struct kfifo fifo;
int ret;

//宣告一個大小為PAGE_SIZE的queue
ret = kfifo_alloc(&amp;amp;kifo, PAGE_SIZE, GFP_KERNEL);
if (ret)
    return ret;
int i;
//插入32個size為sizeof(int)的[0,31]到fifo中
for (i = 0; i &amp;lt; 32; i++)
    kfifo_in(fifo, &amp;amp;i; sizeof(i));

unsigned int val;
int ret;

//從fifo讀取一個integer到val 中。資料不會被刪除
ret = kfifo_out_peek(fifo, &amp;amp;val, sizeof(val));
if (ret != sizeof(val))
    return -EINVAL;

printk(KERN_INFO “%u\n”, val); /* should print 0 */


/* while there is data in the queue ... */
while (kfifo_avail(fifo)) {
    unsigned int val;
    int ret;
    /* ... read it, one integer at a time */
    ret = kfifo_out(fifo, &amp;amp;val, sizeof(val));
    if (ret != sizeof(val))
        return -EINVAL;

    printk(KERN_INFO “%u\n”, val);
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Red-Black Tree&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
紅黑樹是一種&lt;span style=&quot;background-color: white;&quot;&gt;semi-balanced binary tree(自平衡二元樹)。主要有以下六種性質：&lt;/span&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;節點不是紅色就是黑色。
&lt;/li&gt;
&lt;li&gt;根節點是黑色。&lt;/li&gt;
&lt;li&gt;所有葉子都是黑色（葉子是NIL節點 e.g不包含資料）。&lt;/li&gt;
&lt;li&gt;每個紅色節點的兩個子節點都是黑色。(從每個葉子到根的所有路徑上不能有兩個連續的紅色節點)&lt;/li&gt;
&lt;li&gt;從任一節點到其每個葉子的所有最短路徑都包含相同數目的黑色節點。&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Red-black_tree_example.svg/800px-Red-black_tree_example.svg.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;192&quot; src=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Red-black_tree_example.svg/800px-Red-black_tree_example.svg.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
紅黑樹在Linux Kernel實作的地方是lib/rbtree.c宣告的地方在&amp;lt;linux/rbtree.h&amp;gt;。這裡直接以 driver/media/video/tegra/avp/avp.c裡面的實作來解釋rbtree的使用。avp.c定義了一個tegra_avp_info的struct，以下擷取其實做。要使用rbtree必須要宣告一個rb_root的變數如下：&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;struct tegra_avp_info {
 ...
 struct rb_root  endpoints;
        ...
};
&lt;/pre&gt;
要開始使用endpoints這個rbtree之前必須給他初始的值&quot;RB_ROOT&quot;如下：
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;static int tegra_avp_probe(struct platform_device *pdev)
{
    struct   *avp;
    avp = kzalloc(sizeof(struct tegra_avp_info), GFP_KERNEL);
    ...
    avp-&amp;gt;endpoints = RB_ROOT;
    ...
}
&lt;/pre&gt;
Linux Kernel的rbtree不包含插入及搜尋的函式，下面同樣以avp的&quot;插入&quot;來說明。
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;static struct remote_info *remote_find(struct tegra_avp_info *avp, u32 local_id)
{
 struct rb_node *n = avp-&amp;gt;endpoints.rb_node;
 struct remote_info *rinfo;

 while (n) {
  rinfo = rb_entry(n, struct remote_info, rb_node);

  if (local_id &amp;lt; rinfo-&amp;gt;loc_id)
   n = n-&amp;gt;rb_left;
  else if (local_id &amp;gt; rinfo-&amp;gt;loc_id)
   n = n-&amp;gt;rb_right;
  else
   return rinfo;
 }
 return NULL;
}
&lt;/pre&gt;
以上例，remote_find()實作搜尋的功能。while loop會traverse整個tree 直到找到相同的id。
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;static int remote_insert(struct tegra_avp_info *avp, struct remote_info *rinfo)
{
 struct rb_node **p;
 struct rb_node *parent;
 struct remote_info *tmp;

 p = &amp;amp;avp-&amp;gt;endpoints.rb_node;
 parent = NULL;
 while (*p) {
  parent = *p;
  tmp = rb_entry(parent, struct remote_info, rb_node);

  if (rinfo-&amp;gt;loc_id &amp;lt; tmp-&amp;gt;loc_id)
   p = &amp;amp;(*p)-&amp;gt;rb_left;
  else if (rinfo-&amp;gt;loc_id &amp;gt; tmp-&amp;gt;loc_id)
   p = &amp;amp;(*p)-&amp;gt;rb_right;
  else {
   pr_info(&quot;%s: avp endpoint id=%x (%s) already exists\n&quot;,
    __func__, rinfo-&amp;gt;loc_id,
    trpc_name(rinfo-&amp;gt;trpc_ep));
   return -EEXIST;
  }
 }
 rb_link_node(&amp;amp;rinfo-&amp;gt;rb_node, parent, p);
 rb_insert_color(&amp;amp;rinfo-&amp;gt;rb_node, &amp;amp;avp-&amp;gt;endpoints);
 rinfo_get(rinfo);
 return 0;
}

&lt;/pre&gt;
以上例，while loop會traverse rbtree去尋找適合的頁節點，然後透過rb_link_node()去link parent。接著再透過rb_insert_color()上色。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;static void remote_remove(struct tegra_avp_info *avp, struct remote_info *rinfo)
{
 rb_erase(&amp;amp;rinfo-&amp;gt;rb_node, &amp;amp;avp-&amp;gt;endpoints);
 rinfo_put(rinfo);
}
&lt;/pre&gt;
刪除節點很簡單，只要呼叫rb_erase（）即可。
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Radix Tree&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Radix Tree使用相對於Red Block Tree來說簡單許多。這裡以之前提過得irq實做為例看看Radix Tree怎麼使用。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Radix Tree實做在lib/radix- tree.c，下面以kernel/irqdesc.c來了解。
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;//Declare a radix tree called irq_desc_tree
static RADIX_TREE(irq_desc_tree, GFP_KERNEL);

static void irq_insert_desc(unsigned int irq, struct irq_desc *desc)
{
        //Insert &lt;irq,desc&gt; into irq_desc_tree
 radix_tree_insert(&amp;amp;irq_desc_tree, irq, desc);
}

struct irq_desc *irq_to_desc(unsigned int irq)
{
        //取得key為irq的value
 return radix_tree_lookup(&amp;amp;irq_desc_tree, irq);
}

static void delete_irq_desc(unsigned int irq)
{
        //刪除key為irq的pair
 radix_tree_delete(&amp;amp;irq_desc_tree, irq);
}

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;color: #666666; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px; margin: 0.5em 0px; padding: 0px 2.5em;&quot;&gt;&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CFkQFjAB&amp;amp;url=http%3A%2F%2Fstid.googlecode.com%2Ffiles%2FLinux.Kernel.Development.3rd.Edition.pdf&amp;amp;ei=gkT2T92aIJCfmQWehq2TBQ&amp;amp;usg=AFQjCNF86Glm6tZbi22wNAHXn35rvkZ63A&amp;amp;sig2=fQ58ll8NOnJhQ9lmWW1Z9w&quot; style=&quot;color: #436590; text-decoration: none;&quot;&gt;Linux Kernel Development Third Edition&amp;nbsp;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://lwn.net/Kernel/LDD3/&quot; style=&quot;color: #436590; text-decoration: none;&quot;&gt;Linux Device Drivers, Third Edition&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CFgQFjAB&amp;amp;url=http%3A%2F%2Fwusewj-linux-books.googlecode.com%2Ffiles%2FEssential%2520Linux%2520Device%2520Drivers%255B2008%2C851p%255D.pdf&amp;amp;ei=XEX2T6P2JLHUmAXdxrWRCw&amp;amp;usg=AFQjCNGW_o5jLL6mYCVhHWnC0XZxujGQwg&amp;amp;sig2=2-NErYlRps-yMrcAAFsL3A&quot; style=&quot;color: #436590; text-decoration: none;&quot;&gt;Essential Linux Device Drivers&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.linuxjournal.com/article/5783?page=0,0&quot; style=&quot;background-color: white; color: #436590; text-decoration: none;&quot;&gt;Writing Portable Device Driver&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://lwn.net/Articles/175432/&quot; style=&quot;background-color: white; color: #436590; text-decoration: none;&quot;&gt;Trees I: Radix trees&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://lwn.net/Articles/184495/&quot; style=&quot;background-color: white; color: #436590; text-decoration: none;&quot;&gt;Trees II: red-black trees&lt;/a&gt;&lt;/ul&gt;
&lt;a href=&quot;http://clhjoe.blogspot.tw/2012/07/linux-kernel-portability-data-type-data.html&quot;&gt;上一篇:Linux Kernel Portability-Data type &amp;amp; Data Structure in Linux kernel (一)&lt;/a&gt;
&lt;script src=&#39;http://syntaxhighlight-blogger-dynamic.googlecode.com/files/syntaxhighlighter-20111212.js&#39; type=&#39;text/javascript&#39;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/370928618630503249/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/370928618630503249' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/370928618630503249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/370928618630503249'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/linux-kernel-portability-data-type-data_11.html' title='Linux Kernel Portability-Data type &amp; Data Structure in Linux kernel (二)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVbKfUt5LwEsJfRNz01JpswCq3w-sk3PjNPocjGFn4EIbBDgCJRt0ZE5ytDKmPX7jAe15sipxjuoc0ExUZ25-_9LQpGV4W-dMO-GeZJO4JY5vgHMAjPgTwVv9mMpZYd-oCypchip6zoJE/s72-c/double+linked+list+(1).png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-6285724063018498458</id><published>2012-07-10T10:49:00.000+08:00</published><updated>2012-07-17T10:38:50.773+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="driver"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><title type='text'>Linux Kernel Portability-Data type &amp; Data Structure in Linux kernel (一)</title><content type='html'>&lt;ul&gt;
&lt;li&gt;前言&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Linux作為一個跨平台(處理器)的作業系統必須兼容許多不同的CPU 架構設計。也因此，Linux Kernel裡面有許多是為了Portability而產生的包含衍生的資料型態及提供的資料結構。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
為了讓我們的Kernel 的module可以順利在我們的Target上或在各平台上順利執行，我們勢必就需要了解哪些方面會是Platform-Independent，Linux Kernel如何解決這個問題。&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;The Size of Data Types&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
在說明Kernel專有的資料型態前，我們先了解標準C資料型態在各平台的差異。以下圖為例，在常見的平台上，char、short、int、long long大小是一致的。但是long、ptr、word的大小則會因平台不同而有所差別。因此，如何在&lt;b&gt;各平台&lt;/b&gt;確切的得到我們&lt;b&gt;希望的變數大小&lt;/b&gt;就非常重要了。換句話說，假設我們希望某個變數他是8個bits，他就不會因為平台的不同而變成立如4個bits。&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjolD9Co7J21lJyNYx4MSSpZtu7DIBCPWF1q0T1ILodfiYX5863nBkirL22Aig5qBRgXT7d8rxpOErs0WbPcxR0t41mCyBdve1rvu1X-TUpZMvl29kshoNlTKk-n8vnqUKXmY1wq_sM9YY/s1600/Screenshot+from+2012-07-06+14:01:03.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjolD9Co7J21lJyNYx4MSSpZtu7DIBCPWF1q0T1ILodfiYX5863nBkirL22Aig5qBRgXT7d8rxpOErs0WbPcxR0t41mCyBdve1rvu1X-TUpZMvl29kshoNlTKk-n8vnqUKXmY1wq_sM9YY/s400/Screenshot+from+2012-07-06+14:01:03.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
因此，Linux Kernel就定義了幾個標準大小的資料型態在&lt;i&gt;include/linux/types.h&lt;/i&gt;。在&lt;i&gt;include/linux/types.h&lt;/i&gt;裡他include了&lt;i&gt;asm/types.h&lt;/i&gt;。以ARM平台為例，&lt;i&gt;arch/arm/include/asm/types.h&lt;/i&gt; include了&lt;i&gt;asm-generic/int-ll64.h&lt;/i&gt;。在int-ll64.h就定義了:&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;pre class=&quot;brush: c&quot;&gt;u8    unsigned byte (8 bits)
u16   unsigned word (16 bits)
u32   unsigned 32-bit value
u64   unsigned 64-bit value
s8    signed byte (8 bits)
s16   signed word (16 bits)
s32   signed 32-bit value
s64   signed 64-bit value
&lt;/pre&gt;
u代表的是unsigned而s則是代表signed分別定義了8~64bits的標準大小型態。假設在user space的程式要使用固定長度的型別，記得前面要加上__例如&quot;&lt;i&gt;__u8&lt;/i&gt;&quot;。&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;然而&lt;/b&gt;，C99規範了標準大小的資料型態uintN_t及intN_t對應著uN及sN定義在stdint.h。N代表8、16、 32、64。因此，不管是Kernel Module或是user space 的program特別是如果你的程式是想跨平台(OS)的，就盡量使用C99的資料型態而非Linux Kernel的資料型態。&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Interface-Speciﬁc Types&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Linux Kernel為了移植性也定義了許多_t結尾的變數在 &amp;lt;include/types.h&amp;gt;。舉例來說常見的size_t、ssize_t、pid_t、time_t等等&lt;b&gt;根據特定意義的資料型態&lt;/b&gt;就稱為&lt;b&gt;Interface-Specific Type&lt;/b&gt;。以process 的id pid_t為例，在x86來說是 int，但是假設我們直接將例如getpid()的回傳值用 int用 接收，哪天另外一個平台的pid是long long的話勢必我們程式必須作修改才能正確運行。因此，Interface-Specific Type可以避免移植的問題。&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Data Alignment&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
大多數的CPU都會要求變數擺在特定的記憶體上。例如Intel x86的CPU要求4 byte的integer是放置在4的倍數的記憶體位置。這個就叫做Memory Alignment。但假設不是擺在4的倍數上呢？那就必須要讀取兩次才能得到這個變數。大多數的CPU都可以自己處理這個狀況，但是有些CPU沒辦法處理這個問題，必須要產生exception靠exception handler來處理這個問題，但是這樣效率會非常的慢。有個方法是使用&lt;i&gt;get_unaligned(ptr)&lt;/i&gt;取得資料及&lt;i&gt;set_unaligned(val,ptr)&lt;/i&gt;寫入資料。例如，在driver/power/bq27x00_battery.c裡面&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;if (!single)
    ret = get_unaligned_le16(data);
else
    ret = data[0];
&lt;/pre&gt;
如果資料是1個byte就直接讀取否則用get_unaligned_le16()。le代表little-endian&lt;span style=&quot;background-color: white;&quot;&gt;。&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
順帶一提，compiler在做最佳化的時候可能會自動做Memory Aligned的動作。但也許我們定義的資料結構變數間的位址是必須連續的(的動作可能會在變數間填補一些變數讓memory可以對齊)，這個時候我們可以利用__attribute__ ((packed))告訴編譯器不要亂動 。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;struct{
    u16 uid;
    u64 gid;
    u16 val0;
    u32 val1;
}__attribute__ ((packed))structA;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Byte Order&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
假設有一個4 byte的int不同的CPU可能會有不同的記憶體擺法，例如低位的值先放(Little-Endian)還是大的先放(Big-Endian)?舉例來說，假設有一個整數值是0x12345678 Little-Endian的擺法就會是:
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;address        value
0x00000001     0x78
0x00000002     0x56
0x00000003     0x34
0x00000004     0x12
&lt;/pre&gt;
而如果是Big-Endian的話則是:
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;address        value
0x00000001     0x12
0x00000002     0x34
0x00000003     0x56
0x00000004     0x78
&lt;/pre&gt;
如果我們要得到Little-Endian順序的值可以使用u32 cpu_to_le32(u32)，更多的轉換函式可以在&lt;linux big_endian.h=&quot;&quot; byteorder=&quot;&quot;&gt;找到。
&lt;/linux&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Time&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
HZ定義了一秒鐘有幾次 Interrupt。他可以是100、250、300或是1000。預設的值可能會隨著 Kernel的版本或編譯Kernel 的設定而改變。因此，我們不可以假設HZ==1000(舊版的Kernel預設是1000)。&lt;br /&gt;
順帶一提，Tick是HZ的倒數，因此假設HZ=1000則一個tick就是1毫秒。&lt;br /&gt;
Jiffies是Linux Kernel用來紀錄系統自開機以來觸發了幾次Interrupt(開機時並非歸0)。Linux Kernelchewing每秒鐘會將jiffies加1HZ次。我們可以利用Linux  Kernel定義的macro(timer_after、time_after_eq、time_before和time_before_eq)來判斷時間。因此，假設我們要判斷時間是否過了三秒可以:
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//設定時間是現在的jiffies加上3秒的HZ次
unsigned long timeout = jiffies + (3*HZ);  
while (hwgroup-&amp;gt;busy) {  
     ...
  /*如果迴圈超過三秒(也就是說現在的jiffies數超過三秒前的jiffies+3*HZ次)
   *則return -EBUSY
   */
  if (time_after(jiffies, timeout)) {  
    return -EBUSY;  
  }  
  ...  
}  
return SUCCESS; 
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Page Size&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
不要假設Page Size是4KB。用Linux Kernel提供的PAGE_SIZE 來取得系統的page size及PAGE_SHIFT取得 要左移的bits數達到其memory page的number。&lt;/blockquote&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Reference&lt;/span&gt;&lt;/li&gt;
&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CFkQFjAB&amp;amp;url=http%3A%2F%2Fstid.googlecode.com%2Ffiles%2FLinux.Kernel.Development.3rd.Edition.pdf&amp;amp;ei=gkT2T92aIJCfmQWehq2TBQ&amp;amp;usg=AFQjCNF86Glm6tZbi22wNAHXn35rvkZ63A&amp;amp;sig2=fQ58ll8NOnJhQ9lmWW1Z9w&quot; style=&quot;color: #436590; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;Linux Kernel Development Third Edition&amp;nbsp;&lt;/a&gt;&lt;br style=&quot;color: #666666; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;a href=&quot;http://lwn.net/Kernel/LDD3/&quot; style=&quot;color: #436590; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;Linux Device Drivers, Third Edition&lt;/a&gt;&lt;span style=&quot;color: #666666; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: #666666; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CFgQFjAB&amp;amp;url=http%3A%2F%2Fwusewj-linux-books.googlecode.com%2Ffiles%2FEssential%2520Linux%2520Device%2520Drivers%255B2008%2C851p%255D.pdf&amp;amp;ei=XEX2T6P2JLHUmAXdxrWRCw&amp;amp;usg=AFQjCNGW_o5jLL6mYCVhHWnC0XZxujGQwg&amp;amp;sig2=2-NErYlRps-yMrcAAFsL3A&quot; style=&quot;color: #436590; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;Essential Linux Device Drivers&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.linuxjournal.com/article/5783?page=0,0&quot; style=&quot;background-color: white; color: #436590; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;Writing Portable Device Driver&lt;/a&gt;&lt;/ul&gt;
&lt;a href=&quot;http://clhjoe.blogspot.tw/2012/07/linux-kernel-portability-data-type-data_11.html&quot;&gt;下一篇:Linux Kernel Portability-Data type &amp;amp; Data Structure in Linux kernel (二)&lt;/a&gt;

&lt;script src=&#39;http://syntaxhighlight-blogger-dynamic.googlecode.com/files/syntaxhighlighter-20111212.js&#39; type=&#39;text/javascript&#39;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/6285724063018498458/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/6285724063018498458' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6285724063018498458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/6285724063018498458'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/linux-kernel-portability-data-type-data.html' title='Linux Kernel Portability-Data type &amp; Data Structure in Linux kernel (一)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjolD9Co7J21lJyNYx4MSSpZtu7DIBCPWF1q0T1ILodfiYX5863nBkirL22Aig5qBRgXT7d8rxpOErs0WbPcxR0t41mCyBdve1rvu1X-TUpZMvl29kshoNlTKk-n8vnqUKXmY1wq_sM9YY/s72-c/Screenshot+from+2012-07-06+14:01:03.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-7198664906658663585</id><published>2012-07-05T16:35:00.003+08:00</published><updated>2012-07-17T10:43:56.909+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="driver"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><title type='text'>Linux Interrupt 整理 （一）</title><content type='html'>&lt;ul&gt;
&lt;li&gt;前言&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
CPU的速度很快，假設每每都必須等待週邊的硬體動作完成CPU才能繼續工作的話，效率未免太低了。因此，我們的系統設計了中斷(Interrupt)，當有 event 發生(例如 工作完成)就觸發一個Interrupt告訴CPU，這時候CPU就會&quot;馬上&quot;去處理。這麼一來就可以避免等待時間的浪費。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
我們可以針對裝置的Interrupt建立Handler，讓不同的Device Interrupt發生後去執行相對應的&quot;程序&quot; ，這個程序就稱為 &lt;b&gt;I&lt;/b&gt;nterrupt &lt;b&gt;S&lt;/b&gt;ervice &lt;b&gt;R&lt;/b&gt;outine(ISR)。如果沒有相對應的ISR則僅會回覆ACK而不作任何事。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
傳統電腦是利用兩個&lt;b&gt;P&lt;/b&gt;rogrammable &lt;b&gt;I&lt;/b&gt;nterrupt &lt;b&gt;C&lt;/b&gt;ontroller&amp;nbsp;(PIC)提供15組Interrupt Line連接Device和CPU。Device 觸發中斷請求(Interrupt Request)給PIC然後在傳至CPU，也因為數量有限所以很寶貴。現代的設計是使用&lt;b&gt;A&lt;/b&gt;dvanced &lt;b&gt;P&lt;/b&gt;rogrammable &lt;b&gt;I&lt;/b&gt;nterrupt &lt;b&gt;C&lt;/b&gt;ontroller(APIC)&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
在Linux Kernel 中存在一個資料結構叫&lt;span style=&quot;background-color: white;&quot;&gt;&lt;i&gt;irq_desc &lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;實作在kernel/irq用來鍊結IRQ及ISR，另外也建立Radix treer叫&lt;i&gt;irq_desc_tree&lt;/i&gt;來存放irq_desc結構的變數。&lt;/span&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;建立IRQ&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
要使用IRQ必須要向核心註冊。註冊的方式則是利用&lt;i&gt;request_irq&lt;/i&gt;長相如下:
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//include/linux/interrupt.h
/**
 *第一個參數是IRQ的號碼
 *第二個參數是ISR的pointer
 *第三個參數
 *    IRQF_SHARED         Interrupt is shared
 *    IRQF_SAMPLE_RANDOM  代表這個interrupt可以作為系統random的依據(有固定週期的interrupt
 *                        不適合當成random依據)
 *    IRQF_TRIGGER_*      Specify active edge(s) or level
 *第四個參數是顯示在例如/proc/interrupts的名稱
 *第五個參數用途可以參考http://www.cnblogs.com/ITmelody/archive/2012/05/12/2497018.html
 *一般直接填NULL
*/
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
     const char *name, void *dev)
{
    //request_threaded_irq第三個參數是irq_handler_t thread_fn
    return request_threaded_irq(irq, handler, NULL, flags, name, dev);
}
&lt;/pre&gt;
從這裡我們也可以發現其實&lt;i&gt;request_irq()&lt;/i&gt;會直接call &lt;i&gt;request_threaded_irq()&lt;/i&gt;。因此我們也會看到有人就直接使用&lt;i&gt;request_threaded_irq()&lt;/i&gt;。直接舉nVidia的mmc的例子。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//driver/mmc/host/sdhci-tegra.c
static irqreturn_t carddetect_irq(int irq, void *data)
{
 ...
}

static int __devinit sdhci_tegra_probe(struct platform_device *pdev)
{
    struct sdhci_host *host;
    ...
    rc = request_threaded_irq(gpio_to_irq(plat-&amp;gt;cd_gpio), NULL,
     carddetect_irq,
     IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
     mmc_hostname(host-&amp;gt;mmc), host);
    ...
}
&lt;/pre&gt;
上述的例子是利用GPIO的變化來當成Interrupt的條件。IRQ number是利用gpio_to_irq取得對應的IRQ;ISR是&lt;i&gt;carddetect_irq（）&lt;/i&gt;，觸發的條件是當此GPIO rising/falling都會觸發Interrupt。
&lt;br /&gt;
&lt;br /&gt;
當我們remove module的時候，我們可能需要free掉這個IRQ，這個時候就可以呼叫&lt;i&gt;free_irq&lt;/i&gt;來達成。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;static int __devexit sdhci_tegra_remove(struct platform_device *pdev)
{
    ...
    if (gpio_is_valid(plat-&amp;gt;cd_gpio)) {
        free_irq(gpio_to_irq(plat-&amp;gt;cd_gpio), host);
        ...
    }
    ...
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;ISR Top and Bottom Halves&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Interrupt設計的目的就是不希望卡在攏長的處理。因此，收到中斷後，我們也會希望可以快速處理完要作的事情。然而，常常我們需要作的事情就是這麼多無法快速的做完造成系統的遲鈍。因此，Linux Kernel提出了將ISR拆成top half 跟bottom half。當Interrupt發生後一定要馬上作的事情就屬於Top half直接寫在原本的ISR，而可以晚點做的就屬於Bottom half。我們可以利用&lt;b&gt;SoftIRQ&lt;/b&gt;、&lt;b&gt;Tasklet&lt;/b&gt;或&lt;b&gt;Workqueu&lt;/b&gt;來排程bottom half的部份。下表比較了三種的差異。&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeeLWGlKQcQCcP_UjJLg1SI5uTHynJz0GigLk7e3ifzituVQDsjMANfDFZwbJhWSs3cKMnMvHkpCl6hra4oYnTF9RxTBxhSL3kY7prZ7o3PpCshvmmSHnnAVXZIL3wpTfFbdBkwiC8d8I/s1600/Screenshot+from+2012-07-05+16:05:15.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeeLWGlKQcQCcP_UjJLg1SI5uTHynJz0GigLk7e3ifzituVQDsjMANfDFZwbJhWSs3cKMnMvHkpCl6hra4oYnTF9RxTBxhSL3kY7prZ7o3PpCshvmmSHnnAVXZIL3wpTfFbdBkwiC8d8I/s400/Screenshot+from+2012-07-05+16:05:15.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
下面我們分別介紹Tasklet及Workqueue。&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;&lt;b&gt;Tasklet&lt;/b&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Tasklets 與Linux Kernel的timer類似，他們都在Interrupt time（Atomic time）執行而且會執行在schedule他的CPU上。不同於timer，我們無法要求tasklet的task在我們期望的時間執行 。同樣的，我們使用nVidia的mmc driver為例來說明Tasklet。&lt;br /&gt;
首先，我們必須先註冊一個tasklet，指定這個tasklet的名字、func及data。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//mmc/host/sdhci.c
static void sdhci_tasklet_card(unsigned long param)
{
   ...
}

int sdhci_add_host(struct sdhci_host *host){
   ...
/*
 * Init tasklet.
 *void tasklet_init(struct tasklet_struct *t,
 *                  void (*func)(unsigned long), unsigned long data)
 *簡單來說就是tasklet_init(name, func,data)
*/
    tasklet_init(&amp;amp;host-&amp;gt;card_tasklet,
                 sdhci_tasklet_card, (unsigned long)host);
 
   ...
}
&lt;/pre&gt;
&lt;br /&gt;
接著，這個task必須要在呼叫schedule_tasklet之後才會被排程執行。理所當然，我們會在top half執行完之後去啟動bottom half的部份。因此我們回到top half(carddetect_irq())看看我們如何去啟動bottom half。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//driver/mmc/host/sdhci-tegra.c
static irqreturn_t carddetect_irq(int irq, void *data)
{
    ...
    tasklet_schedule(&amp;amp;sdhost-&amp;gt;card_tasklet);
    
    return IRQ_HANDLED;
};
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Workqueue
&lt;/b&gt;&lt;br /&gt;
Workqueue的部份則利用omap的mmc driver來舉例。如同tasklet，我們必須利用INIT_WORK(name,func)先註冊一個workqueue。以下面的範例，利用schedule_work()將這個workqueue交給一個叫&quot;&lt;b&gt;event&lt;/b&gt;&quot;的公用&lt;b&gt;work thread&lt;/b&gt;來執行。
&lt;br /&gt;
首先我們來看註冊 workqueue的部份。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//driver/mmc/omap_hsmmc.c
static void omap_hsmmc_detect(struct work_struct *work)
{
   ...
}

static int __init omap_hsmmc_probe(struct platform_device *pdev)
{
   ...
   INIT_WORK(&amp;amp;host-&amp;gt;mmc_carddetect_work, omap_hsmmc_detect);
   ...
}
&lt;/pre&gt;
而去啟動他的部份則是在top half的omap_hsmmc_cd_handler（）則是...&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//driver/mmc/omap_hsmmc.c

static irqreturn_t omap_hsmmc_cd_handler(int irq, void *dev_id)
{
 struct omap_hsmmc_host *host = (struct omap_hsmmc_host *)dev_id;

 if (host-&amp;gt;suspended)
  return IRQ_HANDLED;
 //啟動Workqueue 
 schedule_work(&amp;amp;host-&amp;gt;mmc_carddetect_work);

 return IRQ_HANDLED;
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Reference&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CFkQFjAB&amp;amp;url=http%3A%2F%2Fstid.googlecode.com%2Ffiles%2FLinux.Kernel.Development.3rd.Edition.pdf&amp;amp;ei=gkT2T92aIJCfmQWehq2TBQ&amp;amp;usg=AFQjCNF86Glm6tZbi22wNAHXn35rvkZ63A&amp;amp;sig2=fQ58ll8NOnJhQ9lmWW1Z9w&quot;&gt;Linux Kernel Development Third Edition&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://lwn.net/Kernel/LDD3/&quot;&gt;Linux Device Drivers, Third Edition&lt;/a&gt;
&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Intel_APIC_Architecture&quot;&gt;Intel APIC Architecture&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Interrupt_request&quot;&gt;Interrupt_request&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CFgQFjAB&amp;amp;url=http%3A%2F%2Fwusewj-linux-books.googlecode.com%2Ffiles%2FEssential%2520Linux%2520Device%2520Drivers%255B2008%2C851p%255D.pdf&amp;amp;ei=XEX2T6P2JLHUmAXdxrWRCw&amp;amp;usg=AFQjCNGW_o5jLL6mYCVhHWnC0XZxujGQwg&amp;amp;sig2=2-NErYlRps-yMrcAAFsL3A&quot;&gt;Essential Linux Device Drivers&lt;/a&gt;&lt;/blockquote&gt;
&lt;script src=&#39;http://syntaxhighlight-blogger-dynamic.googlecode.com/files/syntaxhighlighter-20111212.js&#39; type=&#39;text/javascript&#39;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/7198664906658663585/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/7198664906658663585' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/7198664906658663585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/7198664906658663585'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/linux-interrupt.html' title='Linux Interrupt 整理 （一）'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeeLWGlKQcQCcP_UjJLg1SI5uTHynJz0GigLk7e3ifzituVQDsjMANfDFZwbJhWSs3cKMnMvHkpCl6hra4oYnTF9RxTBxhSL3kY7prZ7o3PpCshvmmSHnnAVXZIL3wpTfFbdBkwiC8d8I/s72-c/Screenshot+from+2012-07-05+16:05:15.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3151182563722312857.post-8375497423638681058</id><published>2012-07-04T15:00:00.002+08:00</published><updated>2012-07-17T10:31:50.150+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="c"/><category scheme="http://www.blogger.com/atom/ns#" term="driver"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><title type='text'>GPIO整理-GPIOLIB (二)</title><content type='html'>&lt;a href=&quot;http://clhjoe.blogspot.tw/2012/07/gpio.html&quot;&gt;上一篇&lt;/a&gt;介紹了GPIO的基礎，在這篇將詳細介紹 GPIOLIB&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;前言&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
在以前，假設我們chip上面都有提供GPIO。假設我們今天要 call soc上面的GPIO我們可以使用gpio_direction_output()。但是如果要使用audio chip上面的GPIO以下圖為&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;例&lt;/span&gt;&lt;/b&gt;，我們可能就得呼叫&lt;i&gt;audio_gpio_direction_output&lt;/i&gt;() depends on chip 的driver實作。&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpjKZzEdONIQa8x7dbX8LNJyVbmeHowe8lPR0Za-IgEdbMxLb_icyKdleSKixQka1CB1lxPeNP245l1b6E_r_xt9X62VBRcWcej8rtUl7H-Uijta2T2wDG6eSyBYPRxkkc6EYhynBoqmA/s1600/soc_gpio.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpjKZzEdONIQa8x7dbX8LNJyVbmeHowe8lPR0Za-IgEdbMxLb_icyKdleSKixQka1CB1lxPeNP245l1b6E_r_xt9X62VBRcWcej8rtUl7H-Uijta2T2wDG6eSyBYPRxkkc6EYhynBoqmA/s400/soc_gpio.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
為什麼呢？因為每個chip如何去控制他們的GPIO作法可能會不一樣，並且要填的memory位址也不一樣。這麼一來會造成什麼現象呢？如果chip一多，要分別控制上面的GPIO 我們&lt;b&gt;可能&lt;/b&gt;就會看到一堆&amp;nbsp;&lt;i&gt;audio_gpio_direction_output&lt;/i&gt;、&amp;nbsp;&lt;i&gt;pmu&lt;/i&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;i&gt;_gpio_direction_output&lt;/i&gt;、&amp;nbsp;&lt;i&gt;charger&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;i&gt;_gpio_direction_output&lt;/i&gt;。而且，以gpio_direction_output為例，可能每一個driver的實作都會有一些重複的code例如檢查是否valid等等。&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
因此，GPIOLIB的引入可以解決這個問題。每一個chip都使用&lt;b&gt;gpio_chip&lt;/b&gt;結構來表示，每一個chip driver實作可以定義GPIO的個數、號碼及相關的callback function。&amp;nbsp;&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimqWi4_rNYphhBQwgsBdXTmMvlM6oydtB4fxvyPwhkD9aT6Bqc42V4swwWIozhfnP01KnbfqoIjGh49lYhwW4FwpZDC9o_PLopzcFACph7v8zBrNJDVpm5TOTLDNerguupxjzHu1XMM38/s1600/soc_gpio+(1).jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimqWi4_rNYphhBQwgsBdXTmMvlM6oydtB4fxvyPwhkD9aT6Bqc42V4swwWIozhfnP01KnbfqoIjGh49lYhwW4FwpZDC9o_PLopzcFACph7v8zBrNJDVpm5TOTLDNerguupxjzHu1XMM38/s400/soc_gpio+(1).jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
以gpio_direction_output為例。當我們呼叫&lt;i&gt;gpio_direction_output(number)&lt;/i&gt;之後，gpio_direction_output實做在GPIOLIB中，它會去檢查這個number的GPIO是屬於哪個chip然後去call 該chip的driver的request實作。&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;GPIOLIB分析&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;註冊gpio_chip&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
我們從&lt;a href=&quot;http://nv-tegra.nvidia.com/gitweb/&quot;&gt;nVidia&lt;/a&gt;的git抓下來的kernel裡面隨便找driver/gpio/wm8994-gpio.c為例子trace一下。他的probe如下:
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;static struct gpio_chip template_chip = {
 .label   = &quot;wm8994&quot;,
 .owner   = THIS_MODULE,
/**
 *如果執行gpio_direction_input的GPIO number屬於這個chip
 *則執行wm8994_gpio_direction_in這個callback function
 *以下同義
*/
 .direction_input = wm8994_gpio_direction_in,
 .get   = wm8994_gpio_get,
 .direction_output = wm8994_gpio_direction_out,
 .set   = wm8994_gpio_set,
 .dbg_show  = wm8994_gpio_dbg_show,
 .can_sleep  = 1,
};

static int __devinit wm8994_gpio_probe(struct platform_device *pdev)
{
    struct wm8994 *wm8994 = dev_get_drvdata(pdev-&amp;gt;dev.parent);
    //取得platform_device定義的platform_data
    struct wm8994_pdata *pdata = wm8994-&amp;gt;dev-&amp;gt;platform_data;
    struct wm8994_gpio *wm8994_gpio;
    int ret;
    wm8994_gpio = kzalloc(sizeof(*wm8994_gpio), GFP_KERNEL);
    if (wm8994_gpio == NULL)
 return -ENOMEM;
    
    wm8994_gpio-&amp;gt;wm8994 = wm8994;
    /**
     *我們剛剛有說每一個chip使用gpio_chip結構表示。
     *上面宣告了template_chip的gpio_chip結構。
    */
    wm8994_gpio-&amp;gt;gpio_chip = template_chip;
    wm8994_gpio-&amp;gt;gpio_chip.ngpio = WM8994_GPIO_MAX;
    wm8994_gpio-&amp;gt;gpio_chip.dev = &amp;amp;pdev-&amp;gt;dev;

    //取得gpio_base。意思是這個chip的GPIO number從多少開始編號 
    if (pdata &amp;amp;&amp;amp; pdata-&amp;gt;gpio_base)
 wm8994_gpio-&amp;gt;gpio_chip.base = pdata-&amp;gt;gpio_base;
    else
 wm8994_gpio-&amp;gt;gpio_chip.base = -1;
    
    //將這個gpio_chip 註冊進去。待會將分析gpiochip_add
    ret = gpiochip_add(&amp;amp;wm8994_gpio-&amp;gt;gpio_chip);
    if (ret &amp;lt; 0) {
 dev_err(&amp;amp;pdev-&amp;gt;dev, &quot;Could not register gpiochip, %d\n&quot;,
         ret);
 goto err;
    }

    platform_set_drvdata(pdev, wm8994_gpio);
    return ret;

err:
 kfree(wm8994_gpio);
 return ret;
}
&lt;/pre&gt;
接著我們看一下gpiochip_add() 做了什麼事。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;//擷取gpio_desc的定義。gpio_desc定義了GPIO是屬於哪個chip，他的flag及label。
struct gpio_desc {
 struct gpio_chip *chip;
 unsigned long  flags;
#ifdef CONFIG_DEBUG_FS
 const char  *label;
#endif
};
//gpio_desc陣列存放著所有gpio的定義
static struct gpio_desc gpio_desc[ARCH_NR_GPIOS];
int gpiochip_add(struct gpio_chip *chip)
{
 unsigned long flags;
 int  status = 0;
 unsigned id;
 int  base = chip-&amp;gt;base;

 if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip-&amp;gt;ngpio - 1))
   &amp;amp;&amp;amp; base &amp;gt;= 0) {
  status = -EINVAL;
  goto fail;
 }

 spin_lock_irqsave(&amp;amp;gpio_lock, flags);

 if (base &amp;lt; 0) {
  base = gpiochip_find_base(chip-&amp;gt;ngpio);
  if (base &amp;lt; 0) {
   status = base;
   goto unlock;
  }
  chip-&amp;gt;base = base;
 }

 /**
          *these GPIO numbers must not be managed by another gpio_chip 
          *換句話說就是沒有重複到其他gpio_chip定義的號碼
        */
 for (id = base; id &amp;lt; base + chip-&amp;gt;ngpio; id++) {
  if (gpio_desc[id].chip != NULL) {
   status = -EBUSY;
   break;
  }
 }
 if (status == 0) {
     for (id = base; id &amp;lt; base + chip-&amp;gt;ngpio; id++) {
         //將這個chip上的所有GPIO的定義加入gpio_desc
                gpio_desc[id].chip = chip;

  /* REVISIT:  most hardware initializes GPIOs as
   * inputs (often with pullups enabled) so power
   * usage is minimized.  Linux code should set the
   * gpio direction first thing; but until it does,
   * we may expose the wrong direction in sysfs.
   */
  gpio_desc[id].flags = !chip-&amp;gt;direction_input
   ? (1 &amp;lt;&amp;lt; FLAG_IS_OUT)
   : 0;
     }
 }

 of_gpiochip_add(chip);

unlock:
 spin_unlock_irqrestore(&amp;amp;gpio_lock, flags);

 if (status)
  goto fail;

 status = gpiochip_export(chip);
 if (status)
  goto fail;

 return 0;
fail:
 /* failures here can mean systems won&#39;t boot... */
 pr_err(&quot;gpiochip_add: gpios %d..%d (%s) failed to register\n&quot;,
  chip-&amp;gt;base, chip-&amp;gt;base + chip-&amp;gt;ngpio - 1,
  chip-&amp;gt;label ? : &quot;generic&quot;);
 return status;
}
EXPORT_SYMBOL_GPL(gpiochip_add);
&lt;/pre&gt;
到這裡，我們的kernel已經多了wm8994這個chip的GPIO可以使用了。但是從我們呼叫gpio_direction_input是怎麼跑到driver定義的wm8994_gpio_direction_in呢？&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;GPIOLIB與CHIP DRIVER結合&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
我們看一下gpio_direction_input() 的code。
&lt;br /&gt;
&lt;pre class=&quot;brush: c&quot;&gt;int gpio_direction_input(unsigned gpio)
{
 unsigned long  flags;
 struct gpio_chip *chip;
 struct gpio_desc *desc = &amp;amp;gpio_desc[gpio];
 int   status = -EINVAL;

 spin_lock_irqsave(&amp;amp;gpio_lock, flags);
        //先檢查這個gpio是否valid
 if (!gpio_is_valid(gpio))
  goto fail;
        //找到這個gpio屬於哪個chip的
 chip = desc-&amp;gt;chip;
        //如果chip不存在或這個gpio不能設為input則return fail
 if (!chip || !chip-&amp;gt;get || !chip-&amp;gt;direction_input)
  goto fail;
        
        //下面兩行檢查該GPIO的編號是否在該chip的範圍內
 gpio -= chip-&amp;gt;base;
 if (gpio &amp;gt;= chip-&amp;gt;ngpio)
  goto fail;
 status = gpio_ensure_requested(desc, gpio);
 if (status &amp;lt; 0)
  goto fail;

 /* now we know the gpio is valid and chip won&#39;t vanish */

 spin_unlock_irqrestore(&amp;amp;gpio_lock, flags);

 might_sleep_if(chip-&amp;gt;can_sleep);

 if (status) {
                //呼叫chip定義的request檢查是否可用
  status = chip-&amp;gt;request(chip, gpio);
  if (status &amp;lt; 0) {
   pr_debug(&quot;GPIO-%d: chip request fail, %d\n&quot;,
    chip-&amp;gt;base + gpio, status);
   /* and it&#39;s not available to anyone else ...
    * gpio_request() is the fully clean solution.
    */
   goto lose;
  }
 }
        //如果是可用的，call chip的direction_input（）
 status = chip-&amp;gt;direction_input(chip, gpio);
 if (status == 0)
  clear_bit(FLAG_IS_OUT, &amp;amp;desc-&amp;gt;flags);

 trace_gpio_direction(chip-&amp;gt;base + gpio, 1, status);
lose:
 return status;
fail:
 spin_unlock_irqrestore(&amp;amp;gpio_lock, flags);
 if (status)
  pr_debug(&quot;%s: gpio-%d status %d\n&quot;,
   __func__, gpio, status);
 return status;
}
EXPORT_SYMBOL_GPL(gpio_direction_input);
&lt;/pre&gt;
至此，應該就都串起來了吧！簡單來說就如下圖:&lt;/blockquote&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdFhhtCt6hTWEhYZoCQskrmX2iuUGNUkt9I0HqbbgY7gyFiGMSROVpJk6quOj_-LBZnNPOMZkUpXroi_cR9YQYnzF22cdjcfUrmE0e0zF-QA8yOmel0adef4xNgWUIqv8HHkfmxEFMoQc/s1600/gpiolib+relation.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;403&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdFhhtCt6hTWEhYZoCQskrmX2iuUGNUkt9I0HqbbgY7gyFiGMSROVpJk6quOj_-LBZnNPOMZkUpXroi_cR9YQYnzF22cdjcfUrmE0e0zF-QA8yOmel0adef4xNgWUIqv8HHkfmxEFMoQc/s640/gpiolib+relation.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;a href=&quot;http://www.kernel.org/doc/Documentation/gpio.txt&quot; style=&quot;background-color: white; color: #436590; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;http://www.kernel.org/doc/Documentation/gpio.txt&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;a href=&quot;http://nv-tegra.nvidia.com/gitweb/&quot; style=&quot;background-color: white; color: #436590; font-family: &#39;Trebuchet MS&#39;, Trebuchet, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;http://nv-tegra.nvidia.com/gitweb/&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;driver/gpio/gpiolib.c&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;i&gt;driver/gpio/gpio-wm8994.c&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;/blockquote&gt;
&lt;script src=&#39;http://syntaxhighlight-blogger-dynamic.googlecode.com/files/syntaxhighlighter-20111212.js&#39; type=&#39;text/javascript&#39;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://clhjoe.blogspot.com/feeds/8375497423638681058/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3151182563722312857/8375497423638681058' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/8375497423638681058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3151182563722312857/posts/default/8375497423638681058'/><link rel='alternate' type='text/html' href='http://clhjoe.blogspot.com/2012/07/gpio-gpiolib.html' title='GPIO整理-GPIOLIB (二)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06215848317521193042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpjKZzEdONIQa8x7dbX8LNJyVbmeHowe8lPR0Za-IgEdbMxLb_icyKdleSKixQka1CB1lxPeNP245l1b6E_r_xt9X62VBRcWcej8rtUl7H-Uijta2T2wDG6eSyBYPRxkkc6EYhynBoqmA/s72-c/soc_gpio.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>