Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM mariadb:latest
COPY galera.cnf /etc/mysql/conf.d/galera.cnf.template
RUN chown -R mysql:mysql /etc/mysql/conf.d

# Overwrite "mysqld" so we can intercept the
# Overwrite "mariadb" so we can intercept the
# call from the upstream entrypoint
COPY galera.sh /usr/local/sbin/mysqld
COPY galera.sh /usr/local/sbin/mariadb

ENV MYSQL_ROOT_PASSWORD="mariadb" \
MYSQL_USER="mariadb" \
Expand Down
4 changes: 3 additions & 1 deletion galera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if echo $* | grep -v -e '--skip-networking' | grep -v -e '--help'; then
CLUSTER_MEMBERS=`getent hosts tasks.$SERVICE_NAME | grep -v $IP_ADDRESS | awk '{print $1}'`
# Check we can see enough peers to form a Primary Component
if [ `getent hosts tasks.$SERVICE_NAME | wc -l` -lt $(((${CLUSTER_NODES}+1)/2)) ]; then
echo "Can't see enough peers to form a cluster; restarting."
RESTART_DELAY=$(((1 + $RANDOM % 10)*6))
echo "Can't see enough peers to form a cluster; restarting in ${RESTART_DELAY} seconds."
sleep $RESTART_DELAY
exit 1
fi
# If we're the first node then bootstrap the cluster
Expand Down