Chapter 1. Installing and Starting the MongoDB Server

In this chapter, we will cover the following recipes:

  • Single node installation of MongoDB
  • Starting a single node instance using command-line options
  • Single node installation of MongoDB with options from the config file
  • Connecting to a single node from the Mongo shell with a preloaded JavaScript
  • Connecting to a single node from a Java client
  • Starting multiple instances as part of a replica set
  • Connecting to the replica set from the shell to query and insert data
  • Connecting to the replica set to query and insert data from a Java client
  • Starting a simple sharded environment of two shards
  • Connecting to a shard from the Mongo shell and performing operations

Introduction

In this chapter, we will look at starting up the MongoDB server. Though it is a cakewalk to start the server for development purposes and with the default settings, there are numerous options that let us tune the startup behavior. We will start the server as a single node; then, we'll introduce various configurations before we conclude by starting up a simple replica set and a sharded setup. So, let's get started by installing and setting up the MongoDB server in the easiest way possible, for simple development purposes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset