{"id":19691518,"url":"https://github.com/kbrw/nano_ring","last_synced_at":"2025-07-30T15:16:51.175Z","repository":{"id":63238924,"uuid":"14361630","full_name":"kbrw/nano_ring","owner":"kbrw","description":"NanoRing is a very very small Cluster management System in Elixir.","archived":false,"fork":false,"pushed_at":"2020-11-08T22:24:25.000Z","size":33,"stargazers_count":35,"open_issues_count":3,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-29T09:42:59.400Z","etag":null,"topics":["cluster-manager","elixir","gossip-protocol","ring"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/kbrw.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}},"created_at":"2013-11-13T10:59:43.000Z","updated_at":"2023-09-01T08:49:28.000Z","dependencies_parsed_at":"2022-11-15T13:20:06.988Z","dependency_job_id":null,"html_url":"https://github.com/kbrw/nano_ring","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kbrw/nano_ring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbrw%2Fnano_ring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbrw%2Fnano_ring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbrw%2Fnano_ring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbrw%2Fnano_ring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kbrw","download_url":"https://codeload.github.com/kbrw/nano_ring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbrw%2Fnano_ring/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267889729,"owners_count":24161264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"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":["cluster-manager","elixir","gossip-protocol","ring"],"created_at":"2024-11-11T19:09:37.205Z","updated_at":"2025-07-30T15:16:51.089Z","avatar_url":"https://github.com/kbrw.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"nano_ring\n=========\n\nNanoRing is a very very small Cluster management System in Elixir.\n\nIt uses a simple gossip protocol to share the ring state without a\nmaster node. The 2 sets containing the ring state (all nodes and up\nnodes) are made convergent with a LWW-element-set state-based CRDT\n(http://hal.upmc.fr/docs/00/55/55/88/PDF/techreport.pdf ).  The\nLWW-element-set containing all nodes is persistent and written on\ndisk.\n\n## How does it work ? ##\n\nThe state communication works using a gossip style protocol :\n\n- each node has two sets : one containing all cluster nodes, and the\n  other containing only up node.\n- every second, a node choose a random node among up-nodes, send it\n  its 2 sets.\n- the chosen node updates its own ring merging the received ring.\n- the chosen node look if the sending node is in its up-node set, if\nnot add it (because it knows that it has juste received a message\nfrom it, so it is not down)\n- the chosen node send an \"ack\" message to the sending node, so that\nif this node did not receive the ack after a timeout, it can remove\nthe chosen node from its \"up-set\".\n\nThe whole cluster node set is persisted on-disk on each node, saved\non cluster change. The up node set is initialized with all nodes.\n\nWhen a node is removed (cast `:del_node`), remove it from the\n`node_set` but not from the `up_set` to allow the gossip propagates\nthe ring. When a node see that it is not in its current cluster,\ndelete its ring file and exit the node after 10 seconds, so that all\nnode will remove it from their `up_set`.\n\n## How to test Nano Ring ##\n\nFirst you can create 4 node launching either `make multi_start` if you use\nxterm, it will launch 4 terms with erlang nodes named\n`dev[1,2,3,4]@127.0.0.1` running `NanoRing.App`.\n\nIf you cannot use xterm, you can create your own 4 terminal and\nlaunch `make start_dev[1-4]` on each one.\n\n### Create a cluster ###\n\nBy default, each node is in a ring containing only itself. To join\nanother node, use for instance on `nano_ring_dev1`:\n\n```elixir\nNanoRing.add_node(:\"nano_ring_dev2@127.0.0.1\")\n```\n\nIf you want to remove a node, use :\n\n```elixir\nNanoRing.del_node(:\"nano_ring_dev2@127.0.0.1\")\n```\n\nand wait 10 seconds.\n\nIn order to see the evolution of the cluster, you can see the whole\ncluster with :\n\n```elixir\nNanoRing.get_all()\n```\n\nTo observe the available nodes of the cluster, you can use :\n\n```elixir\nNanoRing.get_up()\n```\n\n## License\n\nnano_ring source code is released under Apache 2 License.\n\nCheck the [LICENSE](LICENSE) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbrw%2Fnano_ring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkbrw%2Fnano_ring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbrw%2Fnano_ring/lists"}