summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dockerfile2
-rw-r--r--mysql/Dockerfile19
-rw-r--r--mysql/Makefile47
-rw-r--r--mysql/root-galera/etc/yum.repos.d/galera.repo (renamed from root-galera/etc/yum.repos.d/galera.repo)0
-rwxr-xr-xmysql/root-galera/usr/bin/peer-finder (renamed from root-galera/usr/bin/peer-finder)bin2214569 -> 2214569 bytes
-rwxr-xr-xmysql/root-galera/usr/bin/run-mysqld-galera (renamed from root-galera/usr/bin/run-mysqld-galera)6
-rwxr-xr-xmysql/root-galera/usr/bin/run-mysqld-manager (renamed from root-galera/usr/bin/run-mysqld-manager)3
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/galera-common.sh (renamed from root-galera/usr/share/container-scripts/mysql/galera-common.sh)0
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/galera-init/60-galera-config.sh (renamed from root-galera/usr/share/container-scripts/mysql/galera-init/60-galera-config.sh)0
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template (renamed from root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template)6
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/galera/cluster.cnf (renamed from root-galera/usr/share/container-scripts/mysql/galera/cluster.cnf)0
-rwxr-xr-xmysql/root-galera/usr/share/container-scripts/mysql/galera/configure-galera.sh (renamed from root-galera/usr/share/container-scripts/mysql/galera/configure-galera.sh)0
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/init/50-galera-passwd-change.sh (renamed from root-galera/usr/share/container-scripts/mysql/init/50-galera-passwd-change.sh)5
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/init/51-extradb.sh (renamed from root-galera/usr/share/container-scripts/mysql/init/51-extradb.sh)0
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/init/52-super.sh (renamed from root-galera/usr/share/container-scripts/mysql/init/52-super.sh)2
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/init/53-pma.sh (renamed from root-galera/usr/share/container-scripts/mysql/init/53-pma.sh)0
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh24
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave-logbin.cnf.template2
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template5
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template6
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-master.cnf.template7
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-repl-gtid.cnf.template6
-rw-r--r--mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-slave.cnf.template7
-rw-r--r--root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template.maria17
24 files changed, 135 insertions, 29 deletions
diff --git a/Dockerfile b/Dockerfile
index 02c5ca3..c61419a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,7 +14,7 @@ RUN INSTALL_PKGS="galera-3 mysql-wsrep-5.7 iproute rsync which socat percona-xtr
rpm -V $INSTALL_PKGS && \
yum clean all
-COPY root-galera /
+COPY mysql/root-galera /
ENV MYSQL_PREFIX=/usr \
ENABLED_COLLECTIONS=""
diff --git a/mysql/Dockerfile b/mysql/Dockerfile
new file mode 100644
index 0000000..66aa7a0
--- /dev/null
+++ b/mysql/Dockerfile
@@ -0,0 +1,19 @@
+FROM centos/mysql-57-centos7
+
+USER root
+
+RUN INSTALL_PKGS="iproute rsync which socat percona-xtrabackup-24 bind-utils policycoreutils" && \
+ yum install -y epel-release && \
+ yum install -y http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm && \
+ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
+ yum install -y --setopt=tsflags=nodocs mc && \
+ rpm -V $INSTALL_PKGS && \
+ yum clean all
+
+COPY root-galera /
+
+RUN rm -rf /etc/my.cnf.d/* && \
+ cp --remove-destination $(readlink /etc/my.cnf) /etc/my.cnf && \
+ /usr/libexec/container-setup && rpm-file-permissions
+
+USER 27
diff --git a/mysql/Makefile b/mysql/Makefile
new file mode 100644
index 0000000..fcf088d
--- /dev/null
+++ b/mysql/Makefile
@@ -0,0 +1,47 @@
+all: build
+install: push
+
+.PHONY: rebuild build push start stop restart bash peer-finder
+
+
+build: Dockerfile
+ docker build --tag chsa/mysql:5.7 .
+
+rebuild: Dockerfile
+ docker build --no-cache --tag chsa/mysql:5.7 .
+
+push: build
+ docker push chsa/mysql:5.7
+
+login:
+ docker login -u `oc whoami` -p `oc whoami -t` docker-registry-default.kaas.kit.edu
+
+kaas: build login
+ docker tag chsa/mysql:5.7 docker-registry-default.kaas.kit.edu/adei/mysql:5.7
+ docker push docker-registry-default.kaas.kit.edu/adei/mysql:5.7
+
+
+start: build
+ if [ `docker ps | grep chsa/mysql | wc -l` -eq 0 ]; then \
+ if [ `docker ps -a | grep mysql | wc -l` -gt 0 ]; then \
+ echo "Removing the stalled copy..." ;\
+ docker stop mysql ;\
+ docker rm mysql ;\
+ fi ;\
+ docker run --name mysql -t -d chsa/mysql:5.7 ;\
+ else \
+ echo "Already running..." ;\
+ fi
+
+stop:
+ @if [ `docker ps | grep mysql | wc -l` -gt 0 ]; then \
+ docker stop mysql ;\
+ docker rm mysql ;\
+ fi
+
+restart:
+ make stop
+ make start
+
+bash: build
+ docker exec -it mysql /bin/bash
diff --git a/root-galera/etc/yum.repos.d/galera.repo b/mysql/root-galera/etc/yum.repos.d/galera.repo
index b002165..b002165 100644
--- a/root-galera/etc/yum.repos.d/galera.repo
+++ b/mysql/root-galera/etc/yum.repos.d/galera.repo
diff --git a/root-galera/usr/bin/peer-finder b/mysql/root-galera/usr/bin/peer-finder
index af52ee1..af52ee1 100755
--- a/root-galera/usr/bin/peer-finder
+++ b/mysql/root-galera/usr/bin/peer-finder
Binary files differ
diff --git a/root-galera/usr/bin/run-mysqld-galera b/mysql/root-galera/usr/bin/run-mysqld-galera
index 9ff6c26..1890209 100755
--- a/root-galera/usr/bin/run-mysqld-galera
+++ b/mysql/root-galera/usr/bin/run-mysqld-galera
@@ -30,7 +30,7 @@ log_volume_info $MYSQL_DATADIR
process_extending_files ${APP_DATA}/mysql-pre-init/ ${CONTAINER_SCRIPTS_PATH}/pre-init/
mysql_extra_opts=""
-if [ ! -d "$MYSQL_DATADIR/mysql" ]; then
+if [ ! -d "$MYSQL_DATADIR/mysql" -a ! -d "$MYSQL_DATADIR/.sst" ]; then
initialize_galera_database "$@"
# galera files
@@ -47,7 +47,9 @@ else
log_info "Configuration: $MYSQL_DEFAULTS_FILE"
log_info "No cluster is configured yet, trying to recover from failure..."
log_info "Allowing recovery in $MYSQL_DATADIR/grastate.dat"
- sed -i'' 's/safe_to_bootstrap:.*/safe_to_bootstrap: 1/' $MYSQL_DATADIR/grastate.dat
+# This seems a bad idea. If another pod is marked safe to bootstrap we may end up in conflict, I guess....
+# Keep it manual for now
+# sed -i'' 's/safe_to_bootstrap:.*/safe_to_bootstrap: 1/' $MYSQL_DATADIR/grastate.dat
# This seems unneeded
# mysql_extra_opts="--wsrep-new-cluster"
else
diff --git a/root-galera/usr/bin/run-mysqld-manager b/mysql/root-galera/usr/bin/run-mysqld-manager
index 878338a..91f3c9c 100755
--- a/root-galera/usr/bin/run-mysqld-manager
+++ b/mysql/root-galera/usr/bin/run-mysqld-manager
@@ -54,7 +54,8 @@ log_volume_info $MYSQL_DATADIR
process_extending_files ${APP_DATA}/mysql-pre-init/ ${CONTAINER_SCRIPTS_PATH}/pre-init/
mysql_extra_opts=""
-if [ ! -d "$MYSQL_DATADIR/mysql" ]; then
+if [ ! -d "$MYSQL_DATADIR/mysql" -a ! -d "$MYSQL_DATADIR/.sst" ]; then
+
initialize_galera_database "$@"
# galera files
diff --git a/root-galera/usr/share/container-scripts/mysql/galera-common.sh b/mysql/root-galera/usr/share/container-scripts/mysql/galera-common.sh
index b4d90e5..b4d90e5 100644
--- a/root-galera/usr/share/container-scripts/mysql/galera-common.sh
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/galera-common.sh
diff --git a/root-galera/usr/share/container-scripts/mysql/galera-init/60-galera-config.sh b/mysql/root-galera/usr/share/container-scripts/mysql/galera-init/60-galera-config.sh
index e6cce5a..e6cce5a 100644
--- a/root-galera/usr/share/container-scripts/mysql/galera-init/60-galera-config.sh
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/galera-init/60-galera-config.sh
diff --git a/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template
index b45dc85..c64a8cc 100644
--- a/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template
@@ -8,12 +8,6 @@ wsrep_sst_method = xtrabackup-v2
default_storage_engine = innodb
binlog_format = row
-#MySQL tuning
-#max_threads = 128
-#key_buffer_size = 1024K
-#sort_buffer_size = 1024K
-#read_buffer_size = 1024K
-
# Performance settings
innodb_autoinc_lock_mode = 2
innodb_flush_log_at_trx_commit = 0
diff --git a/root-galera/usr/share/container-scripts/mysql/galera/cluster.cnf b/mysql/root-galera/usr/share/container-scripts/mysql/galera/cluster.cnf
index 5e9d444..5e9d444 100644
--- a/root-galera/usr/share/container-scripts/mysql/galera/cluster.cnf
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/galera/cluster.cnf
diff --git a/root-galera/usr/share/container-scripts/mysql/galera/configure-galera.sh b/mysql/root-galera/usr/share/container-scripts/mysql/galera/configure-galera.sh
index 05829a4..05829a4 100755
--- a/root-galera/usr/share/container-scripts/mysql/galera/configure-galera.sh
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/galera/configure-galera.sh
diff --git a/root-galera/usr/share/container-scripts/mysql/init/50-galera-passwd-change.sh b/mysql/root-galera/usr/share/container-scripts/mysql/init/50-galera-passwd-change.sh
index 2844d5f..5789bde 100644
--- a/root-galera/usr/share/container-scripts/mysql/init/50-galera-passwd-change.sh
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/init/50-galera-passwd-change.sh
@@ -10,5 +10,8 @@ mysql $mysql_flags <<EOSQL
EOSQL
}
-password_change
+if [ -v MYSQL_GALERA_USER -a -v MYSQL_GALERA_PASSWORD ]; then
+ password_change
+fi
+
unset -f password_change
diff --git a/root-galera/usr/share/container-scripts/mysql/init/51-extradb.sh b/mysql/root-galera/usr/share/container-scripts/mysql/init/51-extradb.sh
index c047265..c047265 100644
--- a/root-galera/usr/share/container-scripts/mysql/init/51-extradb.sh
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/init/51-extradb.sh
diff --git a/root-galera/usr/share/container-scripts/mysql/init/52-super.sh b/mysql/root-galera/usr/share/container-scripts/mysql/init/52-super.sh
index 9e49151..cfa19ed 100644
--- a/root-galera/usr/share/container-scripts/mysql/init/52-super.sh
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/init/52-super.sh
@@ -5,7 +5,7 @@ mysql $mysql_flags <<EOSQL
EOSQL
}
-if [ -v MYSQL_USER_PRIV_SUPER ]; then
+if [ -v MYSQL_USER_PRIV_SUPER -a "$MYSQL_USER_PRIV_SUPER" -eq 1 ]; then
set_super
fi
diff --git a/root-galera/usr/share/container-scripts/mysql/init/53-pma.sh b/mysql/root-galera/usr/share/container-scripts/mysql/init/53-pma.sh
index 5644b8f..5644b8f 100644
--- a/root-galera/usr/share/container-scripts/mysql/init/53-pma.sh
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/init/53-pma.sh
diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh
new file mode 100644
index 0000000..c717e9d
--- /dev/null
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh
@@ -0,0 +1,24 @@
+export MYSQL_LOG_BIN=${MYSQL_LOG_BIN:-1}
+export MYSQL_SYNC_BINLOG=${MYSQL_SYNC_BINLOG:-0}
+export MYSQL_LOG_SLAVE_UPDATES=${MYSQL_LOG_SLAVE_UPDATES:-0}
+export MYSQL_BINLOG_SYNC_DELAY=${MYSQL_BINLOG_SYNC_DELAY:-0}
+export MYSQL_BINLOG_NODELAY_COUNT=${MYSQL_BINLOG_NODELAY_COUNT:-0}
+export MYSQL_FLUSH_LOG_TYPE=${MYSQL_FLUSH_LOG_TYPE:-2}
+export MYSQL_FLUSH_LOG_TIMEOUT=${MYSQL_FLUSH_LOG_TIMEOUT:-1}
+
+export MYSQL_SLAVE_WORKERS=${MYSQL_SLAVE_WORKERS:-4}
+export MYSQL_SLAVE_SKIP_ERRORS=${MYSQL_SLAVE_SKIP_ERRORS:-ddl_exist_errors}
+
+log_info 'Processing basic Ands configuration files ...'
+envsubst < ${CONTAINER_SCRIPTS_PATH}/pre-init/ands-tuning.cnf.template > /etc/my.cnf.d/ands-tuning.cnf
+
+if [ -v MYSQL_RUNNING_AS_SLAVE ] ; then
+ log_info 'Processing basic Ands configuration for replication (slave only) files ...'
+ envsubst < ${CONTAINER_SCRIPTS_PATH}/pre-init/ands-slave.cnf.template > /etc/my.cnf.d/ands-slave.cnf
+
+ if [ $MYSQL_LOG_BIN -ne 0 ]; then
+ log_info 'Enabling log-bin in slave configuration files ...'
+ envsubst < ${CONTAINER_SCRIPTS_PATH}/pre-init/ands-slave-logbin.cnf.template > /etc/my.cnf.d/ands-slave-logbin.cnf
+ fi
+fi
+
diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave-logbin.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave-logbin.cnf.template
new file mode 100644
index 0000000..78c42e8
--- /dev/null
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave-logbin.cnf.template
@@ -0,0 +1,2 @@
+[mysqld]
+log_bin = ${MYSQL_DATADIR}/mysql-bin.log
diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template
new file mode 100644
index 0000000..eae1e6a
--- /dev/null
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template
@@ -0,0 +1,5 @@
+[mysqld]
+slave_parallel_type=LOGICAL_CLOCK
+slave_parallel_workers=${MYSQL_SLAVE_WORKERS}
+log_slave_updates=${MYSQL_LOG_SLAVE_UPDATES}
+slave_skip_errors=${MYSQL_SLAVE_SKIP_ERRORS}
diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template
new file mode 100644
index 0000000..c5991df
--- /dev/null
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template
@@ -0,0 +1,6 @@
+[mysqld]
+sync_binlog=${MYSQL_SYNC_BINLOG}
+binlog_group_commit_sync_delay=${MYSQL_BINLOG_SYNC_DELAY}
+binlog_group_commit_sync_no_delay_count=${MYSQL_BINLOG_NODELAY_COUNT}
+innodb_flush_log_at_trx_commit=${MYSQL_FLUSH_LOG_TYPE}
+innodb_flush_log_at_timeout=${MYSQL_FLUSH_LOG_TIMEOUT}
diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-master.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-master.cnf.template
new file mode 100644
index 0000000..7c4c511
--- /dev/null
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-master.cnf.template
@@ -0,0 +1,7 @@
+[mysqld]
+
+server-id = ${MYSQL_SERVER_ID}
+log_bin = ${MYSQL_DATADIR}/mysql-bin.log
+#binlog_do_db = mysql
+#binlog_do_db = ${MYSQL_DATABASE}
+binlog_format = ${MYSQL_BINLOG_FORMAT}
diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-repl-gtid.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-repl-gtid.cnf.template
new file mode 100644
index 0000000..5e985ec
--- /dev/null
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-repl-gtid.cnf.template
@@ -0,0 +1,6 @@
+[mysqld]
+
+gtid_mode = ON
+#log-slave-updates = ON
+enforce-gtid-consistency = ON
+
diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-slave.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-slave.cnf.template
new file mode 100644
index 0000000..879b94a
--- /dev/null
+++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/my-slave.cnf.template
@@ -0,0 +1,7 @@
+[mysqld]
+
+server-id = ${MYSQL_SERVER_ID}
+#log_bin = ${MYSQL_DATADIR}/mysql-bin.log
+relay-log = ${MYSQL_DATADIR}/mysql-relay-bin.log
+#binlog_do_db = mysql
+#binlog_do_db = ${MYSQL_DATABASE}
diff --git a/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template.maria b/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template.maria
deleted file mode 100644
index 3adbf58..0000000
--- a/root-galera/usr/share/container-scripts/mysql/galera-init/galera.cnf.template.maria
+++ /dev/null
@@ -1,17 +0,0 @@
-[galera]
-wsrep_on = ON
-wsrep_provider = /usr/lib64/galera/libgalera_smm.so
-wsrep_sst_method = xtrabackup-v2
-default_storage_engine = innodb
-binlog_format = row
-innodb_autoinc_lock_mode = 2
-innodb_flush_log_at_trx_commit = 0
-query_cache_size = 0
-query_cache_type = 0
-
-wsrep_sst_auth=${MYSQL_GALERA_USER}:${MYSQL_GALERA_PASSWORD}
-wsrep_cluster_name=${MYSQL_GALERA_CLUSTER}
-
-# By default every node is standalone
-wsrep_cluster_address=gcomm://
-wsrep_node_address=127.0.0.1