简体   繁体   English

具有NFS安装作为卷映射的SQL Server Docker容器

[英]SQL Server docker container with NFS mount as volume mapping

I am trying to run SQL Server on ubuntu as a docker container using stranded microsoft/mssql-server-linux:latest docker image. 我试图使用搁浅的microsoft / mssql-server-linux:latest docker image在ubuntu上作为docker容器运行SQL Server。 For the data persistence I am mapping a volume from my host (having ext4 file system) to container using -v option in docker run command like below 为了数据持久性,我正在使用docker run命令中的-v选项将主机(具有ext4文件系统)的卷映射到容器,如下所示

docker run -it -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=######' -p 1433:1433 
               -v /var/opt/database:/var/opt/mssql/data microsoft/mssql-server-linux

Container is running just fine and i am able to connect to the database. 容器运行得很好,我能够连接到数据库。 But I do not want to store data on my host because of the growing size of the database and for swarm reasons. 但是由于数据库的规模不断扩大以及众多原因,我不想在主机上存储数据。 Now I thought to run a NFS server on some other machine and mount the nfs directory onto my docker host and then use that nfs dir on the volume mapping now the volume mapping is 现在我想在其他机器上运行NFS服务器并将nfs目录挂载到我的docker主机上,然后在卷映射上使用该nfs目录,因为卷映射是

-v /var/nfs/database:/var/opt/mssql/data 

where /var/nfs/database is a nfs mount dir on the docker host. 其中/var/nfs/database是Docker主机上的nfs挂载目录。 Now when I start the container I get the following error 现在,当我启动容器时,出现以下错误

2017-08-18 10:15:53.98 spid5s FCB::Open failed: Could not open file /var/opt/mssql/data/master.mdf for file number 1. OS error: 87(The parameter is incorrect.). 2017-08-18 10:15:53.98 spid5s FCB :: Open失败:无法为文件号1打开文件/var/opt/mssql/data/master.mdf。操作系统错误:87(参数不正确。)。 2017-08-18 10:15:53.98 spid5s Error: 5120, Severity: 16, State: 101. 2017-08-18 10:15:53.98 spid5s Unable to open the physical file "/var/opt/mssql/data/master.mdf". 2017-08-18 10:15:53.98 spid5s错误:5120,严重性:16,状态:101. 2017-08-18 10:15:53.98 spid5s无法打开物理文件“ / var / opt / mssql / data / master.mdf”。 Operating system error 87: "87(The parameter is incorrect.)". 操作系统错误87:“ 87(参数不正确。)”。 2017-08-18 10:15:54.13 spid5s Error: 17204, Severity: 16, State: 1. 2017-08-18 10:15:54.13 spid5s FCB::Open failed: Could not open file /var/opt/mssql/data/mastlog.ldf for file number 2. OS error: 87(The parameter is incorrect.). 2017-08-18 10:15:54.13 spid5s错误:17204,严重性:16,状态:1. 2017-08-18 10:15:54.13 spid5s FCB :: Open失败:无法打开文件/ var / opt / mssql /data/mastlog.ldf为文件号2。操作系统错误:87(参数不正确。)。 2017-08-18 10:15:54.13 spid5s Error: 5120, Severity: 16, State: 101. 2017-08-18 10:15:54.13 spid5s Unable to open the physical file "/var/opt/mssql/data/mastlog.ldf". 2017-08-18 10:15:54.13 spid5s错误:5120,严重性:16,状态:101. 2017-08-18 10:15:54.13 spid5s无法打开物理文件“ / var / opt / mssql / data / mastlog.ldf”。 Operating system error 87: "87(The parameter is incorrect.)". 操作系统错误87:“ 87(参数不正确。)”。

I have given all the permissions to database files. 我已授予数据库文件所有权限。 Below is the nfs mount snippet 以下是NFS安装片段

sharedstorageIp:/var/nfs nfs4 443G 47G 375G 11% /var/nfs sharedstorageIp:/ var / nfs nfs4 443G 47G 375G 11%/ var / nfs

The release notes explain that you can't do this: 发行说明说明您不能执行以下操作:

Hosting database files on a NFS server is not supported in this release. 此版本不支持在NFS服务器上托管数据库文件。 This includes using NFS for shared disk failover clustering as well as databases on non-clustered instances. 这包括使用NFS进行共享磁盘故障转移群集以及非群集实例上的数据库。 We are working on enabling NFS server support in the upcoming releases. 我们正在努力在即将发布的版本中启用NFS服务器支持。

Hosting database files on a networked path is not trivial, given the demands the database has for reliability. 考虑到数据库对可靠性的要求,在网络路径上托管数据库文件并非易事。 Hosting files on SMB shares wasn't possible until version 2.2 of the protocol. 在该协议的2.2版之前,无法在SMB共享上托管文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM