File tree Expand file tree Collapse file tree
samples/features/sql-big-data-cluster Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,9 +4,8 @@ setlocal enableextensions
44set CLUSTER_NAMESPACE = %1
55set SQL_MASTER_IP = %2
66set SQL_MASTER_SA_PASSWORD = %3
7- set BACKUP_FILE_PATH = %~4
8- set KNOX_IP = %5
9- set KNOX_PASSWORD = %6
7+ set KNOX_IP = %3
8+ set KNOX_PASSWORD = %4
109set STARTUP_PATH = %~dp0
1110
1211if NOT DEFINED CLUSTER_NAMESPACE goto :usage
@@ -19,15 +18,19 @@ if NOT DEFINED KNOX_PASSWORD set KNOX_PASSWORD=%SQL_MASTER_SA_PASSWORD%
1918set SQL_MASTER_INSTANCE = %SQL_MASTER_IP% ,31433
2019set KNOX_ENDPOINT = %KNOX_IP% :30443
2120
22- echo Verifying sqlcmd.exe is in path & CALL WHERE /Q sqlcmd.exe || GOTO exit
23- echo Verifying bcp.exe is in path & CALL WHERE /Q bcp.exe || GOTO exit
24- echo Verifying kubectl.exe is in path & CALL WHERE /Q kubectl.exe || echo HINT: Install the kubernetes-cli - https://kubernetes.io/docs/tasks/tools/install-kubectl && GOTO exit
25- echo Verifying curl.exe is in path & CALL WHERE /Q curl.exe || echo HINT: Install curl - https://curl.haxx.se/download.html && GOTO exit
21+ for %%F in (sqlcmd.exe bcp.exe kubectl.exe curl.exe) do (
22+ echo Verifying %%F is in path & CALL WHERE /Q %%F || GOTO exit
23+ )
24+
25+ pushd " %tmp% "
26+ echo Downloading sample database backup file...
27+ curl -G " https://sqlchoice.blob.core.windows.net/sqlchoice/static/tpcxbb_1gb.bak" -o tpcxbb_1gb.bak
2628
2729REM Copy the backup file, restore the database, create necessary objects and data file
2830echo Copying database backup file...
29- pushd " %BACKUP_FILE_PATH% "
3031%DEBUG% kubectl cp tpcxbb_1gb.bak mssql-master-pool-0:/var/opt/mssql/data -c mssql-server -n %CLUSTER_NAMESPACE% || goto exit
32+
33+ del tpcxbb_1gb.bak > NUL
3134popd
3235
3336echo Configuring sample database...
Original file line number Diff line number Diff line change 11#! /bin/bash
22set -e
33set -o pipefail
4- USAGE_MESSAGE=" USAGE: $0 <CLUSTER_NAMESPACE> <SQL_MASTER_IP> <SQL_MASTER_SA_PASSWORD> <BACKUP_FILE_PATH> < KNOX_IP> [<KNOX_PASSWORD>]"
4+ USAGE_MESSAGE=" USAGE: $0 <CLUSTER_NAMESPACE> <SQL_MASTER_IP> <SQL_MASTER_SA_PASSWORD> <KNOX_IP> [<KNOX_PASSWORD>]"
55ERROR_MESSAGE=" Bootstrap of the sample database failed."
66
77# Print usage if mandatory parameters are missing
88: " ${1:? $USAGE_MESSAGE } "
99: " ${2:? $USAGE_MESSAGE } "
1010: " ${3:? $USAGE_MESSAGE } "
1111: " ${4:? $USAGE_MESSAGE } "
12- : " ${5:? $USAGE_MESSAGE } "
1312: " ${DEBUG=} "
1413
1514# Save the input parameters
1615CLUSTER_NAMESPACE=$1
1716SQL_MASTER_IP=$2
1817SQL_MASTER_SA_PASSWORD=$3
19- BACKUP_FILE_PATH=$4
20- KNOX_IP=$5
21- KNOX_PASSWORD=$6
18+ KNOX_IP=$4
19+ KNOX_PASSWORD=$5
2220# If Knox password is not supplied then default to SQL Master password
2321KNOX_PASSWORD=${KNOX_PASSWORD:= $SQL_MASTER_SA_PASSWORD }
2422
2523SQL_MASTER_INSTANCE=$SQL_MASTER_IP ,31433
2624KNOX_ENDPOINT=$KNOX_IP :30443
2725
26+
27+ for util in sqlcmd.exe bcp.exe kubectl.exe curl.exe
28+ do
29+ echo Verifying $util is in path & which $util 1> NUL 2> NUL || (echo Unable to locate $util && exit 1)
30+ done
31+
2832# Copy the backup file, restore the database, create necessary objects and data file
33+ pushd " /tmp"
34+ echo Downloading sample database backup file...
35+ $DEBUG curl -G " https://sqlchoice.blob.core.windows.net/sqlchoice/static/tpcxbb_1gb.bak" -o tpcxbb_1gb.bak
36+
2937echo Copying database backup file...
30- pushd " $BACKUP_FILE_PATH "
3138$DEBUG kubectl cp tpcxbb_1gb.bak mssql-master-pool-0:/var/opt/mssql/data -c mssql-server -n $CLUSTER_NAMESPACE || (echo $ERROR_MESSAGE && exit 1)
39+ rm tpcxbb_1gb.bak
3240popd
3341
3442echo Configuring sample database...
You can’t perform that action at this time.
0 commit comments