File tree Expand file tree Collapse file tree 2 files changed +25
-14
lines changed
samples/features/sql-big-data-cluster Expand file tree Collapse file tree 2 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,8 @@ setlocal enableextensions
4
4
set CLUSTER_NAMESPACE = %1
5
5
set SQL_MASTER_IP = %2
6
6
set 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
10
9
set STARTUP_PATH = %~dp0
11
10
12
11
if NOT DEFINED CLUSTER_NAMESPACE goto :usage
@@ -19,15 +18,19 @@ if NOT DEFINED KNOX_PASSWORD set KNOX_PASSWORD=%SQL_MASTER_SA_PASSWORD%
19
18
set SQL_MASTER_INSTANCE = %SQL_MASTER_IP% ,31433
20
19
set KNOX_ENDPOINT = %KNOX_IP% :30443
21
20
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
26
28
27
29
REM Copy the backup file, restore the database, create necessary objects and data file
28
30
echo Copying database backup file...
29
- pushd " %BACKUP_FILE_PATH% "
30
31
%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
31
34
popd
32
35
33
36
echo Configuring sample database...
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
set -e
3
3
set -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>]"
5
5
ERROR_MESSAGE=" Bootstrap of the sample database failed."
6
6
7
7
# Print usage if mandatory parameters are missing
8
8
: " ${1:? $USAGE_MESSAGE } "
9
9
: " ${2:? $USAGE_MESSAGE } "
10
10
: " ${3:? $USAGE_MESSAGE } "
11
11
: " ${4:? $USAGE_MESSAGE } "
12
- : " ${5:? $USAGE_MESSAGE } "
13
12
: " ${DEBUG=} "
14
13
15
14
# Save the input parameters
16
15
CLUSTER_NAMESPACE=$1
17
16
SQL_MASTER_IP=$2
18
17
SQL_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
22
20
# If Knox password is not supplied then default to SQL Master password
23
21
KNOX_PASSWORD=${KNOX_PASSWORD:= $SQL_MASTER_SA_PASSWORD }
24
22
25
23
SQL_MASTER_INSTANCE=$SQL_MASTER_IP ,31433
26
24
KNOX_ENDPOINT=$KNOX_IP :30443
27
25
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
+
28
32
# 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
+
29
37
echo Copying database backup file...
30
- pushd " $BACKUP_FILE_PATH "
31
38
$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
32
40
popd
33
41
34
42
echo Configuring sample database...
You can’t perform that action at this time.
0 commit comments