FoundationDB Installation
In this guideline, I will set up a Foundation DB cluster on 3 physical machines. They are all using debian OS. I refer to two official guidelines here Getting Started on Linux and Building a Cluster.
Firstly, we need to download the binary for the installation in here. We need to download the server, monitor and cli binaries, and those corresponding sha256 checksum files. I will choose version 7.1.25 as it is the latest at the time.\
In your directory, let's create a folder foundationdb
.\
Then, create a subfolder bin
inside foundationdb
. \
In this foundationdb/bin
folder, download with the following command:
curl -L -o fdbserver.x86_64 https://github.com/apple/foundationdb/releases/download/7.1.25/fdbserver.x86_64
curl -L -o fdbserver.x86_64.sha256 https://github.com/apple/foundationdb/releases/download/7.1.25/fdbserver.x86_64.sha256
curl -L -o fdbmonitor.x86_64 https://github.com/apple/foundationdb/releases/download/7.1.25/fdbmonitor.x86_64
curl -L -o fdbmonitor.x86_64.sha256 https://github.com/apple/foundationdb/releases/download/7.1.25/fdbmonitor.x86_64.sha256
curl -L -o fdbcli.x86_64 https://github.com/apple/foundationdb/releases/download/7.1.25/fdbcli.x86_64
curl -L -o fdbcli.x86_64.sha256 https://github.com/apple/foundationdb/releases/download/7.1.25/fdbcli.x86_64.sha256
After the download is completed, let's do the checksum check on the executable files to see if the downloads are good. The two checksums should be equal. For example:
$ sha256sum --binary fdbserver.x86_64
73b70a75464e64fd0a01a7536e110e31c3e6ce793d425aecfc40f0be9f0652b7 *fdbserver.x86_64
$ cat fdbserver.x86_64.sha256
73b70a75464e64fd0a01a7536e110e31c3e6ce793d425aecfc40f0be9f0652b7 fdbserver.x86_64
Next we will delete those sha256 checksum file because we don't need them anymore, we'll also rename the executable file to remove the trailing x86_64
and give them executable permission.
rm *.sha256
mv fdbcli.x86_64 fdbcli
mv fdbmonitor.x86_64 fdbmonitor
mv fdbserver.x86_64 fdbserver
chmod ug+x fdbcli fdbmonitor fdbserver
Next we will create some folder to store the config, data and log:
mkdir -p /<your_directory>/fdb_runtime/config
mkdir -p /<your_directory>/fdb_runtime/data
mkdir -p /<your_directory>/fdb_runtime/logs
Then we create the foundationdb.conf
config file in /<your_directory>/fdb_runtime/config/
with content like this
$ cat /<your_directory>/fdb_runtime/config/foundationdb.conf
[fdbmonitor]
user = root
[general]
cluster-file = /<your_directory>/fdb_runtime/config/fdb.cluster
restart-delay = 60
[fdbserver]
command = /<your_directory>/foundationdb/bin/fdbserver
datadir = /<your_directory>/fdb_runtime/data/$ID
logdir = /<your_directory>/fdb_runtime/logs/
public-address = auto:$ID
listen-address = public
[fdbserver.4500]
class=stateless
[fdbserver.4501]
class=transaction
[fdbserver.4502]
class=storage
[fdbserver.4503]
class=stateless
Then in the same directory create file fdb.cluster
with content like this, change the ip to the ip of your machine
$ cat /<your_directory>/fdb_runtime/config/fdb.cluster
clusterdsc:test@<your_ip_address>:4500
We will install FDB as a systemd
service. So, in the same folder we will create file fdb.service
with content like this
$ cat /<your_directory>/fdb_runtime/config/fdb.service
[Unit]
Description=FoundationDB (KV storage for cnch metastore)
[Service]
Restart=always
RestartSec=30
TimeoutStopSec=600
ExecStart=/<your_directory>/foundationdb/bin/fdbmonitor --conffile /<your_directory>/fdb_runtime/config/foundationdb.conf --lockfile /<your_directory>/fdb_runtime/fdbmonitor.pid
[Install]
WantedBy=multi-user.target
We have finished preparing the config file. Now let's install fdb into systemd
Copy the service file into /etc/systemd/system/
cp fdb.service /etc/systemd/system/
Reload the service files to include the new service
systemctl daemon-reload
Enable and start the service
systemctl enable fdb.service
systemctl start fdb.service
Check the service and see that it is active
$ systemctl status fdb.service
● fdb.service - FoundationDB (KV storage for cnch metastore)
Loaded: loaded (/etc/systemd/system/fdb.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2023-01-17 18:35:42 CST; 20s ago
Now I have install fdb service in 1 machine, I will repeat the same for the other 2 machines
After it's installed on all 3 machines, we need to connect them to form a cluster. Now go back to the first node, connect to FDB using fdbcli
$ ./foundationdb/bin/fdbcli -C fdb_runtime/config/fdb.cluster
Using cluster file `fdb_runtime/config/fdb.cluster'.
The database is unavailable; type `status' for more information.
Welcome to the fdbcli. For help, type `help'.
fdb>
execute this to init a database
configure new single ssd
Next, set all three nodes as coordinators, replace the address with your machine address
coordinators <node_1_ip_address>:4500 <node_2_ip_address>:4500 <node_3_ip_address>:4500
Then exit the cli, you will found that the fdb.cluster
now have a new content
$ cat fdb_runtime/config/fdb.cluster
# DO NOT EDIT!
# This file is auto-generated, it is not to be edited by hand
clusterdsc:wwxVEcyLvSiO3BGKxjIw7Sg5d1UTX5ad@example1.host.com:4500,example2.host.com:4500,example3.host.com:4500
Copy this file to other 2 machines and replace the old file then restart fdb service
systemctl restart fdb.service
Then come back to the first machine, connect to FDB using fdbcli again and execute this command to change redundant mode to double
configure double
Then execute the status
command with fdbcli
to see the result, you should see something like this
fdb> status
Using cluster file `fdb_runtime/config/fdb.cluster'.
Configuration:
Redundancy mode - double
Storage engine - ssd-2
Coordinators - 3
Usable Regions - 1
That's it. You've finished installing Foundationdb server. Now you have the fdb.cluster
file. We will use it in Byconity's configuration.