Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Implementation of distributed election algorithms.

NotificationsYou must be signed in to change notification settings

matt-merman/SDCC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code SmellsMaintainability Rating

Specification

The aim is to implement two election distributed algorithms (i.e.Chang and Roberts algorithm,Bully algorithm). Furthermore, the following services must be implemented:

  • Register service;
  • Heartbeat monitoring service;
  • Logging information service;

To deploy the application should be usedDocker containers onEC2 instance.

Running

For the local execution are requiredDocker andDocker Compose. Furthermore, arequirements.txt file has been defined to install all the python external libraries:

# to execute in SDCC/sdcc/pip install -r requirements.txt

Local without Docker Containers

The complete list of flags is:

$ python3 run.py -h                                                     usage: run.py [-h] [-v] [-d] [-a {ring,bully}] [-c CONFIG_FILE]  Implementation of distributed election algorithms. Generic node.  optional arguments:       -h, --help            show thishelp message andexit       -v, --verbose         increase output verbosity       -d, --delay           generate a random delay to forwarding messages       -a {ring,bully}, --algorithm {ring,bully}                                                     ring by default       -c CONFIG_FILE, --config_file CONFIG_FILE                            needed a config filein json format

Thelocal_config.json (inSDCC/sdcc) file has been defined to manage all network settings (i.e., IP addresses, port numbers). To display the options set:

python3 run.py -h

Firstly you make running the register node:

# to execute in SDCC/sdcc/register. The -v flag provides a verbose execution (i.e., all messages received and sent are shown)python3 run.py -v -c ../local_config.json

A single node can be executed as:

# to execute in SDCC/sdcc/node. Without the '-a bully' option node runs the ring-based alg.python3 run.py -v -a bully -c ../local_config.json

Tests

Test execution can be handled as:

# to execute in SDCC/sdccsudopython3run_tests.py

AWS EC2 instance with Docker Containers

Ansible service is used to automate the Docker installation and to copy the application code.

# To check the ec2 instance (optional)ansible -i hosts.ini -m ping all# To execute ansible in SDCC/sdcc/ansibleansible-playbook -v -i hosts.ini deploy.yaml# Connect to the EC2 instancessh -i"SDCC_key.pem" ubuntu@ip_instance# To execute the whole applicationsudo docker-compose up

Implementation

Please seereport for more details.


[8]ページ先頭

©2009-2025 Movatter.jp