mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Add notebook for installing cluster dependencies
This commit is contained in:
@@ -0,0 +1,316 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Install Dependencies to deploy SQL Server 2019 Big Data Clusters\n",
|
||||
"----------------------------------------------------------------\n",
|
||||
"\n",
|
||||
"The following tools are most important for managing, connecting to, and\n",
|
||||
"querying the cluster:\n",
|
||||
"\n",
|
||||
"- **Azure CLI**\n",
|
||||
"- **kubectl**\n",
|
||||
"- **mssqlctl**\n",
|
||||
"\n",
|
||||
"**The cell below tries to install these dependencies for you. If you\n",
|
||||
"still experience any issues in executing this cell then please install\n",
|
||||
"from the following Installation links below.**\n",
|
||||
"\n",
|
||||
"<table>\n",
|
||||
"<colgroup>\n",
|
||||
"<col style=\"width: 27%\" />\n",
|
||||
"<col style=\"width: 24%\" />\n",
|
||||
"<col style=\"width: 24%\" />\n",
|
||||
"<col style=\"width: 24%\" />\n",
|
||||
"</colgroup>\n",
|
||||
"<thead>\n",
|
||||
"<tr class=\"header\">\n",
|
||||
"<th>Tool</th>\n",
|
||||
"<th>Required</th>\n",
|
||||
"<th>Description</th>\n",
|
||||
"<th>Installation</th>\n",
|
||||
"</tr>\n",
|
||||
"</thead>\n",
|
||||
"<tbody>\n",
|
||||
"<tr class=\"odd\">\n",
|
||||
"<td><strong>mssqlctl</strong></td>\n",
|
||||
"<td>Yes</td>\n",
|
||||
"<td>Command-line tool for installing and managing a big data cluster.</td>\n",
|
||||
"<td><a href=\"deploy-install-mssqlctl.md\">Install</a></td>\n",
|
||||
"</tr>\n",
|
||||
"<tr class=\"even\">\n",
|
||||
"<td><strong>kubectl</strong></td>\n",
|
||||
"<td>Yes</td>\n",
|
||||
"<td>Command-line tool for monitoring the underlying Kuberentes cluster (<a href=\"https://kubernetes.io/docs/tasks/tools/install-kubectl/\">More info</a>).</td>\n",
|
||||
"<td><a href=\"https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-powershell-from-psgallery\">Windows</a> | <a href=\"https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-using-native-package-management\">Linux</a></td>\n",
|
||||
"</tr>\n",
|
||||
"<tr class=\"odd\">\n",
|
||||
"<td><strong>Azure CLI</strong></td>\n",
|
||||
"<td>For AKS</td>\n",
|
||||
"<td>Modern command-line interface for managing Azure services. Used with AKS big data cluster deployments (<a href=\"https://docs.microsoft.com/cli/azure/?view=azure-cli-latest\">More info</a>).</td>\n",
|
||||
"<td><a href=\"https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest\">Install</a></td>\n",
|
||||
"</tr>\n",
|
||||
"</tbody>\n",
|
||||
"</table>\n",
|
||||
"\n",
|
||||
"Steps\n",
|
||||
"-----\n",
|
||||
"\n",
|
||||
"### Provide overrides for any default installation parameters\n",
|
||||
"\n",
|
||||
"You don’t need to provide any installation parameters, we’ll provide a\n",
|
||||
"set of default which will provide a good experience.\n",
|
||||
"\n",
|
||||
"However, feel free to override any of the defaults provided below here:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"mssql_version=\"\"\n",
|
||||
"docker_registry=\"\"\n",
|
||||
"\n",
|
||||
"windows_azcli_url=\"\"\n",
|
||||
"windows_kubectl_url=\"\"\n",
|
||||
"\n",
|
||||
"azure_cli_use_force_install_option = None\n",
|
||||
"azure_cli_use_user_install_option = None\n",
|
||||
"\n",
|
||||
"mssqlctl_url=\"\" # url to download mssqlctl from (without ending filename)\n",
|
||||
"mssqlctl_use_force_install_option = None\n",
|
||||
"mssqlctl_use_user_install_option = None\n",
|
||||
"\n",
|
||||
"skip_mssqlctl_uninstall = None\n",
|
||||
"skip_mssqlctl_install = None"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Provide default installation parameters\n",
|
||||
"\n",
|
||||
"A default set of parameters to provide a good initial experience of SQL\n",
|
||||
"Server 2019 big data clusters."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"if mssql_version==\"\":\n",
|
||||
" mssql_version=\"ctp-2.5\"\n",
|
||||
"\n",
|
||||
"if windows_azcli_url==\"\":\n",
|
||||
" windows_azcli_url=\"https://aka.ms/installazurecliwindows\"\n",
|
||||
"\n",
|
||||
"if windows_kubectl_url==\"\":\n",
|
||||
" windows_kubectl_url=\"https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/windows/amd64/kubectl.exe\"\n",
|
||||
"\n",
|
||||
"if docker_repository==\"\":\n",
|
||||
" docker_repository=\"aris-p-release-candidate-gb\"\n",
|
||||
"\n",
|
||||
"if mssqlctl_url==\"\":\n",
|
||||
" mssqlctl_url=\"\"http://helsinki/browse/packages/python/{0}/mssqlctl/{1}\".format(docker_repository, 'requirements.txt')\n",
|
||||
"\n",
|
||||
"if azure_cli_use_force_install_option is None:\n",
|
||||
" azure_cli_use_force_install_option = False\n",
|
||||
"\n",
|
||||
"if azure_cli_use_user_install_option is None:\n",
|
||||
" azure_cli_use_user_install_option = True\n",
|
||||
"\n",
|
||||
"if mssqlctl_use_force_install_option is None:\n",
|
||||
" mssqlctl_use_force_install_option = False\n",
|
||||
"\n",
|
||||
"if mssqlctl_use_user_install_option is None:\n",
|
||||
" mssqlctl_use_user_install_option = True\n",
|
||||
"\n",
|
||||
"if skip_mssqlctl_uninstall is None:\n",
|
||||
" skip_mssqlctl_uninstall = True\n",
|
||||
"\n",
|
||||
"if skip_mssqlctl_install is None:\n",
|
||||
" skip_mssqlctl_install = False\n",
|
||||
"\n",
|
||||
"print('mssql_version = ' + mssql_version)\n",
|
||||
"print('docker_registry = ' + docker_registry)\n",
|
||||
"print('azure_cli_use_force_install_option = ' + str(azure_cli_use_force_install_option))\n",
|
||||
"print('azure_cli_use_user_install_option = ' + str(azure_cli_use_user_install_option))\n",
|
||||
"print('mssqlctl_url = ' + mssqlctl_url)\n",
|
||||
"print('mssqlctl_use_force_install_option = ' + str(mssqlctl_use_force_install_option))\n",
|
||||
"print('mssqlctl_use_user_install_option = ' + str(mssqlctl_use_user_install_option))\n",
|
||||
"print('skip_mssqlctl_uninstall = ' + str(skip_mssqlctl_uninstall))\n",
|
||||
"print('skip_mssqlctl_install = ' + str(skip_mssqlctl_install))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Install Azure CLI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"force_install_option='--force-install' if azure_cli_use_force_install_option else ''\n",
|
||||
"user_install_option='--user' if azure_cli_use_user_install_option else ''\n",
|
||||
"\n",
|
||||
"print(f'START: !{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}\\n')\n",
|
||||
"\n",
|
||||
"!{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}\n",
|
||||
"if _exit_code != 0:\n",
|
||||
" 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')\n",
|
||||
"\n",
|
||||
"print(f'\\nSUCCESS: !{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Install Kubernetes CLI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import platform\n",
|
||||
"import requests\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"if platform.system()==\"Darwin\":\n",
|
||||
" print(f'START: !brew update\\n')\n",
|
||||
"\n",
|
||||
" !brew update\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" raise SystemExit('Shell command:\\n\\n\\t !brew update\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
|
||||
"\n",
|
||||
" print(f'\\nSUCCESS: !brew update')\n",
|
||||
" print(f'START: !brew install kubernetes-cli\\n')\n",
|
||||
"\n",
|
||||
" !brew install kubernetes-cli\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" raise SystemExit('Shell command:\\n\\n\\t !brew install kubernetes-cli\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
|
||||
"\n",
|
||||
" print(f'\\nSUCCESS: !brew install kubernetes-cli')\n",
|
||||
"elif platform.system()==\"Windows\":\n",
|
||||
" print(f'START: !curl -LO {windows_kubectl_url}\\n')\n",
|
||||
"\n",
|
||||
" !curl -LO {windows_kubectl_url}\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" raise SystemExit('Shell command:\\n\\n\\t !curl -LO {windows_kubectl_url}\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
|
||||
"\n",
|
||||
" print(f'\\nSUCCESS: !curl -LO {windows_kubectl_url}')\n",
|
||||
"elif platform.system()==\"Linux\":\n",
|
||||
" print(f'START: !sudo apt-get update\\n')\n",
|
||||
"\n",
|
||||
" !sudo apt-get update\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" raise SystemExit('Shell command:\\n\\n\\t !sudo apt-get update\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
|
||||
"\n",
|
||||
" print(f'\\nSUCCESS: !sudo apt-get update')\n",
|
||||
" print(f'START: !sudo apt-get install -y kubectl\\n')\n",
|
||||
"\n",
|
||||
" !sudo apt-get install -y kubectl\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" raise SystemExit('Shell command:\\n\\n\\t !sudo apt-get install -y kubectl\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
|
||||
"\n",
|
||||
" print(f'\\nSUCCESS: !sudo apt-get install -y kubectl')\n",
|
||||
"else:\n",
|
||||
" raise SystemExit(\"Platform '{0}' is not recognized, must be 'Darwin', 'Windows' or 'Linux'\".format(platform.system()))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Uninstall MSSQLCTL CLI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"if not skip_mssqlctl_uninstall:\n",
|
||||
" print(f'START: !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki\\n')\n",
|
||||
"\n",
|
||||
" !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" 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')\n",
|
||||
"\n",
|
||||
" print(f'\\nSUCCESS: !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Install MSSQLCTL CLI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"force_install_option='--force-install' if mssqlctl_use_force_install_option else ''\n",
|
||||
"user_install_option='--user' if mssqlctl_use_user_install_option else ''\n",
|
||||
"\n",
|
||||
"if not skip_mssqlctl_install:\n",
|
||||
" print(f'START: !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki\\n')\n",
|
||||
"\n",
|
||||
" !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" 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')\n",
|
||||
"\n",
|
||||
" print(f'\\nSUCCESS: !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki')"
|
||||
]
|
||||
}
|
||||
],
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5,
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"name": "python3",
|
||||
"display_name": "Python 3"
|
||||
},
|
||||
"azdata": {
|
||||
"test": {
|
||||
"strategy": "Sequential",
|
||||
"dri": false,
|
||||
"ci": false,
|
||||
"gci": false
|
||||
},
|
||||
"publish": {
|
||||
"access": {
|
||||
"current": "Internal",
|
||||
"goal": "Public"
|
||||
},
|
||||
"state": "Draft"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user