I'm running mongodb on a windows server using docker-compose:
version: '3.9'
services:
mongo:
container_name: mongo
image: mongo:6.0.6
restart: always
volumes:
- ./data:/data/db
- ./import:/import
Initially everything worked fine, but now (after container recreation) the mongodb container is failing (infinite start/stop loop). The logs give me the following.
2023-07-13 12:58:14 {"t":{"$date":"2023-07-13T10:58:14.134+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"172.20.0.3:59870","uuid":"eb44c38b-b2e8-4120-a8ac-0b7f2042183d","connectionId":42,"connectionCount":14}}
2023-07-13 12:58:14 {"t":{"$date":"2023-07-13T10:58:14.137+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"172.20.0.3:59882","uuid":"7d7360ff-274d-464a-9b4c-b4fcaa4073ea","connectionId":43,"connectionCount":15}}
2023-07-13 12:58:14 {"t":{"$date":"2023-07-13T10:58:14.159+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn42","msg":"client metadata","attr":{"remote":"172.20.0.3:59870","client":"conn42","doc":{"driver":{"name":"nodejs","version":"4.15.0"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.15.49-linuxkit"},"platform":"Node.js v20.0.0, LE (unified)|Node.js v20.0.0, LE (unified)"}}}
2023-07-13 12:58:14 {"t":{"$date":"2023-07-13T10:58:14.160+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn43","msg":"client metadata","attr":{"remote":"172.20.0.3:59882","client":"conn43","doc":{"driver":{"name":"nodejs","version":"4.15.0"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.15.49-linuxkit"},"platform":"Node.js v20.0.0, LE (unified)|Node.js v20.0.0, LE (unified)"}}}
2023-07-19 05:07:16 find: '/data/db': Operation not permitted
2023-07-19 05:07:16 chown: changing ownership of '/data/db': Operation not permitted
2023-07-19 05:07:18 find: '/data/db': Operation not permitted
// Multiple repetitions...
2023-07-19 05:26:54 find: '/data/db': Operation not permitted
2023-07-19 05:26:54 chown: changing ownership of '/data/db': Operation not permitted
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.475+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.492+00:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.502+00:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.510+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.510+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.510+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.511+00:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.512+00:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"7f485ef6501a"}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.512+00:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.6","gitVersion":"26b4851a412cc8b9b4a18cdb6cd0f9f642e06aa7","openSSLVersion":"OpenSSL 3.0.2 15 Mar 2022","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2204","distarch":"x86_64","target_arch":"x86_64"}}}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.513+00:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"22.04"}}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.513+00:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"bindIp":"*"}}}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.539+00:00"},"s":"W", "c":"STORAGE", "id":22271, "ctx":"initandlisten","msg":"Detected unclean shutdown - Lock file is not empty","attr":{"lockFile":"/data/db/mongod.lock"}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.571+00:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/data/db","storageEngine":"wiredTiger"}}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.589+00:00"},"s":"W", "c":"STORAGE", "id":22302, "ctx":"initandlisten","msg":"Recovering data from the last clean checkpoint."}
2023-07-21 11:38:17 {"t":{"$date":"2023-07-21T09:38:17.618+00:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=464M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,remove=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=2000),statistics_log=(wait=0),json_output=(error,message),verbose=[recovery_progress:1,checkpoint_progress:1,compact_progress:1,backup:0,checkpoint:0,compact:0,evict:0,history_store:0,recovery:0,rts:0,salvage:0,tiered:0,timestamp:0,transaction:0,verify:0,log:0],"}}
2023-07-21 11:38:20 {"t":{"$date":"2023-07-21T09:38:20.153+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":1,"message":{"ts_sec":1689932300,"ts_usec":136616,"thread":"1:0x7ff8d9f5ccc0","session_dhandle_name":"file:WiredTiger.wt","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_level_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"Operation not permitted","error_code":1}}}
2023-07-21 11:38:20 {"t":{"$date":"2023-07-21T09:38:20.456+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":1,"message":{"ts_sec":1689932300,"ts_usec":456262,"thread":"1:0x7ff8d9f5ccc0","session_dhandle_name":"file:WiredTiger.wt","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_level_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"Operation not permitted","error_code":1}}}
2023-07-21 11:38:20 {"t":{"$date":"2023-07-21T09:38:20.671+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":1,"message":{"ts_sec":1689932300,"ts_usec":671416,"thread":"1:0x7ff8d9f5ccc0","session_dhandle_name":"file:WiredTiger.wt","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_level_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"Operation not permitted","error_code":1}}}
2023-07-21 11:38:20 {"t":{"$date":"2023-07-21T09:38:20.685+00:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
2023-07-21 11:38:20 {"t":{"$date":"2023-07-21T09:38:20.698+00:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"1: Operation not permitted"}}
2023-07-21 11:38:20 {"t":{"$date":"2023-07-21T09:38:20.700+00:00"},"s":"F", "c":"ASSERT", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":708}}
2023-07-21 11:38:20 {"t":{"$date":"2023-07-21T09:38:20.700+00:00"},"s":"F", "c":"ASSERT", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
I do not understand why there are suddenly Operation not permitted
errors and I don't understand what causes the "damage". Maybe someone can explain the log messages to me.
And how do I repair the db now? As I run the container with docker-compose, I don't know how to run mongod --repair
.
The same problem is described here, but unfortunately without a solution and a hint how to prevent this. Also a difference: I'm running a windows server. As mongodb is started with docker compose I don't know where the mongo service is located and how to do a correct shutdown.