https://github.com/stepchowfun/paxos
An implementation of single-decree Paxos.
https://github.com/stepchowfun/paxos
paxos rust
Last synced: 3 months ago
JSON representation
An implementation of single-decree Paxos.
- Host: GitHub
- URL: https://github.com/stepchowfun/paxos
- Owner: stepchowfun
- License: other
- Created: 2019-03-15T05:39:50.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-09-06T05:16:23.000Z (about 1 year ago)
- Last Synced: 2024-10-11T21:48:55.021Z (about 1 year ago)
- Topics: paxos, rust
- Language: Rust
- Homepage:
- Size: 296 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Paxos
[](https://github.com/stepchowfun/paxos/actions?query=branch%3Amain)
This is a reference implementation of single-decree Paxos.
## Configuration
By default, the program looks for a configuration file named `config.yml` in the working directory. This file describes the cluster membership. An [example configuration](https://github.com/stepchowfun/paxos/blob/main/config.yml) is provided in this repository.
## Usage
For a simple demonstration, run the following commands from separate terminals in the repository root:
```sh
paxos --node 0 --propose foo
paxos --node 1 --propose bar
paxos --node 2 --propose baz
```The cluster will likely achieve consensus immediately after two of the three nodes have been started. The chosen value will be printed to STDOUT by each node in the cluster.
Here are the full usage instructions:
```
USAGE:
paxos --nodeOPTIONS:
-c, --config-file
Sets the path of the config file (default: config.yml)-d, --data-dir
Sets the path of the directory in which to store persistent data (default: data)-h, --help
Prints help information-i, --ip
Sets the IP address to run on (if different from the configuration)-n, --node
Sets the index of the node corresponding to this instance-p, --port
Sets the port to run on (if different from the configuration)-v, --propose
Proposes a value to the cluster-V, --version
Prints version information
```## Installation instructions
### Installation on macOS or Linux (AArch64 or x86-64)
If you're running macOS or Linux (AArch64 or x86-64), you can install Paxos with this command:
```sh
curl https://raw.githubusercontent.com/stepchowfun/paxos/main/install.sh -LSfs | sh
```The same command can be used again to update to the latest version.
The installation script supports the following optional environment variables:
- `VERSION=x.y.z` (defaults to the latest version)
- `PREFIX=/path/to/install` (defaults to `/usr/local/bin`)For example, the following will install Paxos into the working directory:
```sh
curl https://raw.githubusercontent.com/stepchowfun/paxos/main/install.sh -LSfs | PREFIX=. sh
```If you prefer not to use this installation method, you can download the binary from the [releases page](https://github.com/stepchowfun/paxos/releases), make it executable (e.g., with `chmod`), and place it in some directory in your [`PATH`](https://en.wikipedia.org/wiki/PATH_\(variable\)) (e.g., `/usr/local/bin`).
### Installation on Windows (AArch64 or x86-64)
If you're running Windows (AArch64 or x86-64), download the latest binary from the [releases page](https://github.com/stepchowfun/paxos/releases) and rename it to `paxos` (or `paxos.exe` if you have file extensions visible). Create a directory called `Paxos` in your `%PROGRAMFILES%` directory (e.g., `C:\Program Files\Paxos`), and place the renamed binary in there. Then, in the "Advanced" tab of the "System Properties" section of Control Panel, click on "Environment Variables..." and add the full path to the new `Paxos` directory to the `PATH` variable under "System variables". Note that the `Program Files` directory might have a different name if Windows is configured for a language other than English.
To update an existing installation, simply replace the existing binary.
## References
The Paxos algorithm was first described in [1].
1. Leslie Lamport. 1998. The part-time parliament. ACM Trans. Comput. Syst. 16, 2 (May 1998), 133-169. DOI: https://doi.org/10.1145/279227.279229