{"id":24429130,"url":"https://github.com/sofianhw/galera-mariadb","last_synced_at":"2026-04-29T02:35:10.463Z","repository":{"id":184197252,"uuid":"671356002","full_name":"sofianhw/galera-mariadb","owner":"sofianhw","description":"Database Clustering Exploring","archived":false,"fork":false,"pushed_at":"2023-07-27T11:59:30.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T13:35:26.929Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sofianhw.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-27T06:17:46.000Z","updated_at":"2023-07-27T06:19:39.000Z","dependencies_parsed_at":"2023-07-27T13:00:44.558Z","dependency_job_id":null,"html_url":"https://github.com/sofianhw/galera-mariadb","commit_stats":null,"previous_names":["sofianhw/galera-mariadb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianhw%2Fgalera-mariadb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianhw%2Fgalera-mariadb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianhw%2Fgalera-mariadb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianhw%2Fgalera-mariadb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofianhw","download_url":"https://codeload.github.com/sofianhw/galera-mariadb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243456568,"owners_count":20293905,"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":"2025-01-20T13:33:29.721Z","updated_at":"2025-12-30T03:07:09.940Z","avatar_url":"https://github.com/sofianhw.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Database Clustering with Galera MariaDB\n\n## Build docker image\n$ docker build -t sofianhw/galera-mariadb\n\n## Create docker network\n$ docker network create --subnet 172.100.0.0/16 galera\n\n## Create first master\n$ docker run -d --restart=unless-stopped --net galera \\\n\t--name node1 -h node1 --ip 172.100.0.101 \\\n\t-p 3311:3306 \\\n\t-v $(PWD)/master/node1/node1.cnf:/etc/mysql/conf.d/galera.cnf \\\n\t-e MYSQL_ROOT_PASSWORD=root \\\n\tsofianhw/galera-mariadb --wsrep-new-cluster\n\n## Create second master\n$ docker run -d --restart=unless-stopped --net galera \\\n\t--name node2 -h node2 --ip 172.100.0.102 \\\n\t-p 3312:3306 \\\n\t-v $(PWD)/master/node2/node2.cnf:/etc/mysql/conf.d/galera.cnf \\\n\t-e MYSQL_ALLOW_EMPTY_PASSWORD=1 \\\n\tsofianhw/galera-mariadb\n\n## Check number of nodes in cluster\n$ docker exec -it node1 mariadb -u root -p -e \"SHOW STATUS LIKE 'wsrep_cluster_size'\"\n\n## Create third master with slave replication config\n$ docker run -d --restart=unless-stopped --net galera \\\n\t--name node3-prim -h node3-prim --ip 172.100.0.103 \\\n\t-p 3313:3306 \\\n\t-v $(PWD)/master/node3/node3-prim.cnf:/etc/mysql/conf.d/galera.cnf \\\n\t-v $PWD/master/node3/primaryinit:/docker-entrypoint-initdb.d:z \\\n\t-e MYSQL_ALLOW_EMPTY_PASSWORD=1 \\\n\tsofianhw/galera-mariadb\n\n$ docker exec -it node3-prim bash -c \"until mysql -u root -p'root' -e 'SHOW STATUS LIKE \\\"wsrep_ready\\\";' | grep 'ON'; do sleep 1; done; mysql -u root -p'root' \u003c /docker-entrypoint-initdb.d/primaryinit.sql\"\n\n## Create slave node\ndocker run -d --restart=unless-stopped --net galera \\\n\t--name node1-second -h node1-second --ip 172.100.0.104 \\\n\t-p 3314:3306 \\\n\t-v $(PWD)/replica/node1/config/secondary1.cnf:/etc/mysql/conf.d/galera.cnf \\\n\t-v $PWD/replica/node1/sqlinit:/docker-entrypoint-initdb.d:z \\\n\t-e MARIADB_ROOT_PASSWORD=secret \\\n\tmariadb:10.6\n\n## Check master and slave replication running\n$ docker exec -it node1-second mariadb -uroot -psecret -e 'show slave status\\G'\n$ docker exec -it node3-prim mariadb -uroot -proot -e 'show master status\\G'\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofianhw%2Fgalera-mariadb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofianhw%2Fgalera-mariadb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofianhw%2Fgalera-mariadb/lists"}