Posts

Showing posts from April, 2019

MongoDB sharding the simple way

Here, I will discuss how to create mongo shard in the single machine (locally) for dev environment. My OS is Linux Mint and MongoDB version is 4+. Install MongoDB: I downloaded mongodb tar files and extracted it to the /opt/mongo/. Create database directory: $mkdir -p /opt/mongo_db/shard_db I like /opt directory very much, if you do not like create your database directory in /opt, please create it in your desire location. I dislike pointless argument. To create shard you must have a plan to organize your shard clusters. In this example, I will create 3 shard each shard will have 2 replicate sets and 1 config server with 2 replicate sets and 1 mongos to connect shard cluster via config server 1) Shard servers/clusters   1.1) Create sdb directory inside the shard_db/ directory:          $mkdir sdb     1.2) Inside sdb/ directory we are going to create 6 directories as I mentioned earlier that I am going to create 3 shard with 2 replica sets:         Shard1:        

How to copy directory structure without copying contents of the directory

Few days ago, I have to download Spring Framework latest stable jars. There is no single zip file which contains all the jars of Spring Framework. So, I have to create the directory for specific jar and download it.  I had older version of Spring Framework directory which contains folder for specific jar file. I do not want copy the content inside the directory just directory structure. Therefore, I issued the following command. find . -type d >dirs.txt xargs mkdir -p