Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
MongoDB High Availability

You're reading from  MongoDB High Availability

Product type Book
Published in Jul 2014
Publisher
ISBN-13 9781783986729
Pages 164 pages
Edition 1st Edition
Languages
Author (1):
Afshin Mehrabani Afshin Mehrabani
Profile icon Afshin Mehrabani

Table of Contents (17) Chapters

MongoDB High Availability
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Understanding the MongoDB Architecture and Processes 2. Understanding MongoDB's Failures and Limitations 3. Clustering in MongoDB 4. Utilizing a Replica Set 5. Replica Set in Action 6. Understanding the Concept of Sharding 7. Sharding in Action 8. Analyzing and Improving Database Performance 9. Migrating Instances and Reducing Downtime 10. Monitoring and Troubleshooting the Database Index

Migrating a standalone mongod instance


Basically, there are two ways to move a standalone mongod instance to another server:

  • Convert it to a replica set and follow replica set migration

  • Move dbpath to the new server manually

However, the first approach is recommended since it has less outage. We will introduce both methods in further sections.

Converting an existing instance to a replica set

There are some straightforward steps to convert a standalone instance to a replica set. As you already learned in previous chapters, a replica set should have a name. This name is configurable via a configuration file or command-line parameters for the mongod process.

In order to define the replica set's name, you can use the replSet setting. For instance, the following configuration file sets the replica set name to rs1:

logpath = /var/log/mongodb.log
port = 27017
fork = true
replSet = rs1

Also, you can use the following command-line parameters:

mongod --port 27017 --dbpath /var/log/mongodb.log --replSet rs1...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}