Commit d325740a authored by Carlomagno González's avatar Carlomagno González
Browse files

Se agregan archivos

Se agregan ejemplos
parent 02d865d1
version: '2'
services:
mariadb-galera:
image: 'bitnami/mariadb-galera:10.3'
ports:
- '3306:3306'
- '4444:4444'
- '4567:4567'
- '4568:4568'
volumes:
- 'mariadb_galera_data:/bitnami/mariadb'
-v /path/to/cert.pem:/bitnami/mariadb/certs/cert.pem:ro
-v /path/to/key.pem:/bitnami/mariadb/certs/key.pem:ro
-v /path/to/ca.pem:/bitnami/mariadb/certs/ca.pem:ro
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_CHARACTER_SET= utf8
-e MARIADB_ENABLE_SSL=yes \
-e MARIADB_TLS_CERT_FILE=/bitnami/mariadb/certs/cert.pem \
-e MARIADB_TLS_KEY_FILE=/bitnami/mariadb/certs/key.pem \
-e MARIADB_TLS_CA_FILE=/bitnami/mariadb/certs/ca.pem \
bitnami/mariadb-galera:latest
- MARIADB_COLLATION = utf8_general_ci
- MARIADB_EXTRA_FLAGS=--max-connect-errors=1000 --max_connections=155
- MARIADB_ROOT_PASSWORD=root
- MARIADB_DATABASE=my_database
- MARIADB_USER=cgonzalezv
- MARIADB_PASSWORD=cgonzalezv
volumes:
mariadb_galera_data:
driver: local
node1:
image: hauptmedia/mariadb:10.1
hostname: node1
ports:
- 13306:3306
environment:
- MYSQL_ROOT_PASSWORD=test
- REPLICATION_PASSWORD=test
- MYSQL_DATABASE=maria
- MYSQL_USER=maria
- MYSQL_PASSWORD=test
- GALERA=On
- NODE_NAME=node1
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://
command: --wsrep-new-cluster
node2:
image: hauptmedia/mariadb:10.1
hostname: node2
links: #NO ES NECESARIO, DEPRECATED
- node1
ports:
- 23306:3306
environment:
- REPLICATION_PASSWORD=test
- GALERA=On
- NODE_NAME=node2
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://node1
node3:
image: hauptmedia/mariadb:10.1
hostname: node3
links: #NO ES NECESARIO, DEPRECATED
- node1
ports:
- 33306:3306
environment:
- REPLICATION_PASSWORD=test
- GALERA=On
- NODE_NAME=node3
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://node1
\ No newline at end of file
Encontrado en
https://github.com/hauptmedia/docker-mariadb
https://hub.docker.com/r/hauptmedia/mariadb/dockerfile
https://gist.github.com/lucidfrontier45/497341c4b848dfbd6dfb
Notas:
fabiomontefuscolo commented on 8 Nov 2016 •
It is aweome! I could test galera without edit mysql files. But I have a doubt, if I stop the node1, insert some records and then start node1 again, we will have a desync for this node. Do you know how to solve this?
@mluczak
mluczak commented on 11 Sep 2018
You need to restart node1 without --wsrep-new-cluster or it will create a new standalone single node cluster.
\ No newline at end of file
version: "3.7"
services:
node-1:
build:
context: ./dockerfiles
dockerfile: cluster
ports:
- "5001:3306"
command: sudo -u mysql mysqld --wsrep-new-cluster
node-2:
build:
context: ./dockerfiles
dockerfile: cluster
ports:
- "5002:3306"
links:
- node-1
command: sudo -u mysql mysqld
node-3:
build:
context: ./dockerfiles
dockerfile: cluster
ports:
- "5003:3306"
links:
- node-1
command: sudo -u mysql mysqld
\ No newline at end of file
FROM centos:7
ADD mariadb.repo /etc/yum.repos.d/mariadb.repo
RUN rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB \
&& rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7 \
&& yum install -y -q MariaDB-server MariaDB-client galera-4 sudo
ADD cluster.cnf /etc/my.cnf.d/my.cnf
\ No newline at end of file
[mysqld]
default_storage_engine=InnoDB
log-bin=/var/lib/mysql/mysql-bin-log
binlog_format=ROW
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
transaction-isolation = READ-COMMITTED
innodb_flush_log_at_trx_commit=0
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_name=DBCLUSTER
wsrep_sst_method=rsync
wsrep_slave_threads=2
wsrep_cluster_address=gcomm://node-1,node-2,node-3
\ No newline at end of file
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4.12/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
\ No newline at end of file
Encontrado en https://qiita.com/rururu_kenken/items/fe709f3c67f9b0e79b58
Funciona pero no se puede acceder por workbench.
$ docker-compose up -d
$ docker-compose exec node-1 mysql -e "create database test_db"
$ docker-compose exec node-2 mysql -e "show databases"
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| test_db |
+--------------------+
$ docker-compose exec node-3 mysql -e "show databases"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment