What is
MongoDB has 2 concepts that may lead even intermediate programmers to confusion! So let's break it down and explain both in depth.
1- Take a deep breath. :)
2- Replication: replicate means reproducing or making an exact copy of something. In
In
3- Sharding: sharding on the other hand has completely a different concept. If you have a server with 1 terabyte of data and you have 4 servers, then each nore will have 250 gigabyte of data each. As you may have guessed it is not fault tolerant because each part of data resides in a separate server. Each read and write will be sent to the corresponding section. So if you add more shards, both read and write performance will be improved in the cluster. When one shard of the cluster goes down, any data on it is inaccessible. For that reason each member of the cluster should also be a replica-set, but not required to.
4- Take another deep breath, and let's get back to work.
#mongodb #mongo #shard #replica #replication #sharding #cluster
shard
and replication
in mongoDB
? What is their differences?MongoDB has 2 concepts that may lead even intermediate programmers to confusion! So let's break it down and explain both in depth.
1- Take a deep breath. :)
2- Replication: replicate means reproducing or making an exact copy of something. In
MongoDB
replication, mirror all data sets into another server. This is process is used for fault tolerance. If there are 4 mongo servers and your dataset is 1 terabyte, each node in replica-set will have 1 terabyte of data.In
replica-set
there is ONE master (primary) node, and one or more slaves (secondary). Read performance can be improved by adding more and more slaves, but not writes! Adding more slaves does not affect writes, that's because all writes goes to master first and then will be propagated to other slaves.3- Sharding: sharding on the other hand has completely a different concept. If you have a server with 1 terabyte of data and you have 4 servers, then each nore will have 250 gigabyte of data each. As you may have guessed it is not fault tolerant because each part of data resides in a separate server. Each read and write will be sent to the corresponding section. So if you add more shards, both read and write performance will be improved in the cluster. When one shard of the cluster goes down, any data on it is inaccessible. For that reason each member of the cluster should also be a replica-set, but not required to.
4- Take another deep breath, and let's get back to work.
#mongodb #mongo #shard #replica #replication #sharding #cluster
Elasticsearch
gives below error:Config: Error 403 Forbidden: blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];: [cluster_block_exception] blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];
This error may happen when server storage is totally full and
elasticsearch
puts your indexes in read only mode. If you have enoughspace now and are sure there is no other matter for elasticsearch and it behaves normally, remove read only mode from index block:
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/.monitoring-*/_settings -d '{"index.blocks. read_only_allow_delete": null}'
#elasticsearch #read_only #index #cluster_block_exception