Files
sql-server-samples/samples/features/Azure Data Studio/Notebooks/Install cluster dependencies.ipynb
T

12 KiB

Install Dependencies to deploy SQL Server 2019 Big Data Clusters

The following tools are most important for managing, connecting to, and querying the cluster:

  • Azure CLI
  • kubectl
  • mssqlctl

The cell below tries to install these dependencies for you. If you still experience any issues in executing this cell then please install from the following Installation links below.

Tool Required Description Installation
mssqlctl Yes Command-line tool for installing and managing a big data cluster. Install
kubectl Yes Command-line tool for monitoring the underlying Kuberentes cluster (More info). Windows | Linux
Azure CLI For AKS Modern command-line interface for managing Azure services. Used with AKS big data cluster deployments (More info). Install

Steps

Provide overrides for any default installation parameters

You don’t need to provide any installation parameters, we’ll provide a set of default which will provide a good experience.

However, feel free to override any of the defaults provided below here:

In [ ]:
mssql_version=""
docker_registry=""

windows_azcli_url=""
windows_kubectl_url=""

azure_cli_use_force_install_option = None
azure_cli_use_user_install_option = None

mssqlctl_url="" # url to download mssqlctl from (without ending filename)
mssqlctl_use_force_install_option = None
mssqlctl_use_user_install_option = None

skip_mssqlctl_uninstall = None
skip_mssqlctl_install = None

Provide default installation parameters

A default set of parameters to provide a good initial experience of SQL Server 2019 big data clusters.

In [ ]:
if mssql_version=="":
    mssql_version="ctp-2.5"

if windows_azcli_url=="":
    windows_azcli_url="https://aka.ms/installazurecliwindows"

if windows_kubectl_url=="":
    windows_kubectl_url="https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/windows/amd64/kubectl.exe"

if docker_repository=="":
    docker_repository="aris-p-release-candidate-gb"

if mssqlctl_url=="":
    mssqlctl_url=""http://helsinki/browse/packages/python/{0}/mssqlctl/{1}".format(docker_repository, 'requirements.txt')

if azure_cli_use_force_install_option is None:
    azure_cli_use_force_install_option = False

if azure_cli_use_user_install_option is None:
    azure_cli_use_user_install_option = True

if mssqlctl_use_force_install_option is None:
    mssqlctl_use_force_install_option = False

if mssqlctl_use_user_install_option is None:
    mssqlctl_use_user_install_option = True

if skip_mssqlctl_uninstall is None:
    skip_mssqlctl_uninstall = True

if skip_mssqlctl_install is None:
    skip_mssqlctl_install = False

print('mssql_version = ' + mssql_version)
print('docker_registry = ' + docker_registry)
print('azure_cli_use_force_install_option = ' + str(azure_cli_use_force_install_option))
print('azure_cli_use_user_install_option = ' + str(azure_cli_use_user_install_option))
print('mssqlctl_url = ' + mssqlctl_url)
print('mssqlctl_use_force_install_option = ' + str(mssqlctl_use_force_install_option))
print('mssqlctl_use_user_install_option = ' + str(mssqlctl_use_user_install_option))
print('skip_mssqlctl_uninstall = ' + str(skip_mssqlctl_uninstall))
print('skip_mssqlctl_install = ' + str(skip_mssqlctl_install))

Install Azure CLI

In [ ]:
import sys

force_install_option='--force-install' if azure_cli_use_force_install_option else ''
user_install_option='--user' if azure_cli_use_user_install_option else ''

print(f'START: !{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}\n')

!{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}
if _exit_code != 0:
   raise SystemExit('Shell command:\n\n\t!{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

print(f'\nSUCCESS: !{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}')

Install Kubernetes CLI

In [ ]:
import platform
import requests
import sys

if platform.system()=="Darwin":
    print(f'START:     !brew update\n')

    !brew update
    if _exit_code != 0:
       raise SystemExit('Shell command:\n\n\t    !brew update\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

    print(f'\nSUCCESS:     !brew update')
    print(f'START:     !brew install kubernetes-cli\n')

    !brew install kubernetes-cli
    if _exit_code != 0:
       raise SystemExit('Shell command:\n\n\t    !brew install kubernetes-cli\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

    print(f'\nSUCCESS:     !brew install kubernetes-cli')
elif platform.system()=="Windows":
    print(f'START:     !curl -LO {windows_kubectl_url}\n')

    !curl -LO {windows_kubectl_url}
    if _exit_code != 0:
       raise SystemExit('Shell command:\n\n\t    !curl -LO {windows_kubectl_url}\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

    print(f'\nSUCCESS:     !curl -LO {windows_kubectl_url}')
elif platform.system()=="Linux":
    print(f'START:     !sudo apt-get update\n')

    !sudo apt-get update
    if _exit_code != 0:
       raise SystemExit('Shell command:\n\n\t    !sudo apt-get update\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

    print(f'\nSUCCESS:     !sudo apt-get update')
    print(f'START:     !sudo apt-get install -y kubectl\n')

    !sudo apt-get install -y kubectl
    if _exit_code != 0:
       raise SystemExit('Shell command:\n\n\t    !sudo apt-get install -y kubectl\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

    print(f'\nSUCCESS:     !sudo apt-get install -y kubectl')
else:
    raise SystemExit("Platform '{0}' is not recognized, must be 'Darwin', 'Windows' or 'Linux'".format(platform.system()))

Uninstall MSSQLCTL CLI

In [ ]:
import sys

if not skip_mssqlctl_uninstall:
    print(f'START:     !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki\n')

    !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki
    if _exit_code != 0:
       raise SystemExit('Shell command:\n\n\t    !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

    print(f'\nSUCCESS:     !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki')

Install MSSQLCTL CLI

In [ ]:
import sys

force_install_option='--force-install' if mssqlctl_use_force_install_option else ''
user_install_option='--user' if mssqlctl_use_user_install_option else ''

if not skip_mssqlctl_install:
    print(f'START:     !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki\n')

    !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki
    if _exit_code != 0:
       raise SystemExit('Shell command:\n\n\t    !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki\n\nreturned non-zero exit code: ' + str(_exit_code) + '.\n')

    print(f'\nSUCCESS:     !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki')