Questions tagged [mongodb]

All versions of MongoDB - a scalable, high-performance, open-source, document-oriented database.

Filter by
Sorted by
Tagged with
34 votes
1 answer
28k views

Mongodb incremental backups

I was given the task to set up incremental backups for MongoDB replicaset, as start point, of course, I googled it and could not find anything on MongoDB docs, I did find however this question on ...
Tiago's user avatar
  • 441
4 votes
2 answers
10k views

How to Determine Chunk Distribution (data and number of docs) in a Sharded MongoDB Cluster?

Having done all the right things - picked an appropriate shard key, scaled horizontally, distributed my data across several shards, I find I now have no real way to determine how well balanced the ...
Adam C's user avatar
  • 9,235
49 votes
3 answers
103k views

MongoDB using too much memory

We've been using MongoDB for several weeks now, the overall trend that we've seen has been that mongodb is using way too much memory (much more than the whole size of its dataset + indexes). I've ...
SpiXel's user avatar
  • 1,001
15 votes
3 answers
27k views

How to restore .wt backup file to local MongoDB?

This is a question that was asked before, but I have tried all solutions, and simply cannot get it right. I have spent quite some time researching before posting this question. I have looked at the ...
Saketh's user avatar
  • 193
127 votes
4 answers
107k views

Difference between Sharding And Replication on MongoDB

I am just confused about how Sharding and Replication work. According to the definitions I found in the documentation: Replication: A replica set in MongoDB is a group of mongod processes that ...
Saad Saadi's user avatar
  • 1,401
85 votes
5 answers
48k views

Which database could handle storage of billions/trillions of records?

We are looking at developing a tool to capture and analyze netflow data, of which we gather tremendous amounts of. Each day we capture about ~1.4 billion flow records which would look like this in ...
somecallmemike's user avatar
40 votes
3 answers
48k views

check storage engine from shell

I'm upgrading to 3.0 and ran into some issues with the upgrade. Specifically, I got an error when trying to start up mongod via ssh, it tried to use the default dbpath instead of the one I specified ...
user avatar
15 votes
6 answers
27k views

Why is Mongo stuck in STARTUP2?

I have a Mongo replica set with a few secondaries. A box, which hosts a secondary instance, crashed and lost the database. I started the secondary Mongo instance again and now it's stuck in STARTUP2 ...
Michael's user avatar
  • 273
9 votes
1 answer
15k views

mongodb config servers not in sync

I have setup with 2 shards, with 2 replica servers and 3 config servers, and 2 mongos. I have following problems: 1) mongo config servers out of sync: Aug 14 09:46:48 server mongos.27017[10143]: Sun ...
user2688866's user avatar
8 votes
5 answers
26k views

Limit the RAM memory usage in MongoDB

I am using MongoDB-2.6.1. Is there any way to limit the RAM memory usage? For example: Out of 4 GB RAM, let MongoDB use till 3 GB (<= 3 GB).
manojpt's user avatar
  • 181
7 votes
3 answers
10k views

Primary replica set server goes secondary after secondary fails

I have a 2 servers replica set that, after the secondary fails the primary goes into secondary mode while the secondary is in STARTUP2 (recovering). The problem with this is that I can't use the ...
Sergio Ayestarán's user avatar
5 votes
2 answers
3k views

Mongodb restrict access on collections level

I'm building a backend system using MongoDB. Now I want to restrict access on certain numbers of database collections to this system. For example I have users, admin_users, pageviews and I want this ...
Khanh Tran's user avatar
5 votes
6 answers
2k views

Lots of Indexes - MySQL vs MongoDB - Migrating

So, I've never used MongoDB, I just read a lot about it and I think it's going to be good for my project. Also, I do not have lots of experience with MySQL and to be even more honest I have no clue of ...
Victor Tello's user avatar
5 votes
1 answer
6k views

Can I disable journalling to improve performance

We have a 16 shard MongoDB 2.4 installation running in AWS that is eating money. The data is volatile, it only gets used within 15 minutes of creation If the cluster goes down we wipe it out and ...
Paddy Carroll's user avatar
3 votes
3 answers
4k views

Mongodb: Possible to enlarge a capped collection?

If a collection is created as capped, is it possible to increase the cap without losing data? Or to increase the cap without recreating the whole collection? Thanks
Jonesome Reinstate Monica's user avatar
2 votes
1 answer
876 views

MongoDB stepDown fails in a PSA Architecture

I have set up a MongoDB cluster using a 3-Member Primary-Secondary-Arbiter Architecture Environment: LXC containers Linux Debian Stretch (9.8) MongoDB server version: 4.0.6 MongoDB Containers: lxc-...
Nicolas Payart's user avatar
2 votes
1 answer
894 views

Fastest way to move Collection from Sharded MongoDB Cluster to a another Sharded MongoDB Cluster

