Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
32 votes
1 answer
24k 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 ...
user avatar
  • 421
4 votes
2 answers
9k 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 ...
user avatar
  • 9,075
44 votes
3 answers
84k 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 ...
user avatar
  • 871
118 votes
4 answers
94k 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 ...
user avatar
  • 1,301
82 votes
5 answers
43k 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 ...
user avatar
38 votes
3 answers
45k 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
  • 483
9 votes
1 answer
14k 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 ...
user avatar
10 votes
3 answers
15k 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 ...
user avatar
  • 133
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 ...
user avatar
1 vote
1 answer
241 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 (...
user avatar
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 ...
user avatar
3 votes
1 answer
8k views

How to close mongodb idle connection(active: false)?

I have an application running on node and using the mongodb library to establish connection and closing it. But the problem is, from the mongo serverStatus() command i can see that there is still 2k+ ...
user avatar
2 votes
1 answer
676 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-...
user avatar
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 ...
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 ...
user avatar
5 votes
6 answers
1k 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 ...
user avatar
2 votes
2 answers
3k 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
user avatar
2 votes
1 answer
634 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, ...
user avatar
  • 31
1 vote
2 answers
4k 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 ...
user avatar
  • 23
0 votes
7 answers
1k 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 [...
user avatar
  • 113
0 votes
1 answer
346 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 ...
user avatar
71 votes
5 answers
234k 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 ...
user avatar
33 votes
1 answer
58k 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 ...
user avatar
  • 9,075
19 votes
2 answers
23k 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, ...
user avatar
  • 293
21 votes
3 answers
45k 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 ...
user avatar
  • 695
19 votes
2 answers
20k 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 ...
user avatar
23 votes
2 answers
132k 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:...
user avatar
  • 615
14 votes
6 answers
23k 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 ...
user avatar
  • 263
2 votes
5 answers
14k views

WiredTiger - "too many open files error" during resync of a secondary replica set member [closed]

I'm upgrading a secondary replica set member to wiredTiger. I have upgraded it from MongoDB 2.6.3 to 3.0.4 and changed the storage engine to wiredTiger. Now it is resyncing all data from the primary. ...
user avatar
19 votes
5 answers
7k 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 ...
user avatar
  • 291
8 votes
2 answers
11k 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 ...
user avatar
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 ...
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 ...
user avatar
  • 475
6 votes
3 answers
17k 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")}, .....
user avatar
3 votes
1 answer
3k views

storing files on mongodb

I am developing an app where user will upload multiple images along with some other data like name address etc. I am using MEAN stack for development, So I have some questions regarding this: How ...
user avatar
1 vote
2 answers
5k views

How to set cache on windows 10 pro 64bit machine

When running Mongod I get the following WARNING: The file system cache of this machine is configured to be greater than 40% of the total memory. This can lead to increased memory pressure and poor ...
user avatar
  • 171
12 votes
1 answer
8k 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 ...
user avatar
  • 393
5 votes
2 answers
6k 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 ...
user avatar
5 votes
1 answer
4k 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 ...
user avatar
5 votes
2 answers
70k 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 ...
user avatar
5 votes
2 answers
9k 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 ...
user avatar
3 votes
1 answer
1k views

How does the MongoDB query optimizer evaluate candidate plans?

The MongoDB query optimizer processes queries and chooses the most efficient query plan for a query given the available indexes This is an excerpt from MongoDB documentation. I am looking for more ...
user avatar
  • 165
3 votes
1 answer
5k 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: ...
user avatar
  • 3,546
2 votes
1 answer
2k views

When upgrading config servers to use WireTiger, the running config server with wiredtiger does not authenticate the existing pass and user?

In order to upgrade mongodb to 3.0.0, I am upgrading my config servers to use WireTiger. I followed the subsection of Change Config Server to Use WiredTiger. There are 18 steps. I run mongodump --port ...
user avatar
  • 259
2 votes
2 answers
1k views

Sync MongoDB Replica set with Remote Replica Set

I'm wondering if it is possible (within reason) to sync a new MongoDB Replica Set(RS) with an RS currently in production. The Problem We have a site running on AWS that has its own MongoDB Replica ...
user avatar
1 vote
2 answers
4k views

MongoDB document delete and fragmentation

I've a MongoDB collection that works like a queue: new documents are insert and old documents (after 60days) are removed. I can see a rapid grown of the datafile size, too rapid. I can be reasonable ...
user avatar
1 vote
1 answer
10k views

Issues with self signed certificates, SSL and MongoDB

Note: As specified in my comment I've figured out a solution to this issue regarding a single client/mongo connection. The next step is to figure out a solution for a replica set involving this fix. ...
user avatar
  • 133
5 votes
2 answers
4k 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 ...
user avatar
  • 293
4 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 ...
user avatar
4 votes
1 answer
1k views

Mongodb incremental oplog Dump not working

I am not able to take an incremental oplog dump. I am not getting any error messages the connection happens fine and also there is a operation recorded(shows up in db.currentOp()), but still nothing ...
user avatar