O'Reilly logo

MongoDB: The Definitive Guide, 2nd Edition by Kristina Chodorow

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Data Administration

This chapter covers how to administrate your collections and databases. Generally the things covered in this section are not daily tasks but can be critically important for your application’s performance, for instance:

  • Setting up authentication and user accounts

  • Creating indexes on a running system

  • “Preheating” a new server to allow it to come online quickly

  • Defragmenting data files

  • Preallocating new data files manually

Setting Up Authentication

One of the first priorities for systems administrators is to ensure their system is secure. The best way to handle security with MongoDB is to run it in a trusted environment, ensuring that only trusted machines are able to connect to the server. That said, MongoDB supports per-connection authentication, albeit with a fairly coarse-grained permissions scheme.

Note

There are more sophisticated security features in MongoDB Enterprise. See http://docs.mongodb.org/manual/security for the most up-to-date information about authentication and authorization.

Authentication Basics

Each database in a MongoDB instance can have any number of users. When security is enabled, only authenticated users of a database are able to perform read or write operations.

There are two special databases: users in the admin and local databases can perform operations on any database. A user that belongs to either one of these databases can be thought of as a superuser. After authenticating, admin users are able to read or write from any database ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required