mongodb - 无法在 azure 容器实例中将 azure 文件共享装载为 mongodb 卷

标签 mongodb azure azure-container-instances

我正在尝试使用 azure 容器实例设置 mongo DB 实例并将其安装在 Azure 文件共享上。

我们收到以下错误:

[initandlisten] WiredTiger error (1) [1579245437:724939][1:0x7f9419c67b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1579245437:724939][1:0x7f9419c67b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
W  STORAGE  [initandlisten] Failed to start up WiredTiger under any compatibility version.
F  STORAGE  [initandlisten] Reason: 1: Operation not permitted
F  -        [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 789
[initandlisten] 

***aborting after fassert() failure

AZ 命令我使用以下命令来创建存储帐户、文件共享和容器实例:

az storage account create -g $resourcegroup -n $storageaccount --sku Standard_LRS

az storage share create --name $mongofileshare --account-name $storageaccount

az container create --resource-group $resourcegroup --name $containername --image mongo:latest --dns-name-label $DNSName --ports 27017 --protocol TCP --environment-variables 'MONGO_INITDB_ROOT_USERNAME=admin' 'MONGO_INITDB_ROOT_PASSWORD=*******' --location westeurope --azure-file-volume-account-name $storageaccount --azure-file-volume-account-key '**********' --azure-file-volume-share-name 'mongofileshare' --azure-file-volume-mount-path '/data/db'

最佳答案

非常感谢上面的@Charles Xu 和@Santhosh,你们拯救了我的一天。在这里,我使用 AKS、mongoDB 和 Azure Fileshare 的工作 yaml 总结了他们的解决方案:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-db
  template:
    metadata:
      labels:
        app: mongo-db
    spec:
      nodeSelector:
        "beta.kubernetes.io/os": linux
      containers:
      - name: mongo-db
        image: mongo:latest
        command: ["mongod"] # Note here
        args: ["--dbpath=/data/mongoaz"] # Note here 
        ports:
        - containerPort: 27017
          name: redis
        resources:
          requests:
            cpu: 250m
          limits:
            cpu: 500m
        volumeMounts:
        - name: db-vol
          mountPath: /data/mongoaz
      volumes:
      - name: db-vol
        persistentVolumeClaim:
          claimName: my-db-pvc

关于mongodb - 无法在 azure 容器实例中将 azure 文件共享装载为 mongodb 卷,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59783143/

相关文章:

c# - 使用 C# 通过 VNet 创建 Azure 容器实例

azure - "ACI integration does not support labels in compose applications"但我没有指定任何服务标签

Azure Functions-新-AzContainerGroup : Object reference not set to an instance of an object

javascript - 我使用 auth0 进行用户身份验证,并且有一个用于 CRUD 帖子的 API(标题、img、desc)。如何对 CRUD api 进行经过身份验证的调用?

php - 从mysql背景理解mongodb结构

node.js - Mongoose 游标 batchSize

c# - azure 缓存性能不佳

iis - 在 Azure 中将应用程序池的标识设置为 LocalSystem

azure - 如何将 json 文件作为参数传递给 Azure Powershell Runbook?

mongodb - 在chicagoboss中使用orelse (OR)编写查询