我正在尝试在我的 kubernetes 集群中启动 mongo 社区服务器。但是,它无法以以下错误启动:
k logs mongodb-0 -c mongod
2021-09-14T14:37:26.201Z INFO versionhook/main.go:34 Running version change post-start hook
2021-09-14T14:37:26.201Z INFO versionhook/main.go:41 Waiting for agent health status...
2021-09-14T14:37:27.201Z INFO versionhook/main.go:77 Pod should not be deleted, mongod started
tail: cannot open '/var/log/mongodb-mms-automation/mongodb.log' for reading: No such file or directory
2021-09-14T14:37:29.225+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2021-09-14T14:37:29.230+0000 W ASIO [main] No TransportLayer configured during NetworkInterface startup
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data 64-bit host=mongodb-0
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] db version v4.2.8
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] git version: 43d25964249164d76d5e04dd6cf38f6111e21f5f
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] allocator: tcmalloc
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] modules: none
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] build environment:
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] distmod: ubuntu1804
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] distarch: x86_64
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] target_arch: x86_64
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] 976 MB of memory available to the process out of 7976 MB total system memory
2021-09-14T14:37:29.318+0000 I CONTROL [initandlisten] options: { config: "/data/automation-mongod.conf", net: { bindIp: "0.0.0.0", port: 27017 }, replication: { replSetName: "mongodb" }, security: { authorization: "enabled", keyFile: "/var/lib/mongodb-mms-automation/authentication/keyfile" }, setParameter: { authenticationMechanisms: "SCRAM-SHA-256" }, storage: { dbPath: "/data", wiredTiger: { engineConfig: { journalCompressor: "zlib" } } } }
2021-09-14T14:37:29.319+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=zlib),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2021-09-14T14:37:30.405+0000 E STORAGE [initandlisten] WiredTiger error (17) [1631630250:405001][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists Raw: [1631630250:405001][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists
2021-09-14T14:37:30.406+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.5
2021-09-14T14:37:30.407+0000 E STORAGE [initandlisten] WiredTiger error (1) [1631630250:407162][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1631630250:407162][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted
2021-09-14T14:37:30.416+0000 E STORAGE [initandlisten] WiredTiger error (17) [1631630250:416135][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists Raw: [1631630250:416135][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists
2021-09-14T14:37:30.417+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.6
2021-09-14T14:37:30.420+0000 E STORAGE [initandlisten] WiredTiger error (1) [1631630250:420536][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1631630250:420536][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted
2021-09-14T14:37:30.431+0000 E STORAGE [initandlisten] WiredTiger error (17) [1631630250:431159][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists Raw: [1631630250:431159][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists
2021-09-14T14:37:30.432+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.7
2021-09-14T14:37:30.432+0000 E STORAGE [initandlisten] WiredTiger error (1) [1631630250:432961][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1631630250:432961][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted
2021-09-14T14:37:30.442+0000 E STORAGE [initandlisten] WiredTiger error (17) [1631630250:442982][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists Raw: [1631630250:442982][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists
2021-09-14T14:37:30.446+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.8
2021-09-14T14:37:30.447+0000 E STORAGE [initandlisten] WiredTiger error (1) [1631630250:447098][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1631630250:447098][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted
2021-09-14T14:37:30.481+0000 E STORAGE [initandlisten] WiredTiger error (17) [1631630250:481157][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists Raw: [1631630250:481157][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: File exists
2021-09-14T14:37:30.484+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.9
2021-09-14T14:37:30.486+0000 E STORAGE [initandlisten] WiredTiger error (1) [1631630250:486264][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1631630250:486264][1:0x7f45a7f71b00], connection: __posix_open_file, 667: /data/WiredTiger.wt: handle-open: open: Operation not permitted
2021-09-14T14:37:30.488+0000 W STORAGE [initandlisten] Failed to start up WiredTiger under any compatibility version.
2021-09-14T14:37:30.488+0000 F STORAGE [initandlisten] Reason: 1: Operation not permitted
2021-09-14T14:37:30.488+0000 F - [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 915
看起来像文件权限问题,但不明白为什么。
Mongodb资源定义文件:
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
name: mongodb
spec:
members: 2
type: ReplicaSet
version: "4.2.8"
security:
authentication:
modes: ["SCRAM"]
users:
- name: admin
db: admin
passwordSecretRef:
name: my-user-password
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
scramCredentialsSecretName: my-scram
additionalMongodConfig:
storage.wiredTiger.engineConfig.journalCompressor: zlib
statefulSet:
spec:
# Name for the service object created by the operator
serviceName: mongo-svc
selector: {}
# Specifies a size for the data volume different from the default 10Gi
volumeClaimTemplates:
- metadata:
name: data-volume
spec:
accessModes: [ "ReadWriteOnce","ReadWriteMany" ]
resources:
requests:
storage: 5Gi
template:
# Adds a custom volume to the pods
spec:
containers:
- name: mongod
resources:
limits:
cpu: "0.5"
memory: 1024M
requests:
cpu: "0.1"
memory: 1000M
- name: mongodb-agent
resources:
limits:
cpu: "0.2"
memory: 500M
requests:
cpu: "0.2"
# the user credentials will be generated from this secret
# once the credentials are generated, this secret is no longer required
---
apiVersion: v1
kind: Secret
metadata:
name: my-user-password
type: Opaque
stringData:
password: <password>
我正在使用动态 nfs 配置器来配置 pv 和 pvc。PVC、PV 和目录正在正确创建。
Kubernetes服务器版本:v1.18.3