{"id":24680416,"url":"https://github.com/peterweissdk/galera-compose","last_synced_at":"2026-04-15T14:07:43.115Z","repository":{"id":274198364,"uuid":"922206333","full_name":"peterweissdk/galera-compose","owner":"peterweissdk","description":"Docker compose Galera cluster","archived":false,"fork":false,"pushed_at":"2025-05-29T15:08:14.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-22T19:47:17.211Z","etag":null,"topics":["docker-compose"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterweissdk.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-01-25T15:50:12.000Z","updated_at":"2025-05-29T15:08:17.000Z","dependencies_parsed_at":"2025-03-21T19:38:28.008Z","dependency_job_id":"f5c548b0-3664-4afe-809a-5fe50d4f948c","html_url":"https://github.com/peterweissdk/galera-compose","commit_stats":null,"previous_names":["peterweissdk/galera-compose"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/peterweissdk/galera-compose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterweissdk%2Fgalera-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterweissdk%2Fgalera-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterweissdk%2Fgalera-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterweissdk%2Fgalera-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterweissdk","download_url":"https://codeload.github.com/peterweissdk/galera-compose/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterweissdk%2Fgalera-compose/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31844423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T13:28:40.153Z","status":"ssl_error","status_checked_at":"2026-04-15T13:28:29.396Z","response_time":63,"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":["docker-compose"],"created_at":"2025-01-26T14:13:21.950Z","updated_at":"2026-04-15T14:07:43.109Z","avatar_url":"https://github.com/peterweissdk.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💾 MariaDB Galera Cluster with Docker Compose\n\n[![Static Badge](https://img.shields.io/badge/Docker-Compose-white?style=flat\u0026logo=docker\u0026logoColor=white\u0026logoSize=auto\u0026labelColor=black)](https://docker.com/)\n[![Static Badge](https://img.shields.io/badge/MariaDB-Galera-white?style=flat\u0026logo=mariaDB\u0026logoColor=white\u0026logoSize=auto\u0026labelColor=black)](https://mariadb.com/)\n[![Static Badge](https://img.shields.io/badge/Linux-white?style=flat\u0026logo=linux\u0026logoColor=white\u0026logoSize=auto\u0026labelColor=black)](https://www.linux.org/)\n[![Static Badge](https://img.shields.io/badge/GPL-V3-white?style=flat\u0026logo=gnu\u0026logoColor=white\u0026logoSize=auto\u0026labelColor=black)](https://www.gnu.org/licenses/gpl-3.0.en.html/)\n\nA MariaDB Galera Cluster setup using Docker Compose.\n\n## ✨ Features\n\n- Multi-node MariaDB Galera Cluster\n- Automatic node synchronization\n- Built-in health monitoring\n- Environment-based configuration\n- Persistent data storage\n- Custom Galera configuration\n- Database reset script\n- Database backup script\n\n## 🚀 Quick Start\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/peterweissdk/galera-compose.git\n   cd galera-compose\n   ```\n\n2. Configure your environment variables:\n   ```bash\n   # Edit .env with your desired settings\n   ```\n\n3. Configure the Galera cluster settings in galera.cnf\n   ```bash\n   # Edit galera.cnf and set\n   wsrep_new_cluster=ON  # Set to ON for the first node only\n   ```\n\n4. Create data directory with correct permissions:\n   ```bash\n   mkdir data\n   sudo chown 999:999 data\n   ```\n\n5. Start the cluster:\n   ```bash\n   docker compose up -d\n   ```\n\n6. After the first node is running, set `wsrep_new_cluster=OFF` and start additional nodes:\n   ```bash\n   # Edit galera.cnf and set\n   wsrep_new_cluster=OFF  # Set back to OFF after cluster is bootstrapped\n   ```\n\n\u003e **Note**: The `wsrep_new_cluster` setting is only needed ON for bootstrapping the first node at first boot up sequence. All subsequent nodes should have it set to OFF.\nIf you bring the cluster back up after a crash, you will need to set `wsrep_new_cluster=ON` at the first boot up sequence to allow the cluster to rejoin. Then bring the joining nodes up one at the time.\n## 🔧 Configuration\n\n### Environment Variables\n- `MYSQL_ROOT_PASSWORD`: Root password for MariaDB\n- `MYSQL_DATABASE`: Name of the default database to create\n- `MYSQL_USER`: Username for the default database\n- `MYSQL_PASSWORD`: Password for the default user\n\n### Galera Configuration\nKey settings in `galera.cnf`:\n- `wsrep_cluster_name`: Name of your Galera cluster\n- `wsrep_cluster_address`: List of cluster nodes\n- `wsrep_node_name`: Unique name for each node\n- `wsrep_node_address`: IP address of the node\n- `wsrep_new_cluster`: Enables bootstrapping a new cluster\n\n## 📝 Directory Structure\n\n```\ngalera-compose/\n├── data/                # Persistent database storage\n├── .env                 # Environment variables and secrets\n├── docker-compose.yml   # Main Docker Compose configuration\n├── galera.cnf           # MariaDB Galera cluster configuration\n├── backup_galera.sh     # Backup script\n├── LICENSE              # Project license\n└── README.md            # Project documentation\n```\n\n## 🔍 Health Check\n\nThe cluster includes built-in health monitoring that checks database connectivity.\n\nTo manually check cluster health:\n```bash\ndocker compose ps\n# or\ndocker ps\n```\n\nThe container will be marked as:\n- `healthy`: When the database is responsive\n- `unhealthy`: After 3 failed health checks\n- `starting`: During the initial 30s start period\n\nTo manually check the cluster database:\n```bash\n# Size of cluster\ndocker exec -it \u003ccontainer_name_or_id\u003e mariadb -u \u003cusername\u003e -p -e \"SHOW STATUS LIKE 'wsrep_cluster_size';\"\n\n# IP adresses of cluster nodes\ndocker exec -it \u003ccontainer_name_or_id\u003e mariadb -u \u003cusername\u003e -p -e \"SHOW STATUS LIKE 'wsrep_incoming_addresses';\"\n\n# All information about the cluster\ndocker exec -it \u003ccontainer_name_or_id\u003e mariadb -u \u003cusername\u003e -p -e \"SHOW GLOBAL STATUS LIKE 'wsrep_%';\"\n```\n\n## 📦 Backup\n\nThe project includes a backup script (`backup_galera.sh`) that safely creates backups of your Galera cluster:\n\n### Backup\n1. Make the script executable:\n   ```bash\n   chmod +x backup_galera.sh\n   ```\n\n2. Run the backup:\n   ```bash\n   ./backup_galera.sh\n   ```\n\n### Restore\n1. Bind mount the backup directory to the container:\n   ```bash\n   ./backup:/backup\n   ```\n2. Untar the dump file:\n   ```bash\n   tar -xvzf /backup/galera-backup-YYYYMMDD.tar.gz\n   ```\n3. Enter the container:\n   ```bash\n   docker exec -it mariadb-galera /bin/bash\n   ```\n4. Restore the database:\n   ```bash\n   mariadb -u root -p \u003c /backup/galera-backup-YYYYMMDD.sql\n   ```\n5. Note:\n   ```bash\n   You might need to set wsrep_new_cluster=ON in galera.cnf to get the container up and running,\n   before entering the container.\n   ```\n\nThe script will:\n- Create backup and log directories\n- Desynchronize the node to ensure consistent backup\n- Create a MariaDB dump of all databases\n- Create a compressed archive\n- Re-synchronize the node with the cluster\n- Log all operations\n\nBackups and Logs are stored in the following structure:\n```\nbackup/\n├── temp/                          # Temporary storage for database dumps\n└── galera-backup-YYYYMMDD.tar.gz  # Compressed backup archive\nlogs/\n└── galera_backup.log              # Log file\n```\n\nYou can also add the script to cron for automated backups:\n```bash\n# Example: Run backup daily at 2 AM\n0 2 * * * /path/to/backup_galera.sh\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 🆘 Support\n\nIf you encounter any issues or need support, please file an issue on the GitHub repository.\n\n## 📄 License\n\nThis project is licensed under the GNU GENERAL PUBLIC LICENSE v3.0 - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterweissdk%2Fgalera-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterweissdk%2Fgalera-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterweissdk%2Fgalera-compose/lists"}