{"id":21357808,"url":"https://github.com/rcbops/galera","last_synced_at":"2026-01-02T22:51:54.757Z","repository":{"id":22689124,"uuid":"26032902","full_name":"rcbops/galera","owner":"rcbops","description":null,"archived":false,"fork":false,"pushed_at":"2015-03-23T19:53:47.000Z","size":235,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-22T18:30:44.855Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rcbops.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":"2014-10-31T20:57:39.000Z","updated_at":"2016-05-09T18:36:29.000Z","dependencies_parsed_at":"2022-08-17T16:30:49.178Z","dependency_job_id":null,"html_url":"https://github.com/rcbops/galera","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fgalera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fgalera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fgalera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fgalera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcbops","download_url":"https://codeload.github.com/rcbops/galera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830956,"owners_count":20354856,"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","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":"2024-11-22T05:12:29.685Z","updated_at":"2026-01-02T22:51:54.720Z","avatar_url":"https://github.com/rcbops.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# A salt formula for creating a MariaDB 10.0/ Galera cluster\n\nThis formula will: \n* Set up haproxy for load balancing multiple MariaDB servers\n* Set up a cluster of 3 MariaDB nodes with Galera wsrep\n\n\n\n\n###Pillar\n```yaml\ninterfaces:\n\tprivate: eth0\n\tpublic: eth0\nmine_functions:\n\tnetwork.ip_addrs: [eth0]\n\tnetwork.interfaces: []\nmine_interval: 1\nmdb_cfg_files:\n\tubuntu_cluster:\n\t\tpath: /etc/mysql/conf.d/cluster.cnf\n\t\tsource: salt://galera/config/cluster.cnf\n\tubuntu_maintenance:\n\t\tpath: /etc/mysql/debian.cnf\n\t\tsource: salt://galera/config/debian.cnf\nmdb_config:\n\tprovider: /usr/lib/galera/libgalera_smm.so\nmdb_repo:\n\tbaseurl: http://mirror.jmu.edu/pub/mariadb/repo/10.0/ubuntu\n\tkeyserver: hkp://keyserver.ubuntu.com:80\n\tkeyid: '0xcbcb082a1bb943db'\n\tfile: /etc/apt/sources.list\npercona_repo:\n\tkeyserver: keys.gnupg.net\n\tkeyid: '1C4CBDCDCD2EFD2A'\n\tfile: /etc/apt/sources.list\nuser_via_heat:\n\tname: $user\n\tpassword: $password\n\tremotehost: \"$remotehost\"\ndatabase:\n\tname: $database\nmysql_config:\n\tdbuser: root\n\tport: 3306\n\tsocket: /var/lib/mysql/mysql.sock\n\tdatadir: /var/lib/mysql/db_data\n\tmaintenance_password: $pw\n\tadmin_password: $admin_password\n```\n\n###Orchestration Runner\n```yaml\n haproxy:\n\tsalt.state:\n\t\t- tgt: 'roles:haproxy'\n\t\t- tgt_type: grain\n\t\t- sls:\n\t\t\t- galera.haproxy\n\t\t\t- galera.mysql\nsetup:\n\tsalt.state:\n\t\t- tgt: '*db*'\n\t\t- sls:\n\t\t\t- galera\nbootstrap-stop:\n\tsalt.state:\n\t\t- tgt: 'roles:db_bootstrap'\n\t\t- tgt_type: grain\n\t\t- sls:\n\t\t\t- galera.stop\n\t\t- requires:\n\t\t\t- salt: setup\ndb2-stop:\n\tsalt.state:\n\t\t- tgt: '*db2*'\n\t\t- sls:\n\t\t\t- galera.stop\n\t\t- requires:\n\t\t\t- salt: bootstrap-stop\ndb3-stop:\n\tsalt.state:\n\t\t- tgt: '*db3*'\n\t\t- sls:\n\t\t\t- galera.stop\n\t\t- requires:\n\t\t\t- salt: db2-stop\nbootstrap-start:\n\tsalt.state:\n\t\t- tgt: 'roles:db_bootstrap'\n\t\t- tgt_type: grain\n\t\t- sls:\n\t\t\t- galera.start\n\t\t- requires:\n\t\t\t- salt: db3-stop\nnon-bootstrap-start:\n\tsalt.state:\n\t\t- tgt: 'roles:db'\n\t\t- tgt_type: grain\n\t\t- sls:\n\t\t\t- galera.start\n\t\t- require:\n\t\t\t- salt: bootstrap-start\nbuild-db:\n\tsalt.state:\n\t\t- tgt: 'roles:db_bootstrap'\n\t\t- tgt_type: grain\n\t\t- sls:\n\t\t\t- galera.db\n\t\t- require:\n\t\t\t- salt: non-bootstrap-start\n\n```\n\n#How to use:\nThis formula uses the orchestration runner above to orchestrate the deployment of the MariaDB/Galera cluster load balanced using haproxy. \n\nBefore running the orchestration runner, make sure the pillar above is in the /srv/pillar directory and the orchestration runner in the /srv/salt/orchestration directory. Also, assign minions their respective roles. \n\n####Assigning roles: \nChoose a minion to be the haproxy minion and assign it the haproxy role by setting it's grain: \n```shell\nsalt \u003cnode\u003e grains.setval roles ['haproxy']\n```\nChoose a minion that will act as the clusters bootstrap node and assigne it the \"db_bootstrap\" role: \n```shell\nsalt \u003cnode\u003e grains.setval roles ['db_bootstrap']\n```\nAssign the \"db\" role to the remaining nodes that will be a part of the cluster: \n```shell\nsalt \u003cnode\u003e grains.setval roles ['db'] \n```\n\nNote: Ensure the ID of the database nodes contain the string \"db\". The bootstrap node ID must be db_bootstrap, and the other nodes must be \"db2\" and \"db3\". This is because of the way the orchestration runner targets the nodes. \n\n#### Run orchestration: \nFinally, run the orchestration runner.\n```shell\nsalt-run state.sls orchestration.galera_cluster\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcbops%2Fgalera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcbops%2Fgalera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcbops%2Fgalera/lists"}