{"id":21323916,"url":"https://github.com/byteshiva/consul-cluster-setup","last_synced_at":"2026-04-18T01:35:48.893Z","repository":{"id":40410456,"uuid":"141594441","full_name":"byteshiva/consul-cluster-setup","owner":"byteshiva","description":"Setup Consul Cluster Setup","archived":false,"fork":false,"pushed_at":"2023-12-15T14:56:35.000Z","size":6,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-20T18:52:30.021Z","etag":null,"topics":["cluster","consul","setup","vagrant","vagrantfile"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/byteshiva.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}},"created_at":"2018-07-19T14:54:14.000Z","updated_at":"2018-07-19T15:02:35.000Z","dependencies_parsed_at":"2024-11-21T20:38:52.015Z","dependency_job_id":null,"html_url":"https://github.com/byteshiva/consul-cluster-setup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/byteshiva/consul-cluster-setup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteshiva%2Fconsul-cluster-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteshiva%2Fconsul-cluster-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteshiva%2Fconsul-cluster-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteshiva%2Fconsul-cluster-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byteshiva","download_url":"https://codeload.github.com/byteshiva/consul-cluster-setup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteshiva%2Fconsul-cluster-setup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31953515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"ssl_error","status_checked_at":"2026-04-18T00:39:20.671Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","consul","setup","vagrant","vagrantfile"],"created_at":"2024-11-21T20:27:51.393Z","updated_at":"2026-04-18T01:35:48.860Z","avatar_url":"https://github.com/byteshiva.png","language":"JavaScript","readme":"# consul-cluster-setup\nsetup consul cluster setup\n\n# In Node two follow the below instructions\n\n```bash\n$sudo -s\n$ echo '{\"service\": {\"name\": \"web\", \"tags\": [\"rails\"], \"port\": 80,\n  \"check\": {\"script\": \"curl localhost \u003e/dev/null 2\u003e\u00261\", \"interval\": \"10s\"}}}' \u003e /etc/consul.d/web.json \n  \n$ echo '{\"services\":[{\"id\":\"webservice-poll\",\"name\":\"webservice-poll\",\"tags\":[\"poll\"],\"port\":80,\"checks\":[{\"name\":\"Sys check \",\"script\":\"some_scripts.sh param1 param2\",\"interval\":\"5s\",\"timeout\":\"1s\"},{\"name\":\"Check if service is alive\",\"http\":\"http://localhost:80/checkservice\",\"interval\":\"5s\",\"timeout\":\"1s\"},{\"name\":\"HTTP on port 80\",\"http\":\"http://localhost:80/\",\"interval\":\"5s\",\"timeout\":\"1s\"},{\"id\":\"check particular tcp port\",\"name\":\"check a port\",\"tcp\":\"localhost:3415\",\"interval\":\"10s\",\"timeout\":\"1s\"}]}]}' \u003e /etc/consul.d/checkbservice.json\n\n\n```\n\n# Run Node1 as Server\n\n```bash\n$consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul -node=agent-one -bind=172.20.20.10 -client=0.0.0.0 -config-dir /etc/consul.d/ -ui\n```\n* 172.20.20.10 - private ipaddress of node1 \n* bootstrap-expect [num] - num tells the server that it expect atleast one node to join.\n* consul can run either as server or agent, -server makes the consul agent as server\n* -node gives a name to identify the node\n\nNotes:\nExpose client = 0.0.0.0 inorder to accomplish [port forwarding to localhost](https://groups.google.com/forum/#!topic/vagrant-up/Gk7brIps2_8)\n\n\n# Run Node2 as client and join to cluster\n```bash\n$consul agent --data-dir /tmp/consul -node=agent-two -bind=172.20.20.11 -config-dir /etc/consul.d/\n```\nNote\n* 172.20.20.11 - private ip address of node2\n* -bind telling consul to bind the localip address, so while advertising itself it will use this ipaddress. Can also see -advertise or -advertise-wan\n* --data-dir  - tells the consul to refer or store all intermediate meta-datas for the consul\n* \n\n# Join Node2 from node1\n\n```bash\nLogin to machine one - ie, node\n\n$vagrant ssh node1\nnode1@$consul members \nnode1@$consul join 172.20.20.11\n```\n\nThe join command will make the node join to cluster and election process happens to elect cluster leader.\n\n\n#Run Node3 as client and join to cluster\n```bash\n$consul agent --data-dir /tmp/consul -node=agent-three -bind=172.20.20.12 -config-dir /etc/consul.d/\n```\n* 172.20.20.12 - local private ipaddres of node3\n* node = agent-three, this is used to identify node3 among other nodes in cluster.\n* \n#join node3 to cluster \n\n```bash \n$vagrant ssh node1\nnode1@$consul members \nnode1@$consul join 172.20.20.12\n```\n\n* note the node can join to any member in the cluster, its not mandatory to join from server node.\n\n\n** DNS Setup on localhost\n\n```bash\nlocalhostmachine@user$sudo apt-get install dnsmasq -y\nlocalhostmachine@user$sudo -s\nlocalhostmachine@user@echo \"server=/consul/127.0.0.1#8600\" \u003e /etc/dnsmasq.d/10-consul\nlocalhostmachine@user@sudo service dnsmasq restart\n * Restarting DNS forwarder and DHCP server dnsmasq                           [ OK ] \n```\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteshiva%2Fconsul-cluster-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyteshiva%2Fconsul-cluster-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteshiva%2Fconsul-cluster-setup/lists"}