Fix TiDB docker script using networks instead of deprecated `--link`
Also upgrade the image to version 5.4.3
This commit is contained in:
parent
0daa2c2646
commit
f45a7975c4
12
docker_db.sh
12
docker_db.sh
|
@ -917,12 +917,14 @@ EOF
|
|||
}
|
||||
|
||||
tidb() {
|
||||
tidb_5_1
|
||||
tidb_5_4
|
||||
}
|
||||
|
||||
tidb_5_1() {
|
||||
tidb_5_4() {
|
||||
$CONTAINER_CLI rm -f tidb || true
|
||||
$CONTAINER_CLI run --name tidb -p4000:4000 -d docker.io/pingcap/tidb:v5.1.4
|
||||
$CONTAINER_CLI network rm -f tidb_network || true
|
||||
$CONTAINER_CLI network create tidb_network
|
||||
$CONTAINER_CLI run --name tidb -p4000:4000 -d --network tidb_network docker.io/pingcap/tidb:v5.4.3
|
||||
# Give the container some time to start
|
||||
OUTPUT=
|
||||
n=0
|
||||
|
@ -936,7 +938,7 @@ tidb_5_1() {
|
|||
echo "Waiting for TiDB to start..."
|
||||
sleep 3
|
||||
done
|
||||
$CONTAINER_CLI run --link tidb:tidb -it --rm docker.io/mysql:8.2.0 mysql -htidb -P4000 -uroot -e "create database hibernate_orm_test; create user 'hibernate_orm_test' identified by 'hibernate_orm_test'; grant all on hibernate_orm_test.* to 'hibernate_orm_test';"
|
||||
$CONTAINER_CLI run -it --rm --network tidb_network docker.io/mysql:8.2.0 mysql -htidb -P4000 -uroot -e "create database hibernate_orm_test; create user 'hibernate_orm_test' identified by 'hibernate_orm_test'; grant all on hibernate_orm_test.* to 'hibernate_orm_test';"
|
||||
if [ "$n" -ge 5 ]; then
|
||||
echo "TiDB failed to start and configure after 15 seconds"
|
||||
else
|
||||
|
@ -983,7 +985,7 @@ if [ -z ${1} ]; then
|
|||
echo -e "\tpostgresql_12"
|
||||
echo -e "\tsybase"
|
||||
echo -e "\ttidb"
|
||||
echo -e "\ttidb_5_1"
|
||||
echo -e "\ttidb_5_4"
|
||||
else
|
||||
${1}
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue