Sql server ACI sql server容器在启动时不指向文件存储
我正在寻找使用powershell脚本在Azure实例容器(ACI)中创建具有文件存储持久性的sql server 我执行以下步骤 1.创建资源组 2.创建文件存储 3.创建使用文件存储的sql server容器。 4.从容器中检索所有日志 我的问题是容器中的sql server没有使用文件存储中的文件/数据位置启动 我可以看到使用docker时使用了参数-v或-mount,但我的尝试没有成功 因此,任何帮助都将不胜感激 提前谢谢你 米凯尔 Powershell脚本Sql server ACI sql server容器在启动时不指向文件存储,sql-server,azure,azure-container-service,azure-container-instances,Sql Server,Azure,Azure Container Service,Azure Container Instances,我正在寻找使用powershell脚本在Azure实例容器(ACI)中创建具有文件存储持久性的sql server 我执行以下步骤 1.创建资源组 2.创建文件存储 3.创建使用文件存储的sql server容器。 4.从容器中检索所有日志 我的问题是容器中的sql server没有使用文件存储中的文件/数据位置启动 我可以看到使用docker时使用了参数-v或-mount,但我的尝试没有成功 因此,任何帮助都将不胜感激 提前谢谢你 米凯尔 Powershell脚本 param ( #
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.
根据您提供的消息,可能的原因是装载路径应该是
/mnt/mydata/
。因此,您需要使用正确的路径格式更改变量databaseDefaultLocation
。你也可以看到这个例子
顺便说一下,永久卷不支持ACI中的Windows容器。所以你也需要注意它。有关更多详细信息,请参阅注释还有其他问题吗?它能解决你的问题吗?如果它解决了你的问题,请接受它作为答案。现在呢?你解决问题了吗?嗨,查尔斯,谢谢你的回复。我已使用/mnt/mydata/更新了databaseDefaultLocation,看起来sql server正在使用新路径来存储转储文件,而不是数据和备份文件。我已使用sql容器中的部分日志文件更新了该问题。启动参数仍然指向/var/opt/mssql/,关于我在ubuntu容器中使用sql server的持久卷和windows容器。那么windows问题应该是个问题吗?@MikaelBraadNielsen首先,如果你使用Ubuntu的基本映像,windows问题就不会出现。那么,当您使用持久卷时,您想要什么?问题是什么?嗨,Charles Xu,在更正了解决问题的路径后,我的数据库现在显示在文件存储中。非常好,非常感谢你的帮助,问候Mikael@MikaelBraadNielsen那么,你可以接受这个答案:-)