Mongodb - nimrody/knowledgebase GitHub Wiki
-
A technical introduction to Wiredtiger
-
Can avoid fsync'ing the journal file after every write -- may lose some recent data.
-
Can avoid writing a journal file at all -- mongo will restore to the last snapshot
-
WT always writes updates in a different block. After the data and metadata had been fsync'ed -- old data is freed.
-
WT compresses on the way to disk. Keeps data uncompressed in memory (but indexes use additional prefix compression which affects memory too)
-
Pages are stored in memory as the original page + a skip list of changes. (may contain multiple documents)
-
-
- Probably out of date. Does not describe WiredTiger
-
Query all configuration parameters:
db._adminCommand({getParameter:"*"})
-
Query all command line and config file parameters:
db._adminCommand( {getCmdLineOpts: 1})
-
backup database
mongodump --host nir-lnx-10 --out /mnt/c/home/apm --gzip
(or add--db=apm
for specific database only) -
restore database
mongorestore /mnt/c/home/apm --gzip
(or add--db=apm
for specific database) -
Change TTL of index (see working with mongodb TTL)
use apm db.runCommand({collMod : 'records', index: {name: 'created_1', expireAfterSeconds:(100*86400)}})
-
Get configuration
db._adminCommand({getParameter:"*"})
-
Get the collection stats
m=MongoClient('localhost') m['apm'].command('collstats', 'flat_apm2')