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

<channel>
	<title>SDpower</title>
	<atom:link href="http://blog.sd.idv.tw/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.sd.idv.tw</link>
	<description>史迪 MY~ALL</description>
	<lastBuildDate>Thu, 05 Jan 2012 08:40:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>FuelPHP FrameWork 進入！ Enter~~</title>
		<link>http://blog.sd.idv.tw/archives/529</link>
		<comments>http://blog.sd.idv.tw/archives/529#comments</comments>
		<pubDate>Thu, 05 Jan 2012 08:40:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP & MYSQL]]></category>
		<category><![CDATA[FuelPHP FrameWork]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=529</guid>
		<description><![CDATA[安裝之前有說過哩:請參考 FuelPHP FrameWork 初體驗～～ 之前說過 作者將APP 整個包在FrameWork 內的蠢話. 我可以不承認嗎XDD 其實算是給開發人員快速進入,實作體驗FrameWork用的. 如果要自行快速分離請先參考 同事強做:【程式筆記】建立一個FuelPHP的應用程式Git Repository 如果這樣不能滿足你,接下來江示範如何調整. 以下範例: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 [...]]]></description>
			<content:encoded><![CDATA[<p>安裝之前有說過哩:請參考 <a href="http://blog.sd.idv.tw/archives/520" target="_blank">FuelPHP FrameWork 初體驗～～</a><br />
之前說過 <del><strong>作者將APP 整個包在FrameWork</strong></del> 內的蠢話.<del> 我可以不承認嗎XDD</del><br />
其實算是給開發人員快速進入,實作體驗FrameWork用的.<br />
如果要自行快速分離請先參考 同事強做:<a href="http://blog.ycnets.com/2012/01/fuelphpgit-repository.html" target="_blank">【程式筆記】建立一個FuelPHP的應用程式Git Repository</a> </p>
<p>如果這樣不能滿足你,接下來江示範如何調整.<br />
<span id="more-529"></span><br />
以下範例:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#建立專案 FuelPower</span>
$ oil create FuelPower
Cloning into .<span style="color: #000000; font-weight: bold;">/</span>FuelPower...
remote: Counting objects: <span style="color: #000000;">14163</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4889</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4889</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">14163</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9659</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">13347</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9042</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">14163</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">14163</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">2.09</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">281</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">9659</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">9659</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule <span style="color: #ff0000;">'docs'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>docs.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'docs'</span>
Submodule <span style="color: #ff0000;">'fuel/core'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>core.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/core'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/auth'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>auth.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/auth'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/email'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>email.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/email'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/oil'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>oil.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/oil'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/orm'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>orm.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/orm'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/parser'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>parser.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/parser'</span>
Cloning into docs...
remote: Counting objects: <span style="color: #000000;">5552</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1903</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1903</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">5552</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">3710</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">5350</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">3546</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">5552</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5552</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">1.73</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">281</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3710</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3710</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'docs'</span>: checked out <span style="color: #ff0000;">'f3746d4fcda2dc12d7f1120d55c17f3b52c0550e'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>core...
remote: Counting objects: <span style="color: #000000;">20958</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">6266</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">6266</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">20958</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">14615</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">20579</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">14278</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">20958</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20958</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">3.25</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">283</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">14615</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">14615</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/core'</span>: checked out <span style="color: #ff0000;">'d95fbfec3fe2f791fead4eeb9a37fcd631009479'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>auth...
remote: Counting objects: <span style="color: #000000;">541</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">384</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">384</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">541</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">240</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">453</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">157</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">541</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">541</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">67.77</span> KiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">76</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">240</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">240</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/auth'</span>: checked out <span style="color: #ff0000;">'7a2c479263f768b6de8bffe43b1bd00fd2bbdd6d'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>email...
remote: Counting objects: <span style="color: #000000;">273</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">157</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">157</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">273</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">114</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">268</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">109</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">273</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">273</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">42.33</span> KiB, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">114</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">114</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/email'</span>: checked out <span style="color: #ff0000;">'0113f3c6596e5b3b97408607ddc033e3a7dc833a'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>oil...
remote: Counting objects: <span style="color: #000000;">896</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">393</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">393</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">896</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">510</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">849</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">471</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">896</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">896</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">117.05</span> KiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">134</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">510</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">510</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/oil'</span>: checked out <span style="color: #ff0000;">'da74ddc023871ef54a93fdcc541cbf2db95b73f3'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>orm...
remote: Counting objects: <span style="color: #000000;">14408</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4310</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4310</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">14408</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9975</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">14305</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9877</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">14408</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">14408</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">2.07</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">274</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">9975</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">9975</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/orm'</span>: checked out <span style="color: #ff0000;">'ad18b80efcc712e02143a14d6e0902aab25da475'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>parser...
remote: Counting objects: <span style="color: #000000;">603</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">303</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">303</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">603</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">285</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">571</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">254</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">603</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">603</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">113.31</span> KiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">137</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">285</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">285</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/parser'</span>: checked out <span style="color: #ff0000;">'836c1ad77e631d47839630f3fa79b9dddc0b8091'</span>
	Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>FuelPower<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>cache
	Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>FuelPower<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>logs
	Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>FuelPower<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>tmp
	Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>FuelPower<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>config
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>FuelPower
<span style="color: #666666; font-style: italic;">#移除git 資料</span>
$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> .git<span style="color: #000000; font-weight: bold;">*</span>
$ <span style="color: #c20cb9; font-weight: bold;">git</span> init
<span style="color: #666666; font-style: italic;">#接著要取捨submodule的部份，將需要的加進去</span>
<span style="color: #666666; font-style: italic;">#不需要的部份請依路徑刪除，如orm、auth</span>
$ <span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>core.git fuel<span style="color: #000000; font-weight: bold;">/</span>core
$ <span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>oil.git fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>oil
$ <span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>parser.git fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>parser
$ <span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>email.git fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>email
$ <span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>orm.git fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>orm
$ <span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>auth.git fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>auth
&nbsp;
<span style="color: #666666; font-style: italic;">#全部submodule一起切換版本的大絕，目前是1.1版</span>
$ <span style="color: #c20cb9; font-weight: bold;">git</span> submodule foreach <span style="color: #c20cb9; font-weight: bold;">git</span> checkout origin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.1</span><span style="color: #000000; font-weight: bold;">/</span>master
$ 
&nbsp;
&nbsp;
設定.gitignore
<span style="color: #000000; font-weight: bold;">&lt;</span>pre <span style="color: #007800;">lang</span>=<span style="color: #ff0000;">&quot;bash&quot;</span> <span style="color: #007800;">line</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">*</span>~
<span style="color: #000000; font-weight: bold;">*</span>.bak
<span style="color: #000000; font-weight: bold;">*</span>.log
Thumbs.db
desktop.ini
.DS_Store
.buildpath
.project
.settings
.tmpoj
logs<span style="color: #000000; font-weight: bold;">/*</span>
cache<span style="color: #000000; font-weight: bold;">/*</span>
tmp<span style="color: #000000; font-weight: bold;">/*</span>
build
nbproject<span style="color: #000000; font-weight: bold;">/</span>
.idea
app<span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>crypt.php</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> fuel
$ <span style="color: #c20cb9; font-weight: bold;">mv</span> app ..<span style="color: #000000; font-weight: bold;">/</span></pre></td></tr></table></div>

<p>編輯public/index.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPPATH'</span><span style="color: #339933;">,</span> <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span>__DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">'/../fuel/app/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//改為</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPPATH'</span><span style="color: #339933;">,</span> <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span>__DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">'/../app/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> app
$ <span style="color: #c20cb9; font-weight: bold;">mv</span> cache ..<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">mv</span> tmp ..<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">mv</span> log ..<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">git</span> add .
$ <span style="color: #c20cb9; font-weight: bold;">git</span> commint <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'init project'</span></pre></td></tr></table></div>

<p>完成後看起來是這樣.<br />
<a href="http://blog.sd.idv.tw/wp-content/uploads/2012/01/螢幕快照-2012-01-05-下午4.37.46.png"><img src="http://blog.sd.idv.tw/wp-content/uploads/2012/01/螢幕快照-2012-01-05-下午4.37.46-173x300.png" alt="" title="螢幕快照 2012-01-05 下午4.37.46" width="173" height="300" class="alignnone size-medium wp-image-540" /></a><br />
剩下 build.xml 還不會調整.<br />
<del>剛進去不要太急</dev></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/529/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FuelPHP FrameWork 初體驗～～</title>
		<link>http://blog.sd.idv.tw/archives/520</link>
		<comments>http://blog.sd.idv.tw/archives/520#comments</comments>
		<pubDate>Tue, 27 Dec 2011 08:29:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP & MYSQL]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=520</guid>
		<description><![CDATA[FuelPHP is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start. FuelPHP 衝著他以php 5.3 並以namespace 方式開發,輕量化FrameWork趕快來試用看看吧. 安裝 安裝方式不免俗來了,快速按裝.(不錯唷) 1 2 3 4 5 6 7 $ curl get.fuelphp.com/oil &#124; sh % Total % Received % Xferd Average Speed Time Time Time Current Dload [...]]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://fuelphp.com/">FuelPHP</a> is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start.</strong><br />
FuelPHP 衝著他以php 5.3 並以namespace 方式開發,輕量化FrameWork趕快來試用看看吧.</p>
<h2>安裝</h2>
<p>安裝方式不免俗來了,快速按裝.(不錯唷)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ curl get.fuelphp.com<span style="color: #000000; font-weight: bold;">/</span>oil <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sh</span>
  <span style="color: #000000; font-weight: bold;">%</span> Total    <span style="color: #000000; font-weight: bold;">%</span> Received <span style="color: #000000; font-weight: bold;">%</span> Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
<span style="color: #000000;">100</span>   <span style="color: #000000;">244</span>  <span style="color: #000000;">100</span>   <span style="color: #000000;">244</span>    <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>    <span style="color: #000000;">240</span>      <span style="color: #000000;">0</span>  <span style="color: #000000;">0</span>:00:01  <span style="color: #000000;">0</span>:00:01 --:--:--  <span style="color: #000000;">1257</span>
Password:
&nbsp;
$</pre></td></tr></table></div>

<p><span id="more-520"></span><br />
咦捨摸錯誤都沒有噴就是裝好了.<br />
找了一下他裝了啥鬼</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>oil
<span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;./oil&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        php oil <span style="color: #ff0000;">&quot;$@&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> == <span style="color: #ff0000;">&quot;create&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
&nbsp;
                    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">which</span> <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                         <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;For this installer to work you'll need to install Git.&quot;</span>
                     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'        http://git-scm.com/'</span>
                    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
                <span style="color: #c20cb9; font-weight: bold;">git</span> clone <span style="color: #660033;">--recursive</span> <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>fuel.git <span style="color: #ff0000;">&quot;./$2&quot;</span>
                php <span style="color: #ff0000;">&quot;./$2/oil&quot;</span> refine <span style="color: #c20cb9; font-weight: bold;">install</span>
        <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'This is not a valid Fuel installation so Oil is a bit lost.'</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'        http://fuelphp.com/docs/installation/instructions.html'</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

<p>原來是再下 create 指令時馬上用git拉下來建立好專案.（不錯<br />
例:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ oil create <span style="color: #000000; font-weight: bold;">&lt;</span>project_name<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>來建一個試試</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ oil create Fuel
Cloning into .<span style="color: #000000; font-weight: bold;">/</span>Fuel…
remote: Counting objects: <span style="color: #000000;">14163</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4884</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4884</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">14163</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9660</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">13351</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9047</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">14163</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">14163</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">2.07</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">651</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">9660</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">9660</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule <span style="color: #ff0000;">'docs'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>docs.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'docs'</span>
Submodule <span style="color: #ff0000;">'fuel/core'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>core.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/core'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/auth'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>auth.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/auth'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/email'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>email.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/email'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/oil'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>oil.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/oil'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/orm'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>orm.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/orm'</span>
Submodule <span style="color: #ff0000;">'fuel/packages/parser'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>parser.git<span style="color: #7a0874; font-weight: bold;">&#41;</span> registered <span style="color: #000000; font-weight: bold;">for</span> path <span style="color: #ff0000;">'fuel/packages/parser'</span>
Cloning into docs...
remote: Counting objects: <span style="color: #000000;">5478</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1908</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1908</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">5478</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">3664</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">5251</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">3470</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">5478</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5478</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">1.70</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">757</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3664</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3664</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'docs'</span>: checked out <span style="color: #ff0000;">'f3746d4fcda2dc12d7f1120d55c17f3b52c0550e'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>core...
remote: Counting objects: <span style="color: #000000;">20779</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">6318</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">6318</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">20779</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">14499</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">20306</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">14065</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">20779</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20779</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">3.21</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1.08</span> MiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">14499</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">14499</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/core'</span>: checked out <span style="color: #ff0000;">'d95fbfec3fe2f791fead4eeb9a37fcd631009479'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>auth...
remote: Counting objects: <span style="color: #000000;">541</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">384</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">384</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">541</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">240</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">453</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">157</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">541</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">541</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">67.77</span> KiB, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">240</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">240</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/auth'</span>: checked out <span style="color: #ff0000;">'7a2c479263f768b6de8bffe43b1bd00fd2bbdd6d'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>email...
remote: Counting objects: <span style="color: #000000;">273</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">157</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">157</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">273</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">114</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">268</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">109</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">273</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">273</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">42.33</span> KiB, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">114</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">114</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/email'</span>: checked out <span style="color: #ff0000;">'0113f3c6596e5b3b97408607ddc033e3a7dc833a'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>oil...
remote: Counting objects: <span style="color: #000000;">869</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">370</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">370</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">869</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">491</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">837</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">467</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">869</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">869</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">114.39</span> KiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">79</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">491</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">491</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/oil'</span>: checked out <span style="color: #ff0000;">'da74ddc023871ef54a93fdcc541cbf2db95b73f3'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>orm...
remote: Counting objects: <span style="color: #000000;">14393</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4295</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4295</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">14393</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9963</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">14302</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">9877</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">14393</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">14393</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">2.07</span> MiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">863</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">9963</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">9963</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/orm'</span>: checked out <span style="color: #ff0000;">'ad18b80efcc712e02143a14d6e0902aab25da475'</span>
Cloning into fuel<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>parser...
remote: Counting objects: <span style="color: #000000;">603</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">303</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">303</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">603</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">285</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">571</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">254</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">603</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">603</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">113.31</span> KiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">77</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">285</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">285</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Submodule path <span style="color: #ff0000;">'fuel/packages/parser'</span>: checked out <span style="color: #ff0000;">'836c1ad77e631d47839630f3fa79b9dddc0b8091'</span>
     Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>Fuel<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>cache
     Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>Fuel<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>logs
     Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>Fuel<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>tmp
     Made writable: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>luosteve<span style="color: #000000; font-weight: bold;">/</span>Fuel<span style="color: #000000; font-weight: bold;">/</span>fuel<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>config</pre></td></tr></table></div>

<p>來看一下裝好啥.<br />
<a href="http://blog.sd.idv.tw/wp-content/uploads/2011/12/螢幕快照-2011-12-27-下午2.20.29.png"><img src="http://blog.sd.idv.tw/wp-content/uploads/2011/12/螢幕快照-2011-12-27-下午2.20.29-178x300.png" alt="" title="螢幕快照 2011-12-27 下午2.20.29" width="178" height="300" class="alignnone size-medium wp-image-522" /></a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> Fuel
$ php oil
&nbsp;
Usage:
  php oil <span style="color: #7a0874; font-weight: bold;">&#91;</span>cells<span style="color: #000000; font-weight: bold;">|</span>console<span style="color: #000000; font-weight: bold;">|</span>generate<span style="color: #000000; font-weight: bold;">|</span>refine<span style="color: #000000; font-weight: bold;">|</span><span style="color: #7a0874; font-weight: bold;">help</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #7a0874; font-weight: bold;">test</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
Runtime options:
  -f, <span style="color: #7a0874; font-weight: bold;">&#91;</span>--force<span style="color: #7a0874; font-weight: bold;">&#93;</span>    <span style="color: #666666; font-style: italic;"># Overwrite files that already exist</span>
  -s, <span style="color: #7a0874; font-weight: bold;">&#91;</span>--skip<span style="color: #7a0874; font-weight: bold;">&#93;</span>     <span style="color: #666666; font-style: italic;"># Skip files that already exist</span>
  -q, <span style="color: #7a0874; font-weight: bold;">&#91;</span>--quiet<span style="color: #7a0874; font-weight: bold;">&#93;</span>    <span style="color: #666666; font-style: italic;"># Supress status output</span>
  -t, <span style="color: #7a0874; font-weight: bold;">&#91;</span>--speak<span style="color: #7a0874; font-weight: bold;">&#93;</span>    <span style="color: #666666; font-style: italic;"># Speak errors in a robot voice</span>
&nbsp;
Description:
  The <span style="color: #ff0000;">'oil'</span> <span style="color: #7a0874; font-weight: bold;">command</span> can be used <span style="color: #000000; font-weight: bold;">in</span> several ways to facilitate quick development, <span style="color: #7a0874; font-weight: bold;">help</span> with
  testing your application and <span style="color: #000000; font-weight: bold;">for</span> running Tasks.
&nbsp;
Documentation:
  http:<span style="color: #000000; font-weight: bold;">//</span>docs.fuelphp.com<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>oil<span style="color: #000000; font-weight: bold;">/</span>intro.html</pre></td></tr></table></div>

<p>管他的先上再說！！</p>
<p>來設定一下nginx設定檔</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="config" style="font-family:monospace;">server {
    listen 127.0.0.1:80;
    server_name fuel;
    access_log /Users/luosteve/Fuel/fuel/app/logs/fuel.access.log;
    error_log  /Users/luosteve/Fuel/fuel/app/logs/fuel.error.log;
    root /Users/luosteve/Fuel/public;
&nbsp;
    location / {
        root   /Users/luosteve/Fuel/public;
        index  index.php index.html index.htm;
        if (!-e $request_filename) {
            rewrite ^.*$ /index.php last;
            break;
        }
    }
    location ~ \.php$ {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  /Users/luosteve/Fuel/public$fastcgi_script_name;
      include        fastcgi_params;
    }
    location ~ /\.ht {
            deny  all;
    }
}</pre></td></tr></table></div>

<p>好了重起nginx 並瀏覽 http://fuel/<br />
！！！登登 出現啦<br />
<a href="http://blog.sd.idv.tw/wp-content/uploads/2011/12/螢幕快照-2011-12-27-下午3.32.45.png"><img src="http://blog.sd.idv.tw/wp-content/uploads/2011/12/螢幕快照-2011-12-27-下午3.32.45-300x209.png" alt="" title="螢幕快照 2011-12-27 下午3.32.45" width="300" height="209" class="alignnone size-medium wp-image-525" /></a></p>
<p>畫面也有說明 此controller 是 APPPATH/classes/controller/welcome.php<br />
view 再 APPPATH/views/welcome/index.php<br />
APPPATH此範例是存在/Users/luosteve/Fuel/fuel/app/<br />
再這裡要說明一下,作者將APP 整個包在FrameWork內實在是很頭痛作法.當你自行開發更改專案時,<br />
如果此時有FrameWork有更新 你只能以rebase 方式做更新,好死不死哪天又有衝突你每次更新就在那<br />
解衝突（整個就飽了,不用做事了）.<br />
其實一開始看到此架構就先倒退三尺XDD.</p>
<p>有興趣可以先看看config設定吧(咦?!是php 檔案唷）<br />
fuel/app/config/config.php<br />
內文就不看啦,各種設定值請<a href="http://docs.fuelphp.com/general/configuration.html">參考</a>.<br />
就醬而已sorry.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/520/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZFS on MAC OSX</title>
		<link>http://blog.sd.idv.tw/archives/513</link>
		<comments>http://blog.sd.idv.tw/archives/513#comments</comments>
		<pubDate>Wed, 23 Nov 2011 12:04:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mac OSX]]></category>
		<category><![CDATA[MAC OSX]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=513</guid>
		<description><![CDATA[ZFS 是很好檔案系統,可惜因為種種原因&#8230;沒有機會在OSX 上面使用. MACZFS 是好心人porting到MAC OSX上面,只要下載安裝包下來就可以直接使用. 以下是實際使用方式: 先查看目前磁碟使用狀況. 1 2 3 4 5 6 7 8 # diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.1 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 300.9 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 4: Apple_HFS data 198.2 GB disk0s4 [...]]]></description>
			<content:encoded><![CDATA[<p>ZFS 是很好檔案系統,可惜因為種種原因&#8230;沒有機會在OSX 上面使用.<br />
<a href="http://code.google.com/p/maczfs/">MACZFS</a><br />
是好心人porting到MAC OSX上面,只要下載安裝包下來就可以直接使用.<br />
以下是實際使用方式:<br />
先查看目前磁碟使用狀況.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#  diskutil list</span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>disk0
   <span style="color: #666666; font-style: italic;">#:                       TYPE NAME                    SIZE       IDENTIFIER</span>
   <span style="color: #000000;">0</span>:      GUID_partition_scheme                        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">500.1</span> GB   disk0
   <span style="color: #000000;">1</span>:                        EFI                         <span style="color: #000000;">209.7</span> MB   disk0s1
   <span style="color: #000000;">2</span>:                  Apple_HFS Macintosh HD            <span style="color: #000000;">300.9</span> GB   disk0s2
   <span style="color: #000000;">3</span>:                 Apple_Boot Recovery HD             <span style="color: #000000;">650.0</span> MB   disk0s3
   <span style="color: #000000;">4</span>:                  Apple_HFS data                    <span style="color: #000000;">198.2</span> GB   disk0s4</pre></td></tr></table></div>

<p><span id="more-513"></span><br />
查看目前支援的ZFS 版本到哪一個版本.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># zpool upgrade -v </span>
This system is currently running ZFS pool version <span style="color: #000000;">8</span>.
&nbsp;
The following versions are supported:
&nbsp;
VER  DESCRIPTION
<span style="color: #660033;">---</span>  <span style="color: #660033;">--------------------------------------------------------</span>
 <span style="color: #000000;">1</span>   Initial ZFS version
 <span style="color: #000000;">2</span>   Ditto blocks <span style="color: #7a0874; font-weight: bold;">&#40;</span>replicated metadata<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #000000;">3</span>   Hot spares and double parity RAID-Z
 <span style="color: #000000;">4</span>   zpool <span style="color: #7a0874; font-weight: bold;">history</span>
 <span style="color: #000000;">5</span>   Compression using the <span style="color: #c20cb9; font-weight: bold;">gzip</span> algorithm
 <span style="color: #000000;">6</span>   pool properties
 <span style="color: #000000;">7</span>   Separate intent log devices
 <span style="color: #000000;">8</span>   Delegated administration
For <span style="color: #c20cb9; font-weight: bold;">more</span> information on a particular version, including supported releases, see:
&nbsp;
http:<span style="color: #000000; font-weight: bold;">//</span>www.opensolaris.org<span style="color: #000000; font-weight: bold;">/</span>os<span style="color: #000000; font-weight: bold;">/</span>community<span style="color: #000000; font-weight: bold;">/</span>zfs<span style="color: #000000; font-weight: bold;">/</span>version<span style="color: #000000; font-weight: bold;">/</span>N
&nbsp;
Where <span style="color: #ff0000;">'N'</span> is the version number.</pre></td></tr></table></div>

<p>將目前磁區縮小,並建立一個名稱ZFS新磁區.<br />
<a href="http://blog.sd.idv.tw/wp-content/uploads/2011/11/螢幕快照-2011-11-22-下午11.18.09.png"><img src="http://blog.sd.idv.tw/wp-content/uploads/2011/11/螢幕快照-2011-11-22-下午11.18.09-300x260.png" alt="" title="螢幕快照 2011-11-22 下午11.18.09" width="300" height="260" class="alignnone size-medium wp-image-516" /></a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#  diskutil list</span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>disk0
   <span style="color: #666666; font-style: italic;">#:                       TYPE NAME                    SIZE       IDENTIFIER</span>
   <span style="color: #000000;">0</span>:      GUID_partition_scheme                        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">500.1</span> GB   disk0
   <span style="color: #000000;">1</span>:                        EFI                         <span style="color: #000000;">209.7</span> MB   disk0s1
   <span style="color: #000000;">2</span>:                  Apple_HFS Macintosh HD            <span style="color: #000000;">240.0</span> GB   disk0s2
   <span style="color: #000000;">3</span>:                 Apple_Boot Recovery HD             <span style="color: #000000;">650.0</span> MB   disk0s5
   <span style="color: #000000;">4</span>:                  Apple_HFS ZFS                     <span style="color: #000000;">60.0</span> GB    disk0s4</pre></td></tr></table></div>

<p>將新磁區zfs,清除格式化為ZFS格式</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># diskutil eraseVolume ZFS %noformat% /dev/disk0s4</span>
Started erase on disk0s4 ZFS
Unmounting disk
Erasing
Finished erase on disk0s4 ZFS</pre></td></tr></table></div>

<p>建立新zpool</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># zpool create pool1 disk0s4</span>
<span style="color: #666666; font-style: italic;"># zpool status pool1 </span>
  pool: pool1
 state: ONLINE
 scrub: none requested
config:
&nbsp;
	NAME        STATE     READ WRITE CKSUM
	pool1       ONLINE       <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>
	  disk0s4   ONLINE       <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>
&nbsp;
errors: No known data errors
<span style="color: #666666; font-style: italic;"># diskutil list</span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>disk0
   <span style="color: #666666; font-style: italic;">#:                       TYPE NAME                    SIZE       IDENTIFIER</span>
   <span style="color: #000000;">0</span>:      GUID_partition_scheme                        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">500.1</span> GB   disk0
   <span style="color: #000000;">1</span>:                        EFI                         <span style="color: #000000;">209.7</span> MB   disk0s1
   <span style="color: #000000;">2</span>:                  Apple_HFS Macintosh HD            <span style="color: #000000;">240.0</span> GB   disk0s2
   <span style="color: #000000;">3</span>:                 Apple_Boot Recovery HD             <span style="color: #000000;">650.0</span> MB   disk0s5
   <span style="color: #000000;">4</span>:                        ZFS pool1                   <span style="color: #000000;">60.0</span> GB    disk0s4
&nbsp;
<span style="color: #666666; font-style: italic;"># zfs list</span>
NAME    USED  AVAIL  REFER  MOUNTPOINT
pool1  1.07M  54.6G  1005K  <span style="color: #000000; font-weight: bold;">/</span>Volumes<span style="color: #000000; font-weight: bold;">/</span>pool1</pre></td></tr></table></div>

<p>設定屬性compression=gzip壓縮檔按以節省空間</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># zfs set compression=gzip pool1</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># zfs get all pool1                                                                                    (11-23 01:07)  </span>
NAME   PROPERTY       VALUE                 SOURCE
pool1  <span style="color: #7a0874; font-weight: bold;">type</span>           filesystem            -
pool1  creation       三 <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>  <span style="color: #000000;">0</span>:<span style="color: #000000;">55</span> <span style="color: #000000;">2011</span>  -
pool1  used           370K                  -
pool1  available      54.6G                 -
pool1  referenced     284K                  -
pool1  compressratio  1.00x                 -
pool1  mounted        <span style="color: #c20cb9; font-weight: bold;">yes</span>                   -
pool1  quota          none                  default
pool1  reservation    none                  default
pool1  recordsize     128K                  default
pool1  mountpoint     <span style="color: #000000; font-weight: bold;">/</span>Volumes<span style="color: #000000; font-weight: bold;">/</span>pool1        default
pool1  sharenfs       off                   default
pool1  checksum       on                    default
pool1  compression    <span style="color: #c20cb9; font-weight: bold;">gzip</span>                  <span style="color: #7a0874; font-weight: bold;">local</span>
pool1  atime          on                    default
pool1  devices        on                    default
pool1  <span style="color: #7a0874; font-weight: bold;">exec</span>           on                    default
pool1  setuid         on                    default
pool1  <span style="color: #7a0874; font-weight: bold;">readonly</span>       off                   default
pool1  zoned          off                   default
pool1  snapdir        hidden                default
pool1  aclmode        groupmask             default
pool1  aclinherit     secure                default
pool1  canmount       on                    default
pool1  shareiscsi     off                   default
pool1  xattr          on                    default
pool1  copies         <span style="color: #000000;">1</span>                     default
pool1  version        <span style="color: #000000;">2</span>                     -</pre></td></tr></table></div>

<p>以下是我開了一個mysql_data的節點使用壓縮compression=gzip,exec=off.<br />
各位可以看到壓縮比compressratio = 4.18x 等於說我原本這些資料佔用6.85G 現在節省到只佔用1.64G！！！！<br />
幫我MBP節省寶貴空間,如果你是用SSD更是要必需計較空間使用在此強力推薦ZFS來使用.(不過打開壓縮勢必在存取檔案消耗更多CPU）</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;"># zfs get all pool1/mysql_data</span>
NAME              PROPERTY       VALUE                      SOURCE
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  <span style="color: #7a0874; font-weight: bold;">type</span>           filesystem                 -
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  creation       三 <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>  <span style="color: #000000;">1</span>:<span style="color: #000000;">56</span> <span style="color: #000000;">2011</span>       -
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  used           1.64G                      -
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  available      14.9G                      -
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  referenced     1.64G                      -
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  compressratio  4.18x                      -
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  mounted        <span style="color: #c20cb9; font-weight: bold;">yes</span>                        -
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  quota          none                       default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  reservation    none                       default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  recordsize     128K                       default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  mountpoint     <span style="color: #000000; font-weight: bold;">/</span>Volumes<span style="color: #000000; font-weight: bold;">/</span>pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  sharenfs       off                        default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  checksum       on                         default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  compression    <span style="color: #c20cb9; font-weight: bold;">gzip</span>                       <span style="color: #7a0874; font-weight: bold;">local</span>
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  atime          on                         default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  devices        on                         default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  <span style="color: #7a0874; font-weight: bold;">exec</span>           off                        <span style="color: #7a0874; font-weight: bold;">local</span>
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  setuid         on                         default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  <span style="color: #7a0874; font-weight: bold;">readonly</span>       off                        default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  zoned          off                        default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  snapdir        hidden                     default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  aclmode        groupmask                  default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  aclinherit     secure                     default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  canmount       on                         default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  shareiscsi     off                        default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  xattr          on                         default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  copies         <span style="color: #000000;">1</span>                          default
pool1<span style="color: #000000; font-weight: bold;">/</span>mysql_data  version        <span style="color: #000000;">2</span>                          -</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/513/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gearman Install OSX</title>
		<link>http://blog.sd.idv.tw/archives/509</link>
		<comments>http://blog.sd.idv.tw/archives/509#comments</comments>
		<pubDate>Fri, 18 Nov 2011 04:30:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=509</guid>
		<description><![CDATA[安裝Gearman 在OSX上面 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 [...]]]></description>
			<content:encoded><![CDATA[<p>安裝Gearman 在OSX上面</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-s</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>libevent<span style="color: #000000; font-weight: bold;">/</span>libevent<span style="color: #000000; font-weight: bold;">/</span>libevent-2.0.15-stable.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf libevent-2.0.15-stable.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> libevent-2.0.15-stable
$ .<span style="color: #000000; font-weight: bold;">/</span>configure
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> https:<span style="color: #000000; font-weight: bold;">//</span>launchpad.net<span style="color: #000000; font-weight: bold;">/</span>ubuntu<span style="color: #000000; font-weight: bold;">/</span>lucid<span style="color: #000000; font-weight: bold;">/</span>+source<span style="color: #000000; font-weight: bold;">/</span>libdrizzle<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0.7</span>-<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>+files<span style="color: #000000; font-weight: bold;">/</span>libdrizzle_0.7.orig.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> libdrizzle_0.7.orig.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> libdrizzle-<span style="color: #000000;">0.7</span><span style="color: #000000; font-weight: bold;">/</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>configure
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>launchpad.net<span style="color: #000000; font-weight: bold;">/</span>gearmand<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0.14</span><span style="color: #000000; font-weight: bold;">/</span>+download<span style="color: #000000; font-weight: bold;">/</span>gearmand-<span style="color: #000000;">0.14</span>.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf gearmand-<span style="color: #000000;">0.14</span>.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> gearmand-<span style="color: #000000;">0.14</span><span style="color: #000000; font-weight: bold;">/</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>configure
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pecl.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>gearman-0.8.0.tgz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf gearman-0.8.0.tgz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> gearman-0.8.0
$ phpize
$ .<span style="color: #000000; font-weight: bold;">/</span>configure
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>gearman-0.8.0<span style="color: #000000; font-weight: bold;">/</span>libtool <span style="color: #660033;">--mode</span>=<span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> .<span style="color: #000000; font-weight: bold;">/</span>gearman.la <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>gearman-0.8.0<span style="color: #000000; font-weight: bold;">/</span>modules
<span style="color: #c20cb9; font-weight: bold;">cp</span> .<span style="color: #000000; font-weight: bold;">/</span>.libs<span style="color: #000000; font-weight: bold;">/</span>gearman.so <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>gearman-0.8.0<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>gearman.so
<span style="color: #c20cb9; font-weight: bold;">cp</span> .<span style="color: #000000; font-weight: bold;">/</span>.libs<span style="color: #000000; font-weight: bold;">/</span>gearman.lai <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>gearman-0.8.0<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>gearman.la
<span style="color: #660033;">----------------------------------------------------------------------</span>
Libraries have been installed <span style="color: #000000; font-weight: bold;">in</span>:
   <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>gearman-0.8.0<span style="color: #000000; font-weight: bold;">/</span>modules
&nbsp;
If you ever happen to want to <span style="color: #c20cb9; font-weight: bold;">link</span> against installed libraries
<span style="color: #000000; font-weight: bold;">in</span> a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the <span style="color: #000000; font-weight: bold;">`</span>-LLIBDIR<span style="color: #ff0000;">'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH'</span> environment variable
     during execution
&nbsp;
See any operating system documentation about shared libraries <span style="color: #000000; font-weight: bold;">for</span>
<span style="color: #c20cb9; font-weight: bold;">more</span> information, such <span style="color: #c20cb9; font-weight: bold;">as</span> the <span style="color: #c20cb9; font-weight: bold;">ld</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> and ld.so<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> manual pages.
<span style="color: #660033;">----------------------------------------------------------------------</span>
Installing shared extensions:     <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>extensions<span style="color: #000000; font-weight: bold;">/</span>no-debug-non-zts-<span style="color: #000000;">20090626</span><span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">which</span> php
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php
&nbsp;
$ php <span style="color: #660033;">--info</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> configuration                                                                                                  <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">11</span>-<span style="color: #000000;">17</span> <span style="color: #000000;">13</span>:<span style="color: #000000;">30</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Configuration File <span style="color: #7a0874; font-weight: bold;">&#40;</span>php.ini<span style="color: #7a0874; font-weight: bold;">&#41;</span> Path =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc
Loaded Configuration File =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini
Configuration
$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini
======= 加入以下資訊 ======
extension_dir = <span style="color: #ff0000;">&quot; /usr/lib/php/extensions/no-debug-non-zts-20090626/&quot;</span>  <span style="color: #000000; font-weight: bold;">&lt;</span>~~這不一定要
<span style="color: #007800;">extension</span>=<span style="color: #ff0000;">&quot;gearman.so&quot;</span>
========================
$ php <span style="color: #660033;">--info</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;(configuration|gearman)&quot;</span>
Configuration File <span style="color: #7a0874; font-weight: bold;">&#40;</span>php.ini<span style="color: #7a0874; font-weight: bold;">&#41;</span> Path =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc
Loaded Configuration File =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini
Configuration
gearman
gearman support =<span style="color: #000000; font-weight: bold;">&gt;</span> enabled
libgearman version =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">0.14</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/509/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gearman Install on Ubuntu</title>
		<link>http://blog.sd.idv.tw/archives/507</link>
		<comments>http://blog.sd.idv.tw/archives/507#comments</comments>
		<pubDate>Fri, 18 Nov 2011 04:26:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP & MYSQL]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=507</guid>
		<description><![CDATA[gearman 在ubuntu 上不知哪個版本已無提供libdrizzlea模組. 導致要使用myql作為資料源已無法使用. 以下是自行編譯安裝方式： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 $ sudo -s $ add-apt-repository ppa:gearman-developers/ppa $ apt-get update $ apt-get install libevent-dev gearman libgearman4 libgearman-dev libdrizzle0 [...]]]></description>
			<content:encoded><![CDATA[<p>gearman 在ubuntu 上不知哪個版本已無提供libdrizzlea模組.<br />
導致要使用myql作為資料源已無法使用.<br />
以下是自行編譯安裝方式：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-s</span>
$ add-apt-repository ppa:gearman-developers<span style="color: #000000; font-weight: bold;">/</span>ppa
$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libevent-dev gearman libgearman4 libgearman-dev libdrizzle0 libboost-program-options-dev libboost1.46-dev libboost-program-options-dev uuid-dev <span style="color: #c20cb9; font-weight: bold;">g++</span> libmemcache-dev libcloog-ppl0
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> https:<span style="color: #000000; font-weight: bold;">//</span>launchpad.net<span style="color: #000000; font-weight: bold;">/</span>ubuntu<span style="color: #000000; font-weight: bold;">/</span>lucid<span style="color: #000000; font-weight: bold;">/</span>+source<span style="color: #000000; font-weight: bold;">/</span>libdrizzle<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0.7</span>-<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>+files<span style="color: #000000; font-weight: bold;">/</span>libdrizzle_0.7.orig.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf libdrizzle_0.7.orig.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> libdrizzle-<span style="color: #000000;">0.7</span><span style="color: #000000; font-weight: bold;">/</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>configure
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ cd..
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>launchpad.net<span style="color: #000000; font-weight: bold;">/</span>gearmand<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0.14</span><span style="color: #000000; font-weight: bold;">/</span>+download<span style="color: #000000; font-weight: bold;">/</span>gearmand-<span style="color: #000000;">0.14</span>.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf gearmand-<span style="color: #000000;">0.14</span>.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> gearmand-<span style="color: #000000;">0.14</span><span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #007800;">libdrizzle_CFLAGS</span>=<span style="color: #ff0000;">&quot;-I/usr/local/include&quot;</span> <span style="color: #007800;">libdrizzle_LIBS</span>=<span style="color: #ff0000;">&quot;-L/usr/local/lib -ldrizzle&quot;</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pecl.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>gearman-0.8.0.tgz
$ pecl <span style="color: #c20cb9; font-weight: bold;">install</span> gearman-0.8.0.tgz
$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>gearman.ini
==== 加入 ====
<span style="color: #007800;">extension</span>=gearman.so
$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>gearman-job-server
=====編輯====
<span style="color: #007800;">prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
<span style="color: #007800;">PARAMS</span>=<span style="color: #ff0000;">&quot;--queue-type=libdrizzle --libdrizzle-host=mysql主機ip --libdrizzle-user=mysql帳號 --libdrizzle-password=mysql主機ip --libdrizzle-db=gearman --libdrizzle-table=gearman_queue --libdrizzle-mysql&quot;</span>
====加上註解====
<span style="color: #666666; font-style: italic;">#test -f /etc/default/gearman-job-server &amp;&amp; . /etc/default/gearman-job-server</span>
========================
DB gearman  要自行在mysql新增 資料表他自行會建立
$ service gearman-job-server start</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/507/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git 與遠端Server 應用</title>
		<link>http://blog.sd.idv.tw/archives/498</link>
		<comments>http://blog.sd.idv.tw/archives/498#comments</comments>
		<pubDate>Tue, 01 Nov 2011 17:24:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=498</guid>
		<description><![CDATA[乘上篇文章gitolite 安裝. 當你開心使用git一陣子,又在網路上免費或付費支援git平台的版本控管後是否發覺&#8230;. 真的好麻煩每次都要同步好幾台SERVER上面的repositories&#8230; 有沒有在push上server後自動幫你搞定呢？！ git當初設計實在太人性！！ 以下範例: 目的：在push 到本機的gitolite server時自動更新一份到bitbucket.org 在bitbucket.org 註冊新帳號 將gitolite 的使用者git id_rsa.pub 公鑰上傳到bitbucket.org bitbucket.org 上開一個測試用的repositories 編輯設定檔： 1 2 # cd /home/git/repositories/testing.git # vi config 加入名為 bitbucket的遠端： 1 2 3 4 5 6 7 &#91;core&#93; repositoryformatversion = 0 filemode = true bare = true &#91;remote &#34;bitbucket&#34;&#93; url = git@bitbucket.org:sdpower/mytest.git fetch = +refs/heads/*:refs/remotes/bitbucket/* 進入hook編輯產生更新時所用到的檔案以post-update： [...]]]></description>
			<content:encoded><![CDATA[<p>乘上篇文章<a href="http://blog.sd.idv.tw/archives/489" title="gitolite 安裝">gitolite 安裝</a>.<br />
當你開心使用git一陣子,又在網路上免費或付費支援git平台的版本控管後是否發覺&#8230;.<br />
真的好麻煩每次都要同步好幾台SERVER上面的repositories&#8230;<br />
有沒有在push上server後自動幫你搞定呢？！<br />
<span id="more-498"></span><br />
git當初設計實在太人性！！<br />
以下範例:</p>
<ul>
<li>目的：在push 到本機的gitolite server時自動更新一份到bitbucket.org</li>
<li>在bitbucket.org 註冊新帳號</li>
<li>將gitolite 的使用者git id_rsa.pub 公鑰上傳到bitbucket.org</li>
<li>bitbucket.org 上開一個測試用的repositories</li>
</ul>
<p>編輯設定檔：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/git/repositories/testing.git</span>
<span style="color: #666666; font-style: italic;"># vi config</span></pre></td></tr></table></div>

<p>加入名為 bitbucket的遠端：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>core<span style="">&#93;</span></span>
	<span style="color: #000099;">repositoryformatversion</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span>
	<span style="color: #000099;">filemode</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> true</span>
	<span style="color: #000099;">bare</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> true</span>
<span style="">&#91;</span>remote <span style="color: #933;">&quot;bitbucket&quot;</span><span style="">&#93;</span>
    <span style="color: #000099;">url</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> git@bitbucket.org:sdpower/mytest.git</span>
    <span style="color: #000099;">fetch</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> +refs/heads/*:refs/remotes/bitbucket/*</span></pre></td></tr></table></div>

<p>進入hook編輯產生更新時所用到的檔案以post-update：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/git/repositories/testing.git</span>
<span style="color: #666666; font-style: italic;"># cd hooks</span>
<span style="color: #666666; font-style: italic;"># cp post-update.sample post-update</span>
<span style="color: #666666; font-style: italic;"># vi post-update</span></pre></td></tr></table></div>

<p>進入hook編輯post-update產生更新時所需要做的動作：<br />
這裡加入了判斷,當網路可以存取才做的動作.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># An example hook script to prepare a packed repository for use over</span>
<span style="color: #666666; font-style: italic;"># dumb transports.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># To enable this hook, rename this file to &quot;post-update&quot;.</span>
&nbsp;
<span style="color: #007800;">RESULT</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">--spider</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.google.com.tw<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">FLAG</span>=<span style="color: #000000;">0</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Traverse the string considering it as an array of words</span>
<span style="color: #000000; font-weight: bold;">for</span> x <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$RESULT</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$x</span>&quot;</span> = <span style="color: #ff0000;">'200'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #c20cb9; font-weight: bold;">git</span> push bitbucket <span style="color: #660033;">-f</span> <span style="color: #660033;">--mirror</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>切回一般使用者到testing做測試:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># git commit -a -m 'test2'</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>master 4a07f57<span style="color: #7a0874; font-weight: bold;">&#93;</span> test2
 <span style="color: #000000;">1</span> files changed, <span style="color: #000000;">1</span> insertions<span style="color: #7a0874; font-weight: bold;">&#40;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">0</span> deletions<span style="color: #7a0874; font-weight: bold;">&#40;</span>-<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #666666; font-style: italic;"># git push origin master</span>
Counting objects: <span style="color: #000000;">5</span>, done.
Writing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">238</span> bytes, done.
Total <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
remote: remote: bb<span style="color: #000000; font-weight: bold;">/</span>acl: sdpower is allowed. accepted payload.
remote: To <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>bitbucket.org:sdpower<span style="color: #000000; font-weight: bold;">/</span>mytest.git
remote:  <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>new branch<span style="color: #7a0874; font-weight: bold;">&#93;</span>      master -<span style="color: #000000; font-weight: bold;">&gt;</span> master
To <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>srv1.sd.idv.tw:testing.git
   0b01c5a..4a07f57  master -<span style="color: #000000; font-weight: bold;">&gt;</span> master
<span style="color: #666666; font-style: italic;">#</span></pre></td></tr></table></div>

<p>成功！！<br />
以下這段就是在push時候所做的動作訊息.<br />
可以前往bitbucket.org確認是否有同步更新.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">remote: To <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>bitbucket.org:sdpower<span style="color: #000000; font-weight: bold;">/</span>mytest.git
remote:  <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>new branch<span style="color: #7a0874; font-weight: bold;">&#93;</span>      master -<span style="color: #000000; font-weight: bold;">&gt;</span> master</pre></td></tr></table></div>

<p>如有需要可以增加多個遠端,做同步更新.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/498/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gitolite 安裝</title>
		<link>http://blog.sd.idv.tw/archives/489</link>
		<comments>http://blog.sd.idv.tw/archives/489#comments</comments>
		<pubDate>Tue, 01 Nov 2011 03:52:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=489</guid>
		<description><![CDATA[FreeBSD gitolite 安裝 安裝: 1 # cd /usr/ports/devel/gitolite ; make install clean; 安裝結束最後面會看到以下提示: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ============================================================================== &#160; Final gitolite installation instructions: &#160; Any ssh user can be a gitolite provider. Simply run the following command as [...]]]></description>
			<content:encoded><![CDATA[<p>FreeBSD <strong>gitolite 安裝</strong><br />
安裝:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /usr/ports/devel/gitolite ; make install clean;</span></pre></td></tr></table></div>

<p>安裝結束最後面會看到以下提示:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">==============================================================================
&nbsp;
Final gitolite installation instructions:
&nbsp;
Any <span style="color: #c20cb9; font-weight: bold;">ssh</span> user can be a gitolite provider. Simply run the following <span style="color: #7a0874; font-weight: bold;">command</span> <span style="color: #c20cb9; font-weight: bold;">as</span>
the user:
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gl-setup <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>admin.ssh.key.pub
&nbsp;
This will setup up the configuration files <span style="color: #000000; font-weight: bold;">for</span> gitolite, designating where the
repositories are located and other options.
&nbsp;
The admin <span style="color: #c20cb9; font-weight: bold;">ssh</span> key allows full access to the gitolite-admin repository where
additional <span style="color: #c20cb9; font-weight: bold;">users</span> and repositories can be configured.
&nbsp;
By default, the <span style="color: #c20cb9; font-weight: bold;">git</span> user is created <span style="color: #000000; font-weight: bold;">for</span> use by gitolite.
&nbsp;
==============================================================================
===<span style="color: #000000; font-weight: bold;">&gt;</span> Correct pkg-plist sequence to create group<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> and user<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
===<span style="color: #000000; font-weight: bold;">&gt;</span>   Registering installation <span style="color: #000000; font-weight: bold;">for</span> gitolite-<span style="color: #000000;">2.1</span>
===<span style="color: #000000; font-weight: bold;">&gt;</span>  Cleaning <span style="color: #000000; font-weight: bold;">for</span> gitolite-<span style="color: #000000;">2.1</span></pre></td></tr></table></div>

<p><span id="more-489"></span><br />
1.先自行新增一位使用者,此範例使用git.<br />
2.切換到git使用者.<br />
3.起始化gitolite並輸入 管理者SSH 公鑰admin.key.pub.<br />
4.離開git 使用者回到管理員帳號.<br />
5.使用一般git 操作拉回gitolite管理設定值並開始管理.<br />
6.設定好資料只需push回去即可生效.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># su git</span>
<span style="color: #666666; font-style: italic;"># /usr/local/bin/gl-setup /tmp/admin.key.pub</span>
The default settings <span style="color: #000000; font-weight: bold;">in</span> the rc <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>.gitolite.rc<span style="color: #7a0874; font-weight: bold;">&#41;</span> are fine <span style="color: #000000; font-weight: bold;">for</span> most
people but <span style="color: #000000; font-weight: bold;">if</span> you wish to <span style="color: #c20cb9; font-weight: bold;">make</span> any changes, you can <span style="color: #000000; font-weight: bold;">do</span> so now.
&nbsp;
hit enter...
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>gitolite<span style="color: #000000; font-weight: bold;">/</span>gl-setup: <span style="color: #c20cb9; font-weight: bold;">vim</span>: not found
creating gitolite-admin...
Initialized empty Git repository <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>repositories<span style="color: #000000; font-weight: bold;">/</span>gitolite-admin.git<span style="color: #000000; font-weight: bold;">/</span>
creating testing...
Initialized empty Git repository <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>repositories<span style="color: #000000; font-weight: bold;">/</span>testing.git<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>master <span style="color: #7a0874; font-weight: bold;">&#40;</span>root-commit<span style="color: #7a0874; font-weight: bold;">&#41;</span> 143cabc<span style="color: #7a0874; font-weight: bold;">&#93;</span> start
 <span style="color: #000000;">2</span> files changed, <span style="color: #000000;">6</span> insertions<span style="color: #7a0874; font-weight: bold;">&#40;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">0</span> deletions<span style="color: #7a0874; font-weight: bold;">&#40;</span>-<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 create mode <span style="color: #000000;">100644</span> conf<span style="color: #000000; font-weight: bold;">/</span>gitolite.conf
 create mode <span style="color: #000000;">100644</span> keydir<span style="color: #000000; font-weight: bold;">/</span>admin.pub
<span style="color: #666666; font-style: italic;"># exit</span>
<span style="color: #666666; font-style: italic;"># git clone git@srv1.sd.idv.tw:gitolite-admin</span>
<span style="color: #666666; font-style: italic;"># cd gitolite-admin</span>
<span style="color: #666666; font-style: italic;"># vi conf/gitolite.conf</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="conf" style="font-family:monospace;">repo    gitolite-admin
        RW+     =   admin
&nbsp;
repo    testing
        RW+     =   @all
&nbsp;
repo    mytest
        RW+     =   @all</pre></td></tr></table></div>

<p>新增專案:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd mytest</span>
<span style="color: #666666; font-style: italic;"># git init</span>
<span style="color: #666666; font-style: italic;"># git remote add origin git@srv1.sd.idv.tw:mytest</span>
<span style="color: #666666; font-style: italic;"># touch readme</span>
<span style="color: #666666; font-style: italic;"># git add .</span>
<span style="color: #666666; font-style: italic;"># git commit -m 'initial'</span>
<span style="color: #666666; font-style: italic;"># git push origin master</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/489/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB Sharing</title>
		<link>http://blog.sd.idv.tw/archives/471</link>
		<comments>http://blog.sd.idv.tw/archives/471#comments</comments>
		<pubDate>Thu, 18 Aug 2011 11:43:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP & MYSQL]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=471</guid>
		<description><![CDATA[MongoDB Sharing 可以先看看官網介紹:Sharding Introduction Shards 類似 Mysql 的Data nodes. Config Servers 類似 Mysql 的Management node. Routing Processes 類似 Mysql 的SQL node. 架構: 1 2 3 4 5 主機 shars shars shars config Routing 192.168.1.52 myset52 myset59 myset60 yes 192.168.1.59 myset52 myset59 myset60 yes 192.168.1.60 myset52 myset59 myset60 yes 192.168.1.61 myset52備 myset59備 myset60備 yes 設定: 1 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MongoDB Sharing</strong><br />
<a href="http://blog.sd.idv.tw/wp-content/uploads/2011/08/sharding.png"><img src="http://blog.sd.idv.tw/wp-content/uploads/2011/08/sharding-300x174.png" alt="" title="sharding" width="300" height="174" class="alignnone size-medium wp-image-472" /></a><br />
可以先看看官網介紹:<a href="http://www.mongodb.org/display/DOCS/Sharding+Introduction" target="_blank">Sharding Introduction</a><br />
Shards 類似 Mysql 的Data nodes.<br />
Config Servers 類似 Mysql 的Management node.<br />
Routing Processes 類似 Mysql 的SQL node.<br />
<span id="more-471"></span><br />
<strong>架構:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="txt" style="font-family:monospace;">    主機         shars      shars      shars     config   Routing
192.168.1.52   myset52    myset59    myset60      yes
192.168.1.59   myset52    myset59    myset60      yes
192.168.1.60   myset52    myset59    myset60      yes
192.168.1.61   myset52備  myset59備  myset60備               yes</pre></td></tr></table></div>

<p><strong>設定:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_s1
$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_s2
$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_s3
$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_c</pre></td></tr></table></div>

<p>設定各個設定檔.<br />
/etc/mongodb_s1.conf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">dbpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_s1
<span style="color: #007800;">logpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>mongodb<span style="color: #000000; font-weight: bold;">/</span>mongodb_s1.log
<span style="color: #007800;">logappend</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
bind_ip = 127.0.0.1
port = <span style="color: #000000;">29017</span>
nohttpinterface = <span style="color: #c20cb9; font-weight: bold;">true</span>
shardsvr = <span style="color: #c20cb9; font-weight: bold;">true</span>
rest = <span style="color: #c20cb9; font-weight: bold;">true</span>
replSet = myset52</pre></td></tr></table></div>

<p>/etc/mongodb_s2.conf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">dbpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_s2
<span style="color: #007800;">logpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>mongodb<span style="color: #000000; font-weight: bold;">/</span>mongodb_s2.log
<span style="color: #007800;">logappend</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
bind_ip = 127.0.0.1
port = <span style="color: #000000;">29018</span>
nohttpinterface = <span style="color: #c20cb9; font-weight: bold;">true</span>
shardsvr = <span style="color: #c20cb9; font-weight: bold;">true</span>
rest = <span style="color: #c20cb9; font-weight: bold;">true</span>
replSet = myset59</pre></td></tr></table></div>

<p>/etc/mongodb_s3.conf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">dbpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_s3
<span style="color: #007800;">logpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>mongodb<span style="color: #000000; font-weight: bold;">/</span>mongodb_s3.log
<span style="color: #007800;">logappend</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
bind_ip = 127.0.0.1
port = <span style="color: #000000;">29019</span>
nohttpinterface = <span style="color: #c20cb9; font-weight: bold;">true</span>
shardsvr = <span style="color: #c20cb9; font-weight: bold;">true</span>
rest = <span style="color: #c20cb9; font-weight: bold;">true</span>
replSet = myset60</pre></td></tr></table></div>

<p>/etc/mongodb_c.conf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">dbpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mongodb_c
<span style="color: #007800;">logpath</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>mongodb<span style="color: #000000; font-weight: bold;">/</span>mongodb_c.log
<span style="color: #007800;">logappend</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
bind_ip = 127.0.0.1                                                          
port = <span style="color: #000000;">29020</span>
nohttpinterface = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></td></tr></table></div>

<p>個別啟動</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongod <span style="color: #660033;">--fork</span> <span style="color: #660033;">--config</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mongodb_s1.conf
$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongod <span style="color: #660033;">--fork</span> <span style="color: #660033;">--config</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mongodb_s2.conf
$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongod <span style="color: #660033;">--fork</span> <span style="color: #660033;">--config</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mongodb_s3.conf
$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongod <span style="color: #660033;">--configsvr</span> <span style="color: #660033;">--fork</span> <span style="color: #660033;">--config</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mongodb_c.conf <span style="color: #666666; font-style: italic;">#192.168.1.61不使用Config</span></pre></td></tr></table></div>

<p>設定myset52：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongo 192.168.1.52:<span style="color: #000000;">29017</span><span style="color: #000000; font-weight: bold;">/</span>admin
MongoDB shell version: 1.8.2
connecting to: admin
<span style="color: #000000; font-weight: bold;">&gt;</span> cfg = <span style="color: #7a0874; font-weight: bold;">&#123;</span>
_id : <span style="color: #ff0000;">&quot;myset52&quot;</span>,
members : <span style="color: #7a0874; font-weight: bold;">&#91;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">0</span>, host : <span style="color: #ff0000;">&quot;192.168.1.52:29017&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">1</span>, host : <span style="color: #ff0000;">&quot;192.168.1.59:29017&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">2</span>, host : <span style="color: #ff0000;">&quot;192.168.1.60:29017&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">3</span>, host : <span style="color: #ff0000;">&quot;192.168.1.61:29017&quot;</span>, arbiterOnly: <span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&gt;</span> rs.initiate<span style="color: #7a0874; font-weight: bold;">&#40;</span>cfg<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">&gt;</span> rs.status<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;</pre></td></tr></table></div>

<p>設定myset59：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongo 192.168.1.59:<span style="color: #000000;">29018</span><span style="color: #000000; font-weight: bold;">/</span>admin
MongoDB shell version: 1.8.2
connecting to: admin
<span style="color: #000000; font-weight: bold;">&gt;</span> cfg = <span style="color: #7a0874; font-weight: bold;">&#123;</span>
_id : <span style="color: #ff0000;">&quot;myset59&quot;</span>,
members : <span style="color: #7a0874; font-weight: bold;">&#91;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">0</span>, host : <span style="color: #ff0000;">&quot;192.168.1.52:29018&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">1</span>, host : <span style="color: #ff0000;">&quot;192.168.1.59:29018&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">2</span>, host : <span style="color: #ff0000;">&quot;192.168.1.60:29018&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">3</span>, host : <span style="color: #ff0000;">&quot;192.168.1.61:29018&quot;</span>, arbiterOnly: <span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> rs.initiate<span style="color: #7a0874; font-weight: bold;">&#40;</span>cfg<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">&gt;</span> rs.status<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;</pre></td></tr></table></div>

<p>設定myset60：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongo 192.168.1.59:<span style="color: #000000;">29019</span><span style="color: #000000; font-weight: bold;">/</span>admin
MongoDB shell version: 1.8.2
connecting to: admin
<span style="color: #000000; font-weight: bold;">&gt;</span> cfg = <span style="color: #7a0874; font-weight: bold;">&#123;</span>
_id : <span style="color: #ff0000;">&quot;myset60&quot;</span>,
members : <span style="color: #7a0874; font-weight: bold;">&#91;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">0</span>, host : <span style="color: #ff0000;">&quot;192.168.1.52:29019&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">1</span>, host : <span style="color: #ff0000;">&quot;192.168.1.59:29019&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">2</span>, host : <span style="color: #ff0000;">&quot;192.168.1.60:29019&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>,
<span style="color: #7a0874; font-weight: bold;">&#123;</span> _id : <span style="color: #000000;">3</span>, host : <span style="color: #ff0000;">&quot;192.168.1.61:29019&quot;</span>, arbiterOnly: <span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> rs.initiate<span style="color: #7a0874; font-weight: bold;">&#40;</span>cfg<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">&gt;</span> rs.status<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;</pre></td></tr></table></div>

<p>再192.168.1.61啟動 Routing</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mongodb<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongos <span style="color: #660033;">--fork</span> <span style="color: #660033;">--configdb</span> <span style="color: #ff0000;">&quot;192.168.1.52:29020,192.168.1.59:29020,192.168.1.60:29020&quot;</span> <span style="color: #660033;">--chunkSize</span> <span style="color: #000000;">1</span> <span style="color: #660033;">--logpath</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>mongos.log <span style="color: #660033;">--port</span> <span style="color: #000000;">2920</span>
$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mongo 192.168.1.59:<span style="color: #000000;">2920</span><span style="color: #000000; font-weight: bold;">/</span>admin
MongoDB shell version: 1.8.2
connecting to: admin
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> addshard : <span style="color: #ff0000;">&quot;myset52/192.168.1.52:29017,192.168.1.59:29017,192.168.1.60:29017&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># 設定shar</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> addshard : <span style="color: #ff0000;">&quot;myset59/192.168.1.59:29018,192.168.1.52:29018,192.168.1.60:29018&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># 設定shar</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> addshard : <span style="color: #ff0000;">&quot;myset60/192.168.1.60:29019,192.168.1.59:29019,192.168.1.52:29019&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># 設定shar</span>
<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> enablesharding : <span style="color: #ff0000;">&quot;test&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># 開啟shar 的db</span>
<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> shardcollection : <span style="color: #ff0000;">&quot;test.user&quot;</span>, key : <span style="color: #7a0874; font-weight: bold;">&#123;</span>_id : <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;"># 開啟shar 的collection</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> shardcollection : <span style="color: #ff0000;">&quot;test.group&quot;</span>, key : <span style="color: #7a0874; font-weight: bold;">&#123;</span>_id : <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> shardcollection : <span style="color: #ff0000;">&quot;test.name&quot;</span>, key : <span style="color: #7a0874; font-weight: bold;">&#123;</span>_id : <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.runCommand<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> shardcollection : <span style="color: #ff0000;">&quot;test.password&quot;</span>, key : <span style="color: #7a0874; font-weight: bold;">&#123;</span>_id : <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> db.printShardingStatus<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #666666; font-style: italic;">#查看使用狀況</span>
<span style="color: #660033;">---</span> Sharding Status <span style="color: #660033;">---</span> 
  sharding version: <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #000000;">1</span>, <span style="color: #ff0000;">&quot;version&quot;</span> : <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
  shards:
      <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #ff0000;">&quot;myset52&quot;</span>,
	<span style="color: #ff0000;">&quot;host&quot;</span> : <span style="color: #ff0000;">&quot;myset52/192.168.1.52:29017,192.168.1.60:29017,192.168.1.59:29017&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
      <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #ff0000;">&quot;myset59&quot;</span>,
	<span style="color: #ff0000;">&quot;host&quot;</span> : <span style="color: #ff0000;">&quot;myset59/192.168.1.59:29018,192.168.1.60:29018,192.168.1.52:29018&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
      <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #ff0000;">&quot;myset60&quot;</span>,
	<span style="color: #ff0000;">&quot;host&quot;</span> : <span style="color: #ff0000;">&quot;myset60/192.168.1.60:29019,192.168.1.59:29019,192.168.1.52:29019&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
  databases:
	<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #ff0000;">&quot;admin&quot;</span>, <span style="color: #ff0000;">&quot;partitioned&quot;</span> : <span style="color: #c20cb9; font-weight: bold;">false</span>, <span style="color: #ff0000;">&quot;primary&quot;</span> : <span style="color: #ff0000;">&quot;config&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #ff0000;">&quot;test&quot;</span>, <span style="color: #ff0000;">&quot;partitioned&quot;</span> : <span style="color: #c20cb9; font-weight: bold;">true</span>, <span style="color: #ff0000;">&quot;primary&quot;</span> : <span style="color: #ff0000;">&quot;myset52&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
		test.user chunks:
				myset52	<span style="color: #000000;">1</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$minKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$maxKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
		test.group chunks:
				myset52	<span style="color: #000000;">1</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$minKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$maxKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
		test.name chunks:
				myset52	<span style="color: #000000;">5</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$minKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cb7fa61c5b9654a000005&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cb7fa61c5b9654a000005&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cba3461c5b96f4c000002&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">5</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cba3461c5b96f4c000002&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cba487f8b9ac33500000b&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">7</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cba487f8b9ac33500000b&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cbbf37f8b9aa435000005&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">8</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : ObjectId<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;4e4cbbf37f8b9aa435000005&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$maxKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">4</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
		test.password chunks:
				myset52	<span style="color: #000000;">1</span>
			<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$minKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> --<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">$maxKey</span> : <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> on : myset52 <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;t&quot;</span> : <span style="color: #000000;">1000</span>, <span style="color: #ff0000;">&quot;i&quot;</span> : <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #ff0000;">&quot;_id&quot;</span> : <span style="color: #ff0000;">&quot;test&quot;</span>, <span style="color: #ff0000;">&quot;partitioned&quot;</span> : <span style="color: #c20cb9; font-weight: bold;">false</span>, <span style="color: #ff0000;">&quot;primary&quot;</span> : <span style="color: #ff0000;">&quot;myset52&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>

<p>設定完成！！！！<br />
所有程式只需要連接到 192.168.1.61:2920的 Routing<br />
其他動作都不必要.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/471/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MongoDB VS Mysql 簡單測試.</title>
		<link>http://blog.sd.idv.tw/archives/464</link>
		<comments>http://blog.sd.idv.tw/archives/464#comments</comments>
		<pubDate>Wed, 03 Aug 2011 03:46:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP & MYSQL]]></category>
		<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=464</guid>
		<description><![CDATA[廢話不多說. MongoDB 使用 MongoDB Object Document Mapper測試. Mysql 使用 Object Relational Mapper測試. MongoDB部分: config.php 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 [...]]]></description>
			<content:encoded><![CDATA[<p>廢話不多說.<br />
MongoDB 使用 <a href="http://www.doctrine-project.org/projects/mongodb_odm" target="_blank">MongoDB Object Document Mapper</a>測試.<br />
Mysql 使用 <a href="http://www.doctrine-project.org/projects/orm" target="_blank">Object Relational Mapper</a>測試.<br />
<strong>MongoDB部分:</strong><br />
config.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Doctrine\Common\ClassLoader<span style="color: #339933;">,</span>
    Doctrine\Common\Annotations\AnnotationReader<span style="color: #339933;">,</span>
    Doctrine\ODM\MongoDB\Configuration<span style="color: #339933;">,</span>
    Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver<span style="color: #339933;">,</span>
    Doctrine\MongoDB\Connection<span style="color: #339933;">,</span>
    Doctrine\ODM\MongoDB\DocumentManager<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine\Common'</span><span style="color: #339933;">,</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../../lib/vendor/doctrine-common/lib'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine\ODM\MongoDB'</span><span style="color: #339933;">,</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../../lib'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine\MongoDB'</span><span style="color: #339933;">,</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../../lib/vendor/doctrine-mongodb/lib'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Symfony'</span><span style="color: #339933;">,</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../../lib/vendor'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents'</span><span style="color: #339933;">,</span> __DIR__<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Configuration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyDir</span><span style="color: #009900;">&#40;</span>__DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setHydratorDir</span><span style="color: #009900;">&#40;</span>__DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Hydrators'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setHydratorNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Hydrators'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDefaultDB</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'doctrine_odm_sandbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//使用safe模式</span>
<span style="color: #000088;">$con</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Connection<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'safe'</span><span style="color: #339933;">=&gt;</span>true<span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'wtimeoutMS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//使用一般模式</span>
<span style="color: #666666; font-style: italic;">//$con = new Connection('localhost');</span>
&nbsp;
<span style="color: #000088;">$reader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AnnotationReader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDefaultAnnotationNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine\ODM\MongoDB\Mapping\\'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMetadataDriverImpl</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AnnotationDriver<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">,</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Documents'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$dm</span> <span style="color: #339933;">=</span> DocumentManager<span style="color: #339933;">::</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$con</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span id="more-464"></span><br />
測試新增用index.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'config.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> Documents\User<span style="color: #339933;">,</span>
    Documents\Address<span style="color: #339933;">,</span>
    Documents\Phonenumber<span style="color: #339933;">,</span>
    Documents\Account<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Your code here...</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$starttime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$Account</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Account<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$times</span><span style="color: #339933;">=</span><span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$starttime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;saft Inster time <span style="color: #006699; font-weight: bold;">$times</span> <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>測試一般寫入1000筆:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$php</span> index.php
Normal Inster <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000;">14.19290113</span></pre></td></tr></table></div>

<p><strong>測試saft寫入1000筆:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ php index.php
saft Inster <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000;">14.25004005</span></pre></td></tr></table></div>

<p><strong>更新測試index.php:</strong><br />
更新七筆資料．</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'config.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> Documents\User<span style="color: #339933;">,</span>
    Documents\Address<span style="color: #339933;">,</span>
    Documents\Phonenumber<span style="color: #339933;">,</span>
    Documents\Account<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Your code here...</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$starttime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents\Account'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'4e382626e08239cbcf000027'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents\Account'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'4e382626e08239cbcf000026'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents\Account'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'4e382626e08239cbcf000025'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents\Account'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'4e382626e08239cbcf000024'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents\Account'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'4e382626e08239cbcf000023'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents\Account'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'4e382626e08239cbcf000022'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Documents\Account'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'4e382626e08239cbcf000021'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Account_old</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Account_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$times</span><span style="color: #339933;">=</span><span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$starttime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Update time <span style="color: #006699; font-weight: bold;">$times</span> <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></strong>使用apache ab做測試表示每個連線都對此7筆資料做更新.<strong><br />
saft寫入:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ ab <span style="color: #660033;">-k</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">20</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1000</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost<span style="color: #000000; font-weight: bold;">/</span>mongodb_odm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
....
Server Software:        nginx
Server Hostname:        localhost
Server Port:            <span style="color: #000000;">80</span>
&nbsp;
Document Path:          <span style="color: #000000; font-weight: bold;">/</span>mongodb_odm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
Document Length:        <span style="color: #000000;">24</span> bytes
&nbsp;
Concurrency Level:      <span style="color: #000000;">20</span>
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests:   <span style="color: #000000;">15.655</span> seconds
Complete requests:      <span style="color: #000000;">1000</span>
Failed requests:        <span style="color: #000000;">0</span>
Write errors:           <span style="color: #000000;">0</span>
Keep-Alive requests:    <span style="color: #000000;">0</span>
Total transferred:      <span style="color: #000000;">187000</span> bytes
HTML transferred:       <span style="color: #000000;">24000</span> bytes
Requests per second:    <span style="color: #000000;">63.88</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span>
Time per request:       <span style="color: #000000;">313.110</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Time per request:       <span style="color: #000000;">15.655</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Transfer rate:          <span style="color: #000000;">11.66</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received
&nbsp;
Connection Times <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span>
              min  mean<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #000000; font-weight: bold;">/</span>-sd<span style="color: #7a0874; font-weight: bold;">&#93;</span> median   max
Connect:        <span style="color: #000000;">0</span>    <span style="color: #000000;">2</span>   <span style="color: #000000;">9.2</span>      <span style="color: #000000;">0</span>     <span style="color: #000000;">165</span>
Processing:    <span style="color: #000000;">28</span>  <span style="color: #000000;">307</span> <span style="color: #000000;">312.6</span>    <span style="color: #000000;">238</span>    <span style="color: #000000;">3510</span>
Waiting:       <span style="color: #000000;">28</span>  <span style="color: #000000;">306</span> <span style="color: #000000;">312.7</span>    <span style="color: #000000;">236</span>    <span style="color: #000000;">3510</span>
Total:         <span style="color: #000000;">29</span>  <span style="color: #000000;">309</span> <span style="color: #000000;">313.2</span>    <span style="color: #000000;">240</span>    <span style="color: #000000;">3510</span></pre></td></tr></table></div>

<p>saft更新:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ ab <span style="color: #660033;">-k</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">100</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">2000</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost<span style="color: #000000; font-weight: bold;">/</span>mongodb_odm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
........
Server Software:        nginx
Server Hostname:        localhost
Server Port:            <span style="color: #000000;">80</span>
&nbsp;
Document Path:          <span style="color: #000000; font-weight: bold;">/</span>mongodb_odm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
Document Length:        <span style="color: #000000;">24</span> bytes
&nbsp;
Concurrency Level:      <span style="color: #000000;">100</span>
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests:   <span style="color: #000000;">32.222</span> seconds
Complete requests:      <span style="color: #000000;">2000</span>
Failed requests:        <span style="color: #000000;">345</span>
   <span style="color: #7a0874; font-weight: bold;">&#40;</span>Connect: <span style="color: #000000;">0</span>, Receive: <span style="color: #000000;">0</span>, Length: <span style="color: #000000;">345</span>, Exceptions: <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Write errors:           <span style="color: #000000;">0</span>
Keep-Alive requests:    <span style="color: #000000;">0</span>
Total transferred:      <span style="color: #000000;">439550</span> bytes
HTML transferred:       <span style="color: #000000;">113550</span> bytes
Requests per second:    <span style="color: #000000;">62.07</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span>
Time per request:       <span style="color: #000000;">1611.098</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Time per request:       <span style="color: #000000;">16.111</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Transfer rate:          <span style="color: #000000;">13.32</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received
&nbsp;
Connection Times <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span>
              min  mean<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #000000; font-weight: bold;">/</span>-sd<span style="color: #7a0874; font-weight: bold;">&#93;</span> median   max
Connect:        <span style="color: #000000;">0</span>    <span style="color: #000000;">3</span>  <span style="color: #000000;">10.6</span>      <span style="color: #000000;">0</span>     <span style="color: #000000;">101</span>
Processing:   <span style="color: #000000;">502</span> <span style="color: #000000;">1580</span> <span style="color: #000000;">525.6</span>   <span style="color: #000000;">1512</span>   <span style="color: #000000;">10122</span>
Waiting:      <span style="color: #000000;">502</span> <span style="color: #000000;">1579</span> <span style="color: #000000;">525.5</span>   <span style="color: #000000;">1512</span>   <span style="color: #000000;">10122</span>
Total:        <span style="color: #000000;">504</span> <span style="color: #000000;">1583</span> <span style="color: #000000;">525.7</span>   <span style="color: #000000;">1515</span>   <span style="color: #000000;">10122</span></pre></td></tr></table></div>

<p>saft暴力更新:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ ab <span style="color: #660033;">-k</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">100</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">2000</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost<span style="color: #000000; font-weight: bold;">/</span>mongodb_odm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
........
Server Software:        nginx
Server Hostname:        localhost
Server Port:            <span style="color: #000000;">80</span>
&nbsp;
Document Path:          <span style="color: #000000; font-weight: bold;">/</span>mongodb_odm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
Document Length:        <span style="color: #000000;">24</span> bytes
&nbsp;
Concurrency Level:      <span style="color: #000000;">200</span>
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests:   <span style="color: #000000;">166.432</span> seconds
Complete requests:      <span style="color: #000000;">10000</span>
Failed requests:        <span style="color: #000000;">2029</span>
   <span style="color: #7a0874; font-weight: bold;">&#40;</span>Connect: <span style="color: #000000;">0</span>, Receive: <span style="color: #000000;">0</span>, Length: <span style="color: #000000;">2029</span>, Exceptions: <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Write errors:           <span style="color: #000000;">0</span>
Keep-Alive requests:    <span style="color: #000000;">0</span>
Total transferred:      <span style="color: #000000;">2254187</span> bytes
HTML transferred:       <span style="color: #000000;">624187</span> bytes
Requests per second:    <span style="color: #000000;">60.08</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span>
Time per request:       <span style="color: #000000;">3328.646</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Time per request:       <span style="color: #000000;">16.643</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Transfer rate:          <span style="color: #000000;">13.23</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received
&nbsp;
Connection Times <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span>
              min  mean<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #000000; font-weight: bold;">/</span>-sd<span style="color: #7a0874; font-weight: bold;">&#93;</span> median   max
Connect:        <span style="color: #000000;">0</span>    <span style="color: #000000;">8</span>  <span style="color: #000000;">42.5</span>      <span style="color: #000000;">0</span>     <span style="color: #000000;">472</span>
Processing:   <span style="color: #000000;">471</span> <span style="color: #000000;">3295</span> <span style="color: #000000;">693.5</span>   <span style="color: #000000;">3211</span>   <span style="color: #000000;">17451</span>
Waiting:      <span style="color: #000000;">471</span> <span style="color: #000000;">3292</span> <span style="color: #000000;">693.4</span>   <span style="color: #000000;">3208</span>   <span style="color: #000000;">17451</span>
Total:        <span style="color: #000000;">475</span> <span style="color: #000000;">3303</span> <span style="color: #000000;">687.6</span>   <span style="color: #000000;">3216</span>   <span style="color: #000000;">17451</span></pre></td></tr></table></div>

<p>Mysql部分:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Create EntityManager</span>
<span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> EntityManager<span style="color: #339933;">::</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connectionOptions</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## PUT YOUR TEST CODE BELOW
</span><span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$starttime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #339933;">;</span>
	<span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test Account'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99999</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$times</span><span style="color: #339933;">=</span><span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$starttime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Inster time <span style="color: #006699; font-weight: bold;">$times</span> <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>新增測試:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ ab <span style="color: #660033;">-k</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">20</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1000</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost<span style="color: #000000; font-weight: bold;">/</span>doctrine2-orm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
........
Server Software:        nginx
Server Hostname:        localhost
Server Port:            <span style="color: #000000;">80</span>
&nbsp;
Document Path:          <span style="color: #000000; font-weight: bold;">/</span>doctrine2-orm<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>
Document Length:        <span style="color: #000000;">24</span> bytes
&nbsp;
Concurrency Level:      <span style="color: #000000;">20</span>
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests:   <span style="color: #000000;">30.952</span> seconds
Complete requests:      <span style="color: #000000;">1000</span>
Failed requests:        <span style="color: #000000;">0</span>
Write errors:           <span style="color: #000000;">0</span>
Keep-Alive requests:    <span style="color: #000000;">0</span>
Total transferred:      <span style="color: #000000;">187000</span> bytes
HTML transferred:       <span style="color: #000000;">24000</span> bytes
Requests per second:    <span style="color: #000000;">32.31</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span>
Time per request:       <span style="color: #000000;">619.045</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Time per request:       <span style="color: #000000;">30.952</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Transfer rate:          <span style="color: #000000;">5.90</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received
&nbsp;
Connection Times <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span>
              min  mean<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #000000; font-weight: bold;">/</span>-sd<span style="color: #7a0874; font-weight: bold;">&#93;</span> median   max
Connect:        <span style="color: #000000;">0</span>    <span style="color: #000000;">1</span>   <span style="color: #000000;">1.6</span>      <span style="color: #000000;">0</span>      <span style="color: #000000;">21</span>
Processing:    <span style="color: #000000;">62</span>  <span style="color: #000000;">617</span> <span style="color: #000000;">247.8</span>    <span style="color: #000000;">576</span>    <span style="color: #000000;">2659</span>
Waiting:       <span style="color: #000000;">62</span>  <span style="color: #000000;">617</span> <span style="color: #000000;">247.8</span>    <span style="color: #000000;">576</span>    <span style="color: #000000;">2659</span>
Total:         <span style="color: #000000;">62</span>  <span style="color: #000000;">617</span> <span style="color: #000000;">248.0</span>    <span style="color: #000000;">577</span>    <span style="color: #000000;">2665</span></pre></td></tr></table></div>

<p>對不起我很懶&#8230; mysql新增部分就輸一倍了.<br />
接下去就不測了．</p>
<p>結論:NoSQL粉快<br />
看一下mongodb的log<br />
Wed Aug  3 01:04:30 [conn12232] update doctrine_odm_sandbox.accounts  query: { _id: ObjectId(&#8217;4e382626e08239cbcf000022&#8242;) } byid  142ms<br />
Wed Aug  3 01:04:27 [conn12035] update doctrine_odm_sandbox.accounts  query: { _id: ObjectId(&#8217;4e382626e08239cbcf000023&#8242;) } byid  629ms<br />
這竟然是slow query!!!!!! WTF</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/464/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lua for PHP 實測</title>
		<link>http://blog.sd.idv.tw/archives/460</link>
		<comments>http://blog.sd.idv.tw/archives/460#comments</comments>
		<pubDate>Tue, 02 Aug 2011 01:58:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Lua]]></category>
		<category><![CDATA[PHP & MYSQL]]></category>

		<guid isPermaLink="false">http://blog.sd.idv.tw/?p=460</guid>
		<description><![CDATA[繼上一篇 Lua for PHP 安裝,現在來是實測Lua 速度. 素聞Lua 執行效能速度之優異不論是陣列字串運算處理皆在PHP之上,這篇先主要針對Array做實測. index.php 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 &#60;?php $array_a = array&#40;&#41;; for&#40;$i=1; $i&#60;100000; $i++&#41; &#123; $array_a&#91;$i&#93;= rand&#40;1,9999&#41;; &#125; //新增Lua物件 並載入test.lua $lua=new [...]]]></description>
			<content:encoded><![CDATA[<p>繼上一篇 <a href="http://blog.sd.idv.tw/archives/430" target="_blank">Lua for PHP 安裝</a>,現在來是實測Lua 速度.<br />
素聞Lua 執行效能速度之優異不論是陣列字串運算處理皆在PHP之上,這篇先主要針對Array做實測.<br />
index.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$array_a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">100000</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$array_a</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9999</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//新增Lua物件 並載入test.lua</span>
<span style="color: #000088;">$lua</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> plua<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test.lua'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//複製一個陣列並丟到Lua 物件內</span>
<span style="color: #000088;">$array_b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$array_a</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lua</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">array_b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$array_b</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//測試PHP物件排序效能</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$starttime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//var_dump($array_a);</span>
<span style="color: #990000;">rsort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$array_a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//var_dump($array_a);</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$times</span><span style="color: #339933;">=</span><span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$starttime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//顯示PHP執行結果所需時間</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;PHP rsort time <span style="color: #006699; font-weight: bold;">$times</span> <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$starttime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//var_dump($array_b);</span>
<span style="color: #666666; font-style: italic;">//測試Lua物件排序效能</span>
<span style="color: #000088;">$array_b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$lua</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">test</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//var_dump($array_b);</span>
<span style="color: #000088;">$mtime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$times</span><span style="color: #339933;">=</span><span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$mtime</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$starttime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//顯示Lua執行結果所需時間</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Lua array sort time <span style="color: #006699; font-weight: bold;">$times</span> <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>test.lua</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="txt" style="font-family:monospace;">function test()
    table.sort( array_b )
	return array_b
end</pre></td></tr></table></div>

<p><span id="more-460"></span><br />
執行中之所以用如此大陣列才能有效顯示其優勢.<br />
(畢竟PHP還需要傳送陣列到Lua,如果太小光傳送過去都比運算陣列時間長）<br />
執行結果:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="txt" style="font-family:monospace;">PHP rsort time 0.24731302 
Lua array sort time 0.17132020</pre></td></tr></table></div>

<p>此範例只是針對陣列做簡單處理運算,試想如果你所需要處理資料複雜且繁瑣.<br />
交給Lua處理,不失為對php做加速的處理.<br />
剩下發揮交給你啦！！<br />
byby~</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sd.idv.tw/archives/460/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

