Grab the client and server packages from the FoundationDB website
ansible -i inventory digital_ocean -a "wget https://foundationdb.com/downloads/f-nbxofdxnoxocd/I_accept_the_FoundationDB_Community_License_Agreement/key-value-store/2.0.9/foundationdb-clients_2.0.9-1_amd64.deb https://foundationdb.com/downloads/f-nbxofdxnoxocd/I_accept_the_FoundationDB_Community_License_Agreement/key-value-store/2.0.9/foundationdb-server_2.0.9-1_amd64.deb"
Install the client and server packages
ansible -i inventory digital_ocean -a "sudo dpkg -i foundationdb-clients_2.0.9-1_amd64.deb foundationdb-server_2.0.9-1_amd64.deb"
Run the included make_public script, which uses the machine's interfaces to find the public IP address
ansible -i inventory digital_ocean -a "python /usr/lib/foundationdb/make_public.py"
Grab the cluster file from one of the machines
scp [email protected]:/etc/foundationdb/fdb.cluster .
Stop the service
ansible -i inventory digital_ocean -a "service foundationdb stop"
Copy the cluster file up to all the machines, joining them into a single cluster
ansible -i inventory digital_ocean -m copy -a "src=fdb.cluster dest=/etc/foundationdb/fdb.cluster" --sudo
Start the service
ansible -i inventory digital_ocean -a "service foundationdb start"
Setup triple replication
ssh [email protected] "fdbcli --exec 'configure triple'"
Automatically configure coordinators (used for fault-tolerance)
ssh [email protected] "fdbcli --exec 'coordinators auto'"
Check the status
ssh [email protected] "fdbcli --exec 'status details'"
Grab the client and server packages from the FoundationDB website
ansible -i inventory aws -a "wget https://foundationdb.com/downloads/f-nbxofdxnoxocd/I_accept_the_FoundationDB_Community_License_Agreement/key-value-store/2.0.9/foundationdb-clients_2.0.9-1_amd64.deb https://foundationdb.com/downloads/f-nbxofdxnoxocd/I_accept_the_FoundationDB_Community_License_Agreement/key-value-store/2.0.9/foundationdb-server_2.0.9-1_amd64.deb"
Install the client and server packages
ansible -i inventory aws -a "sudo dpkg -i foundationdb-clients_2.0.9-1_amd64.deb foundationdb-server_2.0.9-1_amd64.deb"
Stop the service
ansible -i inventory aws -a "sudo service foundationdb stop"
I need to modify the public and listen address in the configuration files. Unfortunately aws machines doesn't have access to this information internally, so I'm using the meta-data url to grab it.
ansible -i inventory aws -m shell -a 'public_ip=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) ; sudo sed -i "s/auto/$public_ip/" /etc/foundationdb/foundationdb.conf'
ansible -i inventory aws -m shell -a 'private_ip=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) ; sudo sed -i "s/listen_address = public/listen_address = $private_ip:\\$ID/" /etc/foundationdb/foundationdb.conf'
Take a look at the configuration file
ssh [email protected] "sudo cat /etc/foundationdb/foundationdb.conf"
Grab the cluster file from one of the machines
scp [email protected]:/etc/foundationdb/fdb.cluster .
Copy the cluster file up to all the machines, joining them into a single cluster
ansible -i inventory aws -m copy -a "src=fdb.cluster dest=/etc/foundationdb/fdb.cluster" --sudo
Start the process
ansible -i inventory aws -a "sudo service foundationdb start"
Check the status: now you'll see 10 machines!
ssh [email protected] "fdbcli --exec 'status details'"
Exclude the Digital Ocean machines
ssh [email protected] "fdbcli --exec 'exclude 104.236.38.62 104.236.32.172 104.236.26.156 104.236.26.157 104.236.26.158'"
The Key-Value Store uses coordinators to maximize the fault tolerance of the cluster. Now that we've excluded the digital ocean machines, let's tell the database to choose new coordinators.
ssh [email protected] "fdbcli --exec 'coordinators auto'"
And let's take a look at the status again.
ssh [email protected] "fdbcli --exec 'status details'"
Now I can shutdown the digital ocean servers:
ansible -i inventory digital_ocean -a "sudo shutdown now"