S Harding
S Harding
What is sharding
• Sharding refers to the process of splitting data up across machines;
• A subset of data is placed on different servers.
• MongoDB supports auto sharding
• The application always to sharding server as it connects to standalone
server
• The data moves around the cluster automatically.
• The recommended means of configuring and deploying sharded
clusters is through either MongoDB Ops Manager or MongoDB Atlas
Mongos
• In a sharded cluster, there can be 2, 3, 10, or even hundreds of
members or shards, which look like a single machine to your
application.
• To hide these details from the application, we run one or more
routing processes called a mongos in front of the shards.
• A mongos keeps a “table of contents” that tells it which shard
contains which data.
• Applications can connect to mongos and issues commands normally.
Config Server
• They can be considered as the brain of the cluster
• They hold all of the metadata about which servers hold what data.
• The config servers must be started before any of the mongos
processes, as mongos pulls its configuration from them.
• mongod --configsvr --replSet configRS --bind_ip localhost,10.17.57.10
--dbpath /u01/data1 --port 27018 --logpath /u01/data1/mongod.log
--fork
• The --configsvr option indicates to the mongod that you are planning
to use it as a config server.
Config Server
• The --configsvr option indicates to the mongod that you are planning to use it as a
config server.
• On a server running with this option, clients (i.e., other cluster components)
cannot write data to any database other than config or admin.