Start in InMemory mode

Edition: Enterprise 4.4.12
I want to use the InMemory mode. Here is my config file:

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  engine: inMemory
  inMemory:
    engineConfig:
      inMemorySizeGB: 1
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

security:
  authorization: enabled

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

An error occurs on startup:

{"t":{"$date":"2022-01-27T10:11:05.027+04:00"},"s":"E",  "c":"STORAGE",  "id":20557,   "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"Location28662: Cannot start server. Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, but the specified storage engine was 'inMemory'."}}

Help solve the problem please!

Is this a fresh attempt to setup inmemory or you are trying to modify an existing mongod which ran earlier with WT storage
It is complaining about WT files in the dbpath
Try to empty your dbpath(if not important) or choose a different dirs for dbpath/logpaths and see

3 Likes

New install on a new system, but mongorestore restored one database. After that, there was an attempt to enable InMemory mode.

Hi @M_K4,

As @Ramachandra_Tummala mentioned, the problem is that you are trying to start a mongod using the In-Memory Storage Engine when conflicting WiredTiger data files exist:

Detected data files in /var/lib/mongodb created by the ‘wiredTiger’ storage engine, but the specified storage engine was ‘inMemory’.

Since the In-Memory Storage Engine does not persist data to disk, you must change your configured dbPath or move/remove the current contents before starting mongod with the new configuration. If you want to load data into an In-Memory deployment via mongorestore, this has to be done after your deployment is running.

Regards,
Stennie

2 Likes

Thanks! Didn’t know it…