「FoundationDB」:修訂間差異
跳至導覽
跳至搜尋
(未顯示同一使用者於中間所作的 4 次修訂) | |||
第3行: | 第3行: | ||
== 安裝 == | == 安裝 == | ||
在[[Ubuntu]]下可以使用官方打包好的deb安 | 在[[Ubuntu]]下可以使用官方打包好的deb安裝7.1版: | ||
<syntaxhighlight lang="bash"> | |||
cd /tmp; wget -c https://github.com/apple/foundationdb/releases/download/7.1.65/foundationdb-clients_7.1.65-1_amd64.deb; sudo dpkg -i foundationdb-clients_7.1.65-1_amd64.deb; wget -c https://github.com/apple/foundationdb/releases/download/7.1.65/foundationdb-server_7.1.65-1_amd64.deb; sudo dpkg -i foundationdb-server_7.1.65-1_amd64.deb | |||
</syntaxhighlight> | |||
也可以安裝7.3版,但我無法跑起cluster模式: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
第10行: | 第16行: | ||
== 設定 == | == 設定 == | ||
=== Cluster === | |||
這邊假設有三台機器,先把FoundationDB跑在Public Interface上(預設會跑在<code>127.0.0.1</code>上): | |||
<syntaxhighlight lang="bash"> | |||
sudo python3 /usr/lib/foundationdb/make_public.py | |||
sudo service foundationdb restart | |||
</syntaxhighlight> | |||
然後修改<code>/etc/foundationdb/fdb.cluster</code>檔案,把第一個檔案複製到其他兩個,然後重啟: | |||
<syntaxhighlight lang="bash"> | |||
echo "username:password@192.168.1.1:4500" | sudo tee /etc/foundationdb/fdb.cluster | |||
sudo service foundationdb restart | |||
</syntaxhighlight> | |||
接著進入fdbcli設定成SSD: | |||
<syntaxhighlight lang="text"> | |||
configure perpetual_storage_wiggle=1 storage_migration_type=gradual | |||
configure ssd | |||
</syntaxhighlight> | |||
然後將Redundancy mode設定成<code>double</code>(可以是<code>single</code>或是<code>triple</code>): | |||
<syntaxhighlight lang="text"> | |||
configure double | |||
</syntaxhighlight> | |||
最後設定coordinators: | |||
<syntaxhighlight lang="text"> | |||
coordinators 192.168.1.1:4500 192.168.1.2:4500 192.168.1.3:4500 | |||
</syntaxhighlight> | |||
結束後可以用<code>status</code>指令看cluster的狀態。 | |||
== 測試 == | == 測試 == | ||
第23行: | 第66行: | ||
<syntaxhighlight lang="sql"> | <syntaxhighlight lang="sql"> | ||
writemode on | writemode on | ||
</syntaxhighlight> | |||
接著可以進行操作: | |||
<syntaxhighlight lang="sql"> | |||
get a/b/c | |||
set a/b/c foo | |||
get a/b/c | |||
clear a/b/c | |||
get a/b/c | |||
</syntaxhighlight> | </syntaxhighlight> | ||
於 2024年12月23日 (一) 17:43 的最新修訂
FoundationDB是Apple維護的NoSQL資料庫。
安裝
在Ubuntu下可以使用官方打包好的deb安裝7.1版:
cd /tmp; wget -c https://github.com/apple/foundationdb/releases/download/7.1.65/foundationdb-clients_7.1.65-1_amd64.deb; sudo dpkg -i foundationdb-clients_7.1.65-1_amd64.deb; wget -c https://github.com/apple/foundationdb/releases/download/7.1.65/foundationdb-server_7.1.65-1_amd64.deb; sudo dpkg -i foundationdb-server_7.1.65-1_amd64.deb
也可以安裝7.3版,但我無法跑起cluster模式:
cd /tmp; wget -c https://github.com/apple/foundationdb/releases/download/7.3.43/foundationdb-clients_7.3.43-1_amd64.deb; sudo dpkg -i foundationdb-clients_7.3.43-1_amd64.deb; wget -c https://github.com/apple/foundationdb/releases/download/7.3.43/foundationdb-server_7.3.43-1_amd64.deb; sudo dpkg -i foundationdb-server_7.3.43-1_amd64.deb
設定
Cluster
這邊假設有三台機器,先把FoundationDB跑在Public Interface上(預設會跑在127.0.0.1
上):
sudo python3 /usr/lib/foundationdb/make_public.py
sudo service foundationdb restart
然後修改/etc/foundationdb/fdb.cluster
檔案,把第一個檔案複製到其他兩個,然後重啟:
echo "username:password@192.168.1.1:4500" | sudo tee /etc/foundationdb/fdb.cluster
sudo service foundationdb restart
接著進入fdbcli設定成SSD:
configure perpetual_storage_wiggle=1 storage_migration_type=gradual
configure ssd
然後將Redundancy mode設定成double
(可以是single
或是triple
):
configure double
最後設定coordinators:
coordinators 192.168.1.1:4500 192.168.1.2:4500 192.168.1.3:4500
結束後可以用status
指令看cluster的狀態。
測試
先進入CLI介面:
fdbcli
在CLI的預設是唯獨模式,透過指令允許送出寫入操作:
writemode on
接著可以進行操作:
get a/b/c
set a/b/c foo
get a/b/c
clear a/b/c
get a/b/c