git clone https://github.com/notarisj/raft.git
cd raft
Generate the distribution package (optional)
python3 setup.py sdist
Install (optional, if you download the distribution package)
pip install dist/raft*.tar.gz
Before running the application, you need to update the config.ini file. You may
generate a certificate and key (see command bellow), or use the ones provided, and also update the paths for the
properties ssl_cert_file
and ssl_key_file
in the configuration file. You can also change the API credentials
and MongoDB settings here.
You can start the server using the run_server.sh bash script. This script takes some
optional arguments for configuration. If no parameters are provided,
the script will use the default configuration from the config.ini
and servers.json file. Note that if you want to test it in the same machine, you
need to pass --server_id
and --mongo_collection_name
arguments for each node as seen in the example usage bellow.
Install mongodb (if not installed)
./help_scripts/install_mongodb.sh
./help_scripts/run_raft_server.sh [options]
The directory_path
is the path to the directory of the project. You can use .
if
you are in the root directory of the project as follows:
./help_scripts/run_raft_server.sh --server_id 1 --mongo_collection_name raft1
--server_id <server_id>
--uvicorn_host <uvicorn_host>
--uvicorn_port <uvicorn_port>
--mongo_host <mongo_host>
--mongo_port <mongo_port>
--mongo_db_name <mongo_db_name>
--mongo_collection_name <mongo_collection_name>
Please refer to the run_server.sh script for more details.
./help_scripts/run_kv_server.sh [options]
./help_scripts/run_kv_server.sh --server_id 1 --replication_factor 2
--server_id <server_id>
--replication_factor <replication_factor>
With the raft and key value store servers running, you can use the command line interfaces to start the cluster and start interacting with the store.
./help_scripts/run_raft_cli.sh
For more information see Raft CLI
./help_scripts/run_kv_cli.sh
For more information see Key Value Store CLI
To run the tests execute the following command:
./help_scripts/run_tests.sh
openssl req -newkey rsa:2048 -nodes -keyout private_key.pem -x509 -days 365 -out certificate.pem -subj "/CN=localhost" -addext "subjectAltName = IP:127.0.0.1, DNS:localhost"
This project is licensed under the MIT License - see the LICENSE.md file for details.