Single node replicaset never finishing instanciating Error: "Cannot use non-local read concern until replica set is finished initializing"

Hello,

I’m trying to setup a mongodb replicaset as a single node in a docker container because I need to use the transactions to watch over changes in collections.

The issue I’m having is that the replicaset seems to never finish to instanciate and the loog display the following line every seconds:

{"t":{"$date":"2022-05-19T21:31:57.421+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":9200}}

I’ve tried every tutorials I’ve found, every stackoverflow issue, they all say the same thing, the configuration should be fairly simple and work with what I have now.

Here’s my configurations:

mongo-init.js (I removed the db and collection creation in hope to make it work)

const rsconf = {
    _id: "rs0",
    members: [
        {
            _id: 0,
            host: '127.0.0.1:27017',
        },
    ]
};

rs.initiate(rsconf);

Dockerfile (I use a custom image because I’m on docker windows and I can’t set proper file permission on a file if I mount it in the container from the host. It’s a POC security is not a concern anyway)

FROM mongo:latest
COPY mongo/mongo-conf/mongodb.key /mongodb.key
RUN chmod 600 /mongodb.key
RUN chown 999:999 /mongodb.key

# To solve "Unable to open() file /home/mongodb/.dbshell - source: https://github.com/docker-library/mongo/issues/323#issuecomment-494648458
RUN mkdir "/home/mongodb"
RUN touch "/home/mongodb/.dbshell"
RUN chown -R 999:999 /home/mongodb

ENTRYPOINT ["docker-entrypoint.sh"]

docker-compose.yml

version: '3.8'
services:
  # Mongodb database
  mongo:
    image: mongo-custom
    container_name: mongo
    command: --bind_ip_all --replSet rs0 --keyFile /mongodb.key
    #    restart: unless-stopped
    environment:
      MONGO_INITDB_ROOT_USERNAME: mogoadm
      MONGO_INITDB_ROOT_PASSWORD: mogopwd
    ports:
      - "27017:27017"
    volumes:
      - ./mongo/database/mongodb/db:/data/db
      - ./mongo/mongo-init:/docker-entrypoint-initdb.d:ro

I did read the official documentation and I see no functionnal difference, I’m really banging my head against a wall here trying to figure out what I did wrong?

It is failing at rs.initiate step
Check your syntax.I see additional commas in your rsconf

Sample:
config={"_id":“rs0”, “members”:[{"_id":0,“host”:“myhost:27017”}]}
rs.initiate(config)

Hello, thank for your anwser, as per your sample I removed the extra commas and tried with and without double quotes on the keys but this resulted in no changes in the error unfortunately.

I tried:

const rsconf = {
    _id: "rs0",
    members: [
        {
            _id: 0,
            host: "127.0.0.1:27017"
        }
    ]
}

and :

const rsconf = {
    "_id": "rs0",
    "members": [
        {
            "_id": 0,
            "host": "127.0.0.1:27017"
        }
    ]
}

to no result.

This is the sample config for the official documentation, I’m strugling to see what is wrong with my syntax compared to this:

rs.initiate( {
   _id : "rs0",
   members: [
      { _id: 0, host: "mongodb0.example.net:27017" },
      { _id: 1, host: "mongodb1.example.net:27017" },
      { _id: 2, host: "mongodb2.example.net:27017" }
   ]
})

How exactly this mongo-init.js is run?
I have read in one of the post which uses docker setup there should be a sleep after running the rs.initiate().There should be a gap before running next scripts like connecting to mongo.Check our forum threads

Also why don’t you try just rs.initiate() without any cfg variable
It will take default configuration

1 Like

The mongo-init.js is ran by being mounted into /docker-entrypoint-initdb.d in the mongo container.
I belive it’s automatically executed at database init when the container is started.

I know it works because I use it for the database and collection creation with no issues (I commented thoses out for replicaset debug)

I just tryed to put a sleep(10000) just after the rs.initiate(), but the container init didn’t even reach it, I belive the rs.initiate never ended.

I tried the rs.initiate() without any configuration, unfortunatelly that didn’t change anything. (I also tried to put the config directly in the rs.initiate, in a const, var… All with no changes)

Here’s the full log I get when I start the container:

{"t":{"$date":"2022-05-21T16:15:18.997+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}

{"t":{"$date":"2022-05-21T16:15:18.997+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}

{"t":{"$date":"2022-05-21T16:15:18.999+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}

{"t":{"$date":"2022-05-21T16:15:18.999+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"thread1","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}

{"t":{"$date":"2022-05-21T16:15:19.075+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}

{"t":{"$date":"2022-05-21T16:15:19.075+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}

{"t":{"$date":"2022-05-21T16:15:19.075+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}

{"t":{"$date":"2022-05-21T16:15:19.076+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}

{"t":{"$date":"2022-05-21T16:15:19.076+00:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}

{"t":{"$date":"2022-05-21T16:15:19.077+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":"mongo-sitac"}}

{"t":{"$date":"2022-05-21T16:15:19.077+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.8","gitVersion":"c87e1c23421bf79614baf500fda6622bd90f674e","openSSLVersion":"OpenSSL 1.1.1f  31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}

{"t":{"$date":"2022-05-21T16:15:19.077+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}

{"t":{"$date":"2022-05-21T16:15:19.077+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"bindIp":"*"},"replication":{"replSet":"rs0"},"security":{"keyFile":"/mongodb.key"},"storage":{"dbPath":"/data/db","journal":{"enabled":true}}}}}

{"t":{"$date":"2022-05-21T16:15:19.083+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=5855M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=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=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}

{"t":{"$date":"2022-05-21T16:15:24.240+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1653149724:240959][1:0x7fc3a4f91c80], txn-recover: [WT_VERB_RECOVERY_ALL] Set global recovery timestamp: (0, 0)"}}

{"t":{"$date":"2022-05-21T16:15:24.241+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1653149724:241029][1:0x7fc3a4f91c80], txn-recover: [WT_VERB_RECOVERY_ALL] Set global oldest timestamp: (0, 0)"}}

{"t":{"$date":"2022-05-21T16:15:24.255+00:00"},"s":"I",  "c":"STORAGE",  "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":5172}}

{"t":{"$date":"2022-05-21T16:15:24.255+00:00"},"s":"I",  "c":"RECOVERY", "id":23987,   "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}

{"t":{"$date":"2022-05-21T16:15:24.279+00:00"},"s":"I",  "c":"STORAGE",  "id":4366408, "ctx":"initandlisten","msg":"No table logging settings modifications are required for existing WiredTiger tables","attr":{"loggingEnabled":false}}

{"t":{"$date":"2022-05-21T16:15:24.279+00:00"},"s":"I",  "c":"STORAGE",  "id":22262,   "ctx":"initandlisten","msg":"Timestamp monitor starting"}

{"t":{"$date":"2022-05-21T16:15:24.298+00:00"},"s":"W",  "c":"CONTROL",  "id":22138,   "ctx":"initandlisten","msg":"You are running this process as the root user, which is not recommended","tags":["startupWarnings"]}

{"t":{"$date":"2022-05-21T16:15:24.298+00:00"},"s":"W",  "c":"CONTROL",  "id":22178,   "ctx":"initandlisten","msg":"/sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'","tags":["startupWarnings"]}

{"t":{"$date":"2022-05-21T16:15:24.300+00:00"},"s":"I",  "c":"STORAGE",  "id":5071100, "ctx":"initandlisten","msg":"Clearing temp directory"}

{"t":{"$date":"2022-05-21T16:15:24.301+00:00"},"s":"I",  "c":"CONTROL",  "id":20536,   "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}

{"t":{"$date":"2022-05-21T16:15:24.302+00:00"},"s":"I",  "c":"SHARDING", "id":20997,   "ctx":"initandlisten","msg":"Refreshed RWC defaults","attr":{"newDefaults":{}}}

{"t":{"$date":"2022-05-21T16:15:24.303+00:00"},"s":"I",  "c":"FTDC",     "id":20625,   "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/data/db/diagnostic.data"}}

{"t":{"$date":"2022-05-21T16:15:24.303+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.startup_log","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"fc624045-215e-4036-986b-91064e9f63b5"}},"options":{"capped":true,"size":10485760}}}

{"t":{"$date":"2022-05-21T16:15:24.326+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.startup_log","index":"_id_","commitTimestamp":null}}

{"t":{"$date":"2022-05-21T16:15:24.327+00:00"},"s":"I",  "c":"REPL",     "id":6015317, "ctx":"initandlisten","msg":"Setting new configuration state","attr":{"newState":"ConfigStartingUp","oldState":"ConfigPreStart"}}

{"t":{"$date":"2022-05-21T16:15:24.327+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"ReadConcernMajorityNotAvailableYet: Read concern majority reads are currently not possible.","nextWakeupMillis":200}}

{"t":{"$date":"2022-05-21T16:15:24.327+00:00"},"s":"I",  "c":"REPL",     "id":4280500, "ctx":"initandlisten","msg":"Attempting to create internal replication collections"}

{"t":{"$date":"2022-05-21T16:15:24.327+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.replset.oplogTruncateAfterPoint","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"d2489be1-fa14-4def-8a30-7b93eb5416a6"}},"options":{}}}

{"t":{"$date":"2022-05-21T16:15:24.363+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.replset.oplogTruncateAfterPoint","index":"_id_","commitTimestamp":null}}

{"t":{"$date":"2022-05-21T16:15:24.363+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.replset.minvalid","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"b80857d3-271d-45ac-bdab-e5178caf07c5"}},"options":{}}}

{"t":{"$date":"2022-05-21T16:15:24.393+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.replset.minvalid","index":"_id_","commitTimestamp":null}}

{"t":{"$date":"2022-05-21T16:15:24.394+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.replset.election","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"fb02e9bd-0ddd-4590-80ed-b65d641bc8dd"}},"options":{}}}

{"t":{"$date":"2022-05-21T16:15:24.445+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.replset.election","index":"_id_","commitTimestamp":null}}

{"t":{"$date":"2022-05-21T16:15:24.445+00:00"},"s":"I",  "c":"REPL",     "id":4280501, "ctx":"initandlisten","msg":"Attempting to load local voted for document"}

{"t":{"$date":"2022-05-21T16:15:24.445+00:00"},"s":"I",  "c":"REPL",     "id":21311,   "ctx":"initandlisten","msg":"Did not find local initialized voted for document at startup"}

{"t":{"$date":"2022-05-21T16:15:24.445+00:00"},"s":"I",  "c":"REPL",     "id":4280502, "ctx":"initandlisten","msg":"Searching for local Rollback ID document"}

{"t":{"$date":"2022-05-21T16:15:24.445+00:00"},"s":"I",  "c":"REPL",     "id":21312,   "ctx":"initandlisten","msg":"Did not find local Rollback ID document at startup. Creating one"}

{"t":{"$date":"2022-05-21T16:15:24.445+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.system.rollback.id","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"d2872c85-c392-4bf3-ab91-f2c13bbd1309"}},"options":{}}}

{"t":{"$date":"2022-05-21T16:15:24.480+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.system.rollback.id","index":"_id_","commitTimestamp":null}}

{"t":{"$date":"2022-05-21T16:15:24.480+00:00"},"s":"I",  "c":"REPL",     "id":21531,   "ctx":"initandlisten","msg":"Initialized the rollback ID","attr":{"rbid":1}}

{"t":{"$date":"2022-05-21T16:15:24.480+00:00"},"s":"I",  "c":"REPL",     "id":21313,   "ctx":"initandlisten","msg":"Did not find local replica set configuration document at startup","attr":{"error":{"code":47,"codeName":"NoMatchingDocument","errmsg":"Did not find replica set configuration document in local.system.replset"}}}

{"t":{"$date":"2022-05-21T16:15:24.480+00:00"},"s":"I",  "c":"REPL",     "id":6015317, "ctx":"initandlisten","msg":"Setting new configuration state","attr":{"newState":"ConfigUninitialized","oldState":"ConfigStartingUp"}}

{"t":{"$date":"2022-05-21T16:15:24.481+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.system.views","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"4243d9cb-9af0-48fc-8dc2-187c55ed53d8"}},"options":{}}}

{"t":{"$date":"2022-05-21T16:15:24.514+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.system.views","index":"_id_","commitTimestamp":null}}

{"t":{"$date":"2022-05-21T16:15:24.517+00:00"},"s":"I",  "c":"CONTROL",  "id":20714,   "ctx":"LogicalSessionCacheRefresh","msg":"Failed to refresh session cache, will try again at the next refresh interval","attr":{"error":"NotYetInitialized: Replication has not yet been configured"}}

{"t":{"$date":"2022-05-21T16:15:24.517+00:00"},"s":"I",  "c":"REPL",     "id":40440,   "ctx":"initandlisten","msg":"Starting the TopologyVersionObserver"}

{"t":{"$date":"2022-05-21T16:15:24.517+00:00"},"s":"I",  "c":"CONTROL",  "id":20712,   "ctx":"LogicalSessionCacheReap","msg":"Sessions collection is not set up; waiting until next sessions reap interval","attr":{"error":"NamespaceNotFound: config.system.sessions does not exist"}}

{"t":{"$date":"2022-05-21T16:15:24.517+00:00"},"s":"I",  "c":"REPL",     "id":40445,   "ctx":"TopologyVersionObserver","msg":"Started TopologyVersionObserver"}

{"t":{"$date":"2022-05-21T16:15:24.518+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}

{"t":{"$date":"2022-05-21T16:15:24.518+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"0.0.0.0"}}

{"t":{"$date":"2022-05-21T16:15:24.518+00:00"},"s":"I",  "c":"NETWORK",  "id":23016,   "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}

{"t":{"$date":"2022-05-21T16:15:24.528+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":400}}

{"t":{"$date":"2022-05-21T16:15:24.928+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":600}}

{"t":{"$date":"2022-05-21T16:15:25.528+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":800}}

{"t":{"$date":"2022-05-21T16:15:26.329+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":1000}}

{"t":{"$date":"2022-05-21T16:15:27.330+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":1200}}

{"t":{"$date":"2022-05-21T16:15:28.532+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":1400}}

{"t":{"$date":"2022-05-21T16:15:29.933+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":1600}}

{"t":{"$date":"2022-05-21T16:15:31.535+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":1800}}

{"t":{"$date":"2022-05-21T16:15:33.337+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":2000}}

{"t":{"$date":"2022-05-21T16:15:35.339+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":2200}}

{"t":{"$date":"2022-05-21T16:15:37.542+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":2400}}

{"t":{"$date":"2022-05-21T16:15:39.945+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":2600}}

{"t":{"$date":"2022-05-21T16:15:42.548+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":2800}}

{"t":{"$date":"2022-05-21T16:15:45.351+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":3000}}

{"t":{"$date":"2022-05-21T16:15:48.354+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":3200}}

{"t":{"$date":"2022-05-21T16:15:51.558+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":3400}}

{"t":{"$date":"2022-05-21T16:15:54.962+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":3600}}

{"t":{"$date":"2022-05-21T16:15:58.565+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":3800}}

{"t":{"$date":"2022-05-21T16:16:02.370+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":4000}}

{"t":{"$date":"2022-05-21T16:16:06.373+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":4200}}

{"t":{"$date":"2022-05-21T16:16:10.578+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":4400}}

{"t":{"$date":"2022-05-21T16:16:14.983+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":4600}}

{"t":{"$date":"2022-05-21T16:16:19.588+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":4800}}

{"t":{"$date":"2022-05-21T16:16:24.306+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":"[1653149784:306812][1:0x7fc39c77f700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 55, snapshot max: 55 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 1"}}

{"t":{"$date":"2022-05-21T16:16:24.393+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":5000}}

{"t":{"$date":"2022-05-21T16:16:29.399+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":5200}}

{"t":{"$date":"2022-05-21T16:16:34.605+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":5400}}

{"t":{"$date":"2022-05-21T16:16:40.010+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":5600}}

After that the mongo just log the same error and increase the time between retries.