我正在使用Powershell脚本在Azure实例容器(ACI)中使文件存储具有持久性的sql服务器。
我执行以下步骤1.创建资源组2.创建文件存储3.创建一个使用文件存储的SQL Server容器。4.从容器中检索所有日志
我的问题是容器中的sql服务器无法使用文件存储中的文件/数据位置启动。
我可以使用docker看到使用了-v或-mount参数,但是尝试没有成功。
因此将不胜感激
谢谢你。
Mikael
Powershell脚本
param (
# The ressource group name
$ressourceGroup = "sql-container",
# Location for where the instance is placed
$location = "WestEurope",
# Image name to download
$imageName = "mcr.microsoft.com/mssql/server:latest-ubuntu",
# Dns name for this instanse
$dnsName = "sql-test99",
# Database instanse name
$databaseInstanseName = "mssql-2019",
# Database collatino type
$databaseCollation = "Danish_Norwegian_CI_AS",
# Database login name
$databaseLoginName = "SA",
# Database login name
$databaseLoginPassword = "!thisWillMakeMyDayEveryDayIn2019",
# Database default locations
$databaseDefaultLocation = "/mnt/mydata/",
# SQL server name
$sqlServerFullName = $dnsName + "." + $location + ".azurecontainer.io",
# Storage account name
$storage_account_name = "mikaelsqlstorageaccount",
# Storage share name
$storage_share_name = "sqlsharestorage",
# Storage key
$storage_key
)
az group create --name $ressourceGroup --location $location
az Storage account create --resource-group $ressourceGroup --name $storage_account_name --location $location --sku Standard_LRS
az Storage share create --name $storage_share_name --account-name $storage_account_name
$script:storage_key=$(az Storage account keys list --resource-group $ressourceGroup --account-name $storage_account_name --query "[0].value" --output tsv)
az container create --image $imageName --name $databaseInstanseName --resource-group $ressourceGroup --cpu 1 --memory 3.5 --port 1433 --ip-address public -e ACCEPT_EULA=Y MSSQL_SA_PASSWORD=$databaseLoginPassword MSSQL_PID=Developer MSSQL_COLLATION=$databaseCollation MSSQL_ENABLE_HADR=Y MSSQL_BACKUP_DIR=$databaseDefaultLocation MSSQL_DATA_DIR=$databaseDefaultLocation MSSQL_LOG_DIR=$databaseDefaultLocation MSSQL_DUMP_DIR=$databaseDefaultLocation --location $location --dns-name-label $dnsName --azure-file-volume-account-name $storage_account_name --azure-file-volume-account-key $storage_key --azure-file-volume-share-name $storage_share_name --azure-file-volume-mount-path $databaseDefaultLocation
az container logs --resource-group $ressourceGroup --name $databaseInstanseName
SQL容器日志
2019-10-07 08:41:08.07 Server Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2019-10-07 08:41:08.07 Server Registry startup parameters:
-d /var/opt/mssql/data/master.mdf
-l /var/opt/mssql/data/mastlog.ldf
-e /var/opt/mssql/log/errorlog
.
.
2019-10-07 08:41:19.84 spid16s index restored for master.syspriorities.
2019-10-07 08:41:20.45 spid30s ***Stack Dump being sent to /mnt/mydata/SQLDump0001.txt
2019-10-07 08:41:20.49 spid30s SqlDumpExceptionHandler: Process 30 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.