I have to move a MongoDB Collection (Size: 1TB+) from Sharded MongoDB Cluster to another[5 shards on both clusters]. During this operation, it is assumed that the accompanying program will be offline, ...
andy_l's user avatar
  • 31
1 vote
1 answer
1k views

Why MongoDB starts to split before 64MB

I'm testing the MongoDB Sharding with a Sharded Collection and a forloop to insert arround 1M documents to see how splitting and moving works. I'm surprise that after few documents MongoDB starts to ...
Maxime Fouilleul's user avatar
1 vote
2 answers
5k views

Mongodb Standalone Performs better than Replica Set

I am currently using a standalone mongodb with high read operations. Since replica sets could provide high read performance, I setup a 3 node replica set on 3 vms with read preference as "secondary ...
Kenny's user avatar
  • 23
1 vote
1 answer
456 views

How can I prefer a specific MongoDB replica set member be elected as primary?

I have a replica set with 5 members. replica-1 is a primary and other replicas are secondary: replica-1 (primary) replica-2 (secondary) replica-3 (secondary) replica-4 (secondary) replica-5 (...
Mouna Vignesh's user avatar
0 votes
3 answers
628 views

Should I use SQL vs NoSQL for files catalog? [closed]

I will be implementing a system which will be storing 250 Million files/user. I want to perform list operations from the client side, where the client application will be fetching 100 records at a ...
Anup Buchke's user avatar
0 votes
1 answer
419 views

Forbid mongodb not authenticated connect

If to run mongo with authorization (i.e mongod --auth) it still allows to connect using client mongo and get to mongo cli where one will get refused to execute any command. But I wonder if it is ...
WHITECOLOR's user avatar
0 votes
7 answers
2k views

Mongo cluster - simple backup question

I've got a mongo cluster with three nodes, running 2.6, but probably going to 3.2 What is the best method to back-up a database in a replica set of three mongodb servers? Should I use mongodump --db [...
Kevin C's user avatar
  • 113
71 votes
6 answers
243k views

How restore a specific database from backup using mongorestore command

I created a backup of all my databases using mongodump command. Now I want to restore a specific database using mongorestore command. How is this possible, I use this command: --db option then ...
pankaj choudhary's user avatar
37 votes
6 answers
108k views

How can I enter Mongo as a superuser or reset users?

I'm was playing around with permissions and locked myself out of Mongo database. I'm pretty sure I did this by trying to explicitly add access to a database but instead I overwrote only allowing ...
Tony's user avatar
  • 579
33 votes
1 answer
60k views

Sample YAML Configuration Files for MongoDB?

The MongoDB configuration options documentation lists all the available options that can be specified, but does anyone have a set of fully formed example YAML formatted config files for MongoDB ...
Adam C's user avatar
  • 9,235
28 votes
2 answers
167k views

Mongo Create a user as admin for any database raise an error

I am trying to create a simple user with the rights permission to access to any database and can do any actions. When I trying to execute the createUser command I got this error: db.createUser({ user:...
Robert's user avatar
  • 695
21 votes
3 answers
47k views

MongoDB: RAM requirements

Is it enough to have the entire index in memory/ram or does mongodb even try to allocate as much ram as possible to store even the data for fast reads? I'd like to run mongodb + other applications ...
ledy's user avatar
  • 695
20 votes
2 answers
25k views

MongoDB terminates when it runs out of memory

I have the following configuration: a host machine that runs three docker containers: MongoDB Redis A program using the previous two containers to store data Both Redis and MongoDB are used to ...
Simone Bronzini's user avatar
20 votes
2 answers
25k views

How to backup large MongoDB database

What is the recommended way to back up large data sets in MongoDB? Let's say we have a data size in the order of 10TB - how would you back that up? We're considering a hidden, possibly delayed, ...
Malakim's user avatar
  • 303
20 votes
5 answers
8k views

Infrastructure for Highly Concurrent, High Write DB

My requirements are: 3000 Connections 70-85% Write vs Read Currently, we are maxing out a High-CPU, Extra Large Instance at 700 connections. All 8 cores are maxed. We think it's the number of ...
Justin's user avatar
  • 301
19 votes
1 answer
15k views

what is "planSummary: IDHACK"?

This Query scans only one document and returns only one document. But this is very slow: 2017-05-22T07:13:24.548+0000 I COMMAND [conn40] query databasename.collectionname query: { _id: ObjectId('...
Sybil's user avatar
  • 2,498
13 votes
1 answer
10k views

Is XFS still the best choice for mongodb?

There is this guide for production servers: https://docs.mongodb.com/manual/administration/production-notes/#kernel-and-file-systems It tells that for the WiredTiger storage engine, XFS is strongly ...
nagylzs's user avatar
  • 411
9 votes
2 answers
7k views

mongodb: replica-set with load balancer

Is there an option for load balancing with mongodb replica sets? I am not asking for a HAProxy or similar, but for a built-in feature from mongodb. Could not find tips for this in the docs.
ledy's user avatar
  • 695
9 votes
3 answers
12k views

Backup with mongoexport or mongodump?

For production backup, MongoDB recommends mongodump instead of mongoexport for accuracy of data. However, I would need to "scrub" data off a MongoDB database before backing it up. I am not aware of ...
Howard Lee's user avatar
  • 1,019
8 votes
2 answers
12k views

Large `mongodump` followed by `mongorestore`

I have a fairly large (~240GB) Mongo database that I need to transfer across a sluggish network and onto a new server. Traditionally for these situations, I've found that a mongodump followed by a ...
therealrootuser's user avatar
7 votes
2 answers
7k views

How to add userAdmin user in Mongodb Atlas

How to add a user with userAdmin role in Atlas? The Cluster Security "Add New User" UI https://cloud.mongodb.com/v2/.....#clusters/security/users shows only limited set of built-in roles without any ...
Alex Blex's user avatar
  • 240
6 votes
3 answers
20k views

MongoDB show duplicate key is null?

MongoDB version 3.6 I got the duplicate key message when I executed this. What's the actual problem? mongos> db.setup.findAndModify({ ... query : {"_id" : ObjectId("5b3c7abbea95705803084cad")}, .....
tao hiko's user avatar
6 votes
2 answers
4k views

Force a Member to Become Primary in mongodb

I looked into answers but nothing works for me in mongo 2.6.11 cluster 'nms' (members nms01m and nms02) below. I want my current secondary nms01m to become primary, and now nms02 is primary instead of ...
irom's user avatar
  • 203
6 votes
1 answer
2k views

Mongo replication lag slowly increasing

I am running a replica-set in production with slaveOk = false using mongo 2.0.7 in AWS The replication lag on one of the servers is close to 58 hours. This replication lag is sometimes decreasing ( at ...
Abhishek Kumar's user avatar
6 votes
2 answers
7k views

How to add setParameter in mongod config?

When I am using setParameter in mongod config, I start mongod with error: Unrecognized option: setParameter = enableLocalhostAuthBypass=1 How can I use setParameter from config file ? P/S: I am ...
Luke Nguyen's user avatar
6 votes
3 answers
79k views

MongoDB: All commands spit out "not authorized on admin to execute command"

Mongo version: 3.2.11 I spun up a mongoDB droplet with DigitalOcean so that I could have a database connected to my little game. However, complications after complications have arisen. I am ...
Orange Receptacle's user avatar
6 votes
3 answers
2k views

Setting up Mongo with clustering

I'm going to start using Mongo as a database but I will not have it clustered at first. Can I use Mongo on a single machine, then later come back, cluster it and capitalize on the sharding? Or can I ...
WildBill's user avatar
  • 525
5 votes
1 answer
6k views

Why MongoDB is so slow on some queries while using IXSCAN as a winning plan?

I have DB with about 30M records in a collection with about 100GB collection size (total documents and indexes). I have a compound index that filters data based on user_id and some other fields like: ...
Alireza's user avatar
  • 3,636
5 votes
1 answer
3k views

MongoDB replication: going into maintenance mode with 10333 other maintenance mode tasks in progress

I have a MongoDB instance where resync is required. 2016-11-07T11:59:23.330+0000 I REPL [ReplicationExecutor] syncing from: x.x.x.x:27017 2016-11-07T11:59:23.354+0000 W REPL [rsBackgroundSync]...
Sybil's user avatar
  • 2,498
5 votes
2 answers
5k views

MongoDB replica set over ssh tunnels

I'm trying to archive something like this The MongoDB instance on dc1.com is currently a standalone, and On-Site periodically pulls a backup via mongodump over a ssh tunnel. I now want to create two ...
Daniel F's user avatar
  • 313
5 votes
1 answer
3k views

Mongo CP, Cassandra AP?

I have read lot of articles on net but still confused why Mongo CP, Cassandra AP, RDBMS CA ? Will explain my understanding and query along with that . Mongo Consider a scenario where I have one ...
user3198603's user avatar
5 votes
1 answer
5k views

How to restore from .wt files?

Environment Windows Professional 10 MongoDB 3.6.4 2008R2Plus SSL (64 bit) (before computer crash) MongoDB 4.0.2 2008R2Plus SSL (64 bit) (after computer crash) I have been developing locally, and ...
user1063287's user avatar
5 votes
2 answers
11k views

MongoDB - how to reduce numYields

I have a MongoDB database with ~100GB data size. I ran a test with 300 threads and queries are all reads, no writes (except writes to db profiler I guess). I enabled database profiler to keep track of ...
Howard Lee's user avatar
  • 1,019
4 votes
1 answer
3k views

Huge size on mongodb's gridfs. Should I compact?

I’m running MongoDB and grid.fs to store small files (less than 20mbs). These are part of a replica set. I currently have more than 350000 files stored. I’ve noticed that the chunks collection takes ...
remedix's user avatar
  • 143