{"id":28024805,"url":"https://github.com/luaannguyen/dht-application","last_synced_at":"2026-03-01T02:33:20.374Z","repository":{"id":291373995,"uuid":"947448362","full_name":"LuaanNguyen/DHT-application","owner":"LuaanNguyen","description":"CSE434: An application program for processes to communicate using sockets from a distributed hash table (DHT)","archived":false,"fork":false,"pushed_at":"2025-05-04T07:34:58.000Z","size":2740,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-23T03:40:02.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LuaanNguyen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-12T17:47:10.000Z","updated_at":"2025-05-21T23:42:04.000Z","dependencies_parsed_at":"2025-05-11T02:41:44.828Z","dependency_job_id":null,"html_url":"https://github.com/LuaanNguyen/DHT-application","commit_stats":null,"previous_names":["luaannguyen/dht-application"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LuaanNguyen/DHT-application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2FDHT-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2FDHT-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2FDHT-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2FDHT-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuaanNguyen","download_url":"https://codeload.github.com/LuaanNguyen/DHT-application/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2FDHT-application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29959118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-11T02:37:28.129Z","updated_at":"2026-03-01T02:33:20.353Z","avatar_url":"https://github.com/LuaanNguyen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSE434 Socket Programming Project: DHT Application\n\n## Project Overview 🌟\n\nThis project implements a Distributed Hash Table (DHT) system for storing and querying weather event data from NOAA's storm events database. The system consists of a central DHT Manager and multiple Peer nodes that form a ring topology for distributed data storage and retrieval.\n\n## Filestone Submissions 📑\n\n📌 Documentation: [Documentation](https://docs.google.com/document/d/1zdzy2W98iVG3k-rULQHCNX07EMCQG1knNZorXkv003U/edit?tab=t.0)  \n📌 Design Doc: [CSE434: Socket Project MileStone](https://docs.google.com/document/d/1zIXYn8LTUxaovb8iLyP6x7aYPeaWQDtc4o6muHAUQH4/edit?tab=t.0#heading=h.mz71e5s6w1lg)  \n📌 Time-space Diagram: [Time-space Diagram](https://docs.google.com/presentation/d/1ufCHWC4uRkZ89WrBdrQZOXyu7C4mGx7TVxSi8UaxVyE/edit#slide=id.p)  \n📌 Video Demo: [YouTube](https://youtu.be/R7nA6OKfetA)\n\n## Final Submissions 📑\n\n📌 Design Doc + Documentation: [CSE434: Socket Project Full](https://docs.google.com/document/d/1zIXYn8LTUxaovb8iLyP6x7aYPeaWQDtc4o6muHAUQH4/edit?tab=t.0#heading=h.mz71e5s6w1lg)  \n📌 Video Demo: [YouTube](https://youtu.be/S33Fj8oY_DY)\n📌 Github Commits: [Drive](https://drive.google.com/drive/folders/1nBXxDEpthWZ75lvFwhI2Rk8nTgeHF7kl)\n\n## Architecture ⚙️\n\n- Written in `Python`\n- Communication via UDP sockets\n- Ring-based DHT topology\n- Data distribution using consistent hashing\n- Version Control: `git` + `github`\n- Dependencies: check `requirements.txt`\n\n![Architecture](architecture.png)\n\n💽 Storm Event Database: [NOAA's storm events database](https://www.ncdc.noaa.gov/stormevents/)\n\n## Reproduce Demo \u0026 Run the Program 🎯\n\nThis section provides step-by-step instructions to reproduce the DHT application demo as shown in the video. Follow these steps in order:\n\n## Prerequisites\n\nMake sure you have [Python](https://www.python.org/downloads/) and [pip](https://pip.pypa.io/en/stable/installation/) installed on your local machine.\n\n- Access to 4 distinct end-hosts (we use AWS EC2 instances)\n- Python 3.x installed on all machines\n- Git installed on all machines\n\n## Step 1: Setup Environment\n\nOn each end-host:\n\n```bash\n# SSH into your EC2 Instance\nssh -i \u003cyour_pem_key\u003e ubuntu@\u003cyour_EC2_public_IP\u003e\nchmod 400 ./.ssh/\u003cyour_generated_key\u003e.pem # allow ssh permission\n\n\n# Setup Python environment\nsudo apt update\nsudo apt install -y python3 python3-pip git nano vim\n\n# Clone the repository (Need PAT token genrated from Github)\ngit clone https://github.com/LuaanNguyen/DHT-application.git\ncd DHT-application\n\n# Installations\nsudo apt install python3-venv\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\n## a.b.c. Compile and Run Programs\n\n1. Start the DHT Manager on one end-host:\n\n```bash\npython3 dht_manager.py 12345\n```\n\n2. On each of the 6 end-hosts, start a peer process:\n\n```bash\npython3 dht_peer.py 127.0.0.1 12345\n# or for remote peer to connect to local IP\npython3 dht_peer.py 192.168.0.27 12345\n```\n\n## c. Register Peers\n\nOn each peer terminal, register with the manager:\n\n```bash\n# Terminal 1\nregister peer1 127.0.0.1 8001 8002\n# or\nregister peer1 192.168.0.27 8001 8002\n\n# Terminal 2\nregister peer2 127.0.0.1 8003 8004\n#or\nregister peer2 192.168.0.27 8003 8004\n\n# Terminal 3\nregister peer3 127.0.0.1 8005 8006\n#or\nregister peer3 192.168.0.27 8005 8006\n\n# Terminal 4\nregister peer4 127.0.0.1 8007 8008\n#or\nregister peer4 192.168.0.27 8007 8008\n\n# Terminal 5\nregister peer5 127.0.0.1 8009 8010\n#or\nregister peer5 192.168.0.27 8009 8010\n\n# Terminal 6\nregister peer6 127.0.0.1 8011 8012\n#or\nregister peer6 192.168.0.27 8011 8012\n```\n\n## d. Setup DHT\n\nSelect one peer (e.g., peer1) to initiate DHT setup:\n\n```bash\nsetup-dht peer1 5 1996\n```\n\n## e. Query DHT\n\nOn any peer terminal, issue queries with the following event IDs:\n\n```bash\nquery-dht peer1\n# When prompted, enter these event IDs one by one:\n5536849\n2402920\n5539287\n55770111\n```\n\n## f. Test Peer Leaving\n\n1. Select one peer in the DHT to leave:\n\n```bash\nleave-dht peer2\n```\n\n2. Try querying from the peer that left:\n\n```bash\nquery-dht peer2\n# Enter any event ID (should fail as peer has left)\n5536849\n2402920\n5539287\n55770111\n```\n\n## g. Test Peer Joining\n\n1. Select one of the remaining peers outside the DHT to join:\n\n```bash\njoin-dht peer5\n```\n\nMight need to do peer restructuring (optional)\n\n```bash\ndht-rebuilt peer5 peer1\n```\n\n2. Issue a query from the remaining peer:\n\n```bash\nquery-dht peer5\n\n# Enter any event ID\n5536849\n2402920\n5539287\n55770111\n```\n\n## h. Teardown DHT\n\n1. Have the leader issue teardown command:\n\n```bash\nteardown-dht peer1\n```\n\n2. Wait for all peers to process teardown:\n\n```bash\nteardown-complete peer1\n```\n\n## i. Graceful Termination\n\n1. All peers should automatically de-register and exit\n2. Manually terminate the manager process:\n\n```bash\n# On the manager's terminal\nCtrl+C\n```\n\n## Authors 👨‍💻👩‍💻\n\n- Luan Nguyen\n- Somesh Harshavardhan Gopi Krishna\n- Sophia Gu\n- Kyongho Gong\n\nArizona State University\nCSE434: Computer Networks\nProf. Bharatesh Chakravarthi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluaannguyen%2Fdht-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluaannguyen%2Fdht-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluaannguyen%2Fdht-application/lists"}