Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
open-source
docker-pxc
Commits
7cb62aee
Commit
7cb62aee
authored
Feb 06, 2018
by
Fabio Montefuscolo
Browse files
Cluster is now running connected
parent
0db213ac
Pipeline
#2950
passed with stage
in 1 minute and 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
39 deletions
+9
-39
Dockerfile
Dockerfile
+1
-1
entrypoint/main.sh
entrypoint/main.sh
+8
-38
No files found.
Dockerfile
View file @
7cb62aee
...
...
@@ -57,4 +57,4 @@ EXPOSE 3306 4567 4568
COPY
entrypoint /entrypoint
ENTRYPOINT
["/bin/bash", "/entrypoint/main.sh"]
CMD
["/usr/sbin/mysqld"
, "--user=mysql"
]
CMD
["/usr/sbin/mysqld"]
entrypoint/main.sh
View file @
7cb62aee
...
...
@@ -31,25 +31,13 @@ then
export
CLUSTER_JOIN
fi
IFS
=
","
latest
=
"-1"
leader
=
""
online
=
""
IFS
=
","
for
ip
in
$CLUSTER_JOIN
;
do
if
ping
-n
-c1
-W1
$ip
>
&-
;
then
leader
=
"
${
leader
:-
$ip
}
"
res
=
$(
curl
-sS
"http://
$ip
:8888/grastate/seqno"
)
res
=
"
${
res
:-
$latest
}
"
if
[[
"
${
res
}
"
-gt
"
$latest
"
]]
;
then
latest
=
"
$res
"
leader
=
"
$ip
"
fi
if
[
-z
"
$online
"
]
;
then
online
=
"
$ip
"
...
...
@@ -64,36 +52,18 @@ IFS="
if
[
"
$(
basename
$1
)
"
=
"mysqld"
]
;
then
MYSQLD_ARGS
=(
"--wsrep_cluster_name='
$CLUSTER_NAME
'"
)
if
[
"
$leader
"
=
"
$MY_IP
"
]
;
then
if
[
"
$latest
"
==
"-1"
]
;
then
sed
-i
-e
'/^safe_to_bootstrap/s/0/1/'
"
${
PXC_DATA
}
/grastate.dat"
fi
MYSQLD_ARGS+
=(
"--wsrep-new-cluster"
)
MYSQLD_ARGS+
=(
"--wsrep_cluster_address=gcomm://
$MY_IP
?pc.wait_prim=no"
)
else
while
!
`
echo
1
>
/dev/tcp/
$leader
/3306
`
;
do
echo
"Waiting leader
$leader
"
;
sleep
5
done
MYSQLD_ARGS+
=(
"--wsrep_cluster_address='gcomm://
$online
'"
)
fi
rm
"
${
MYSQL_LOG_FILE
}
"
mkfifo
-m
777
"
${
MYSQL_LOG_FILE
}
"
cat
"
${
MYSQL_LOG_FILE
}
"
&
MYSQLD_ARGS+
=(
"--wsrep_sst_method=xtrabackup-v2"
)
MYSQLD_ARGS+
=(
"--wsrep_sst_auth='xtrabackup:
$XTRABACKUP_PASSWORD
'"
)
MYSQLD_ARGS+
=(
"--wsrep_node_address='
$MY_IP
'"
)
echo
"
$@
$MYSQLD_ARGS
"
>
&2
$@
$MYSQLD_ARGS
set
--
"
$@
"
"--user=mysql"
set
--
"
$@
"
"--wsrep_cluster_name=
$CLUSTER_NAME
"
set
--
"
$@
"
"--wsrep_sst_method=xtrabackup-v2"
set
--
"
$@
"
"--wsrep_cluster_address=gcomm://
$online
"
set
--
"
$@
"
"--wsrep_sst_auth=xtrabackup:
$XTRABACKUP_PASSWORD
"
set
--
"
$@
"
"--wsrep_node_address=
$MY_IP
"
exec
"
$@
"
else
exec
"
$@
"
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment