I want to implement mongodb as a distributed database but i cannot find good tutorials for it. Whenever i searched for distributed database in mongodb, it gives me links of sharding, so i am confused if both of them are the same things?
is sharding same as distributed database in mongoDB?
3.8k views Asked by sanchit kashyap AtThere are 2 answers
vmr
On
Just some perspective on distributed databases:
In early nineties a lot of applications were desktop based and had a local database which contained MB/GBs of data.
Now with the advent of web based applications there can be millions of users who use and store their data, this data can run into GB/TB/PB. Storing all this data on a single server is economically expensive so there is a cluster of servers(or commodity hardware) across which data is horizontally partitioned. Sharding is another term for horizontal partitioning of data. For example you have a Customer table which contains 100 rows, you want to shard it across 4 servers, you can pick 'key' based sharding in which customers will be distributed as follows: SHARD-1(1-25),SHARD-2(26-50),SHARD-3(51-75),SHARD-4(76-100)
Sharding can be done in 2 ways:
Hash based
Key based
Related Questions in MONGODB
- MongoDb not connecting C#
- How do I link two models in mongoose?
- MERN Stack App - User Avatar Upload - 500 Error After Deployment on Render
- On the server side, it returns undefined but on the client side, logs the values no problem
- Laravel: Using belongsToMany relationship with MongoDB
- What are some MERN projects that will grow me from junior dev to senior
- Save Interface in DB golang
- findOneAndUpdate not updating value in mongodb?
- Get Type Error when using .countDocuments with mongoDB
- Getting a Large Error Output When Calling MongoDB/Mongoose Functions Without an Error Message
- How to enter data in mongodb array at specific position such that if there is only 2 data in array and I want to insert at 5, then rest data is null
- using Python to insert_one to my mongo_db, How do I pass key values into a function?
- SSL Certificate Verification Error When Scraping Website and Inserting Data into MongoDB
- connect ECONNREFUSED 43.205.72.30:27017 while connecting to Atlas
- Vite is probably changing my import path. What should I do?
Related Questions in VIRTUALBOX
- How do I fix VERR_INVALID_HANDLE (0X80004005) Error in VirtualBox?
- Seeking for the the method for adding the DL (data register) value to DX register
- Why when I want to open a folder from Visual Studio Code does the screen go crazy?
- Trouble Connecting USB Wireless Adapter via Bridged Adapter in VirtualBox for Kali Linux
- Behavior of the adress 0x7e00 in different sectors and their alternatives
- Assembly language adding two numbers code error issue
- No BIOS output from sector 1
- Building VirtualBox With Emscripten throws error: 'kmk: *** Exiting with status 2 emmake: error: 'kmk -p all' failed (returned 2)'
- Error when molecule through vagrant start VM in vbox (Windows, WSL2)
- Flask app in my Host machine connecting to an MySQL in a docker in a VM
- Bootloader are really in sector 0?
- Process finished with exit code 132 (interrupted by signal 4:SIGILL)
- NodePort Service not accepting connections : Error: connect ECONNREFUSED
- run adb from virtualbox with win11 host
- VirtualBox ErrorVkPhysicalDevice does not support GetPhysicalDeviceCalibrateableTimeDomainsKHR
Related Questions in DISTRIBUTED
- How to do a simple large matrix multiplication on multiple GPUs in PyTorch? I have wrote some simple codes, but works not well
- Problems encountered when using _shard_num when querying clickhouse shard sets
- Which web3 decentralized wallet is suitable to store my crypto assets and lock some of the tokens for certain time?
- How to use consistent hashing across publishers, queues, and consumers
- pytorch all_gather gives wrong output order
- How to save the JavaScript runtime state
- akka PubSub not working across distributed system
- About the parallel execution issue in Ray
- How to make models that contains `log_prob` and needs to create local tensors in `forward` parallelly trainable?
- Clickhouse Distributed Query take huge amount of network usage when using group by
- The two data nodes return different results
- Guidance on multi instance application with distributed redis
- Distributed memory table in Clickhouse
- Issue with Flink Job Failure when Using Custom Class as DataStreamSource Type
- Qdrant: Which shard is at which node? It seems like all shards are on the same node
Related Questions in SHARDING
- Problems encountered when using _shard_num when querying clickhouse shard sets
- Horizontal scaling strategy with 10,000 shards
- MongoDB movePrimary doesn't work when the primary shard is down
- Assigning a dedicated Primary node for write operations in MongoDB replica set
- Why does Elastic search limit the maximum shard number to 1k per node?
- citus add node --> "fe_sendauth: no password supplied" error
- MongoDB Shard Cluster
- How to select the shard key
- When querying a sharded collection, can I filter on shard keys using an operator?
- How to specify region for shards in MongoDB Atlas. Also how to appropriately set 2 shard for a cluster
- akka.cluster.ddata.Replicator$Internal$DeltaPropagation message from clusterReceptionist replicator is dropped because it exceeds the size limit
- Make shard processes use the same pool
- discord.js v14: how to see the number of pending messages in shards
- Total number of docs on a shard in solr
- sharding-jdbc Forced routing failed
Related Questions in DATABASE
- How to add the dynamic new rows from my registration form in my database?
- How to store a date/time in sqlite (or something similar to a date)
- Problem with add new attribute in table with BOTO3 on python
- When an E-R attribute should be perceived as a relationship attribute or as an entity set attribute?
- SQLAlchemy: efficient relationship loading in 3-way many-to-many relationship
- Cannot connect to Postgres Database when running Quarkus Tests with Gitlab ci
- Local or remote database with react-native?
- I want to edit a specific row in database
- How to enter data in mongodb array at specific position such that if there is only 2 data in array and I want to insert at 5, then rest data is null
- Open Web Library
- database login.py and register.py error showing 404 file not found and doesn't work
- SQL71561: SqlComputedColumn: When column selected
- Liquibase as SaaS To Configure Multiple Database as Dynamic
- Updated max input vars but table still shows error
- Spring does not map set of roles
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Generally speaking, if you got a read-heavy system, you may want to use replication. Which is 1
primarywith at most 50secondaries. Thesecondariesshare the read stress while theprimarytakes care of writes. It is a auto-failover system so that when theprimaryis down, one of thesecondarieswould take the job there and becomes a newprimary.Sharding, however, is more flexible. All the
Shardsshare write stress and read stress. That is to say, data are distributed into differentShards. And each shard can be consists of aReplicationsystem and auto-failover works as described above.I would choose
replicationfirst because it's simple and is basically enough for most scenarios. And once it's not enough, you can choose to convert from replication to sharding.There is also another discussion of differences between replication and sharding for your reference.