【MongoDB】windows平台搭建Mongo数据库复制集(类似集群)
Replica Sets(复制集)是在mongodDB1.6版本开始新增的功能,它可以实现故障自动切换和自动修复功能成员节点的功能,各个DB之间的数据完全一致,大大降低了单点故障的风险。 【】 以上图示是三个节点的Replica Set架构。该图来源于红丸编写的《Mongodb管理与
Replica Sets(复制集)是在mongodDB1.6版本开始新增的功能,它可以实现故障自动切换和自动修复功能成员节点的功能,各个DB之间的数据完全一致,大大降低了单点故障的风险。
【】
以上图示是三个节点的Replica Set架构。该图来源于红丸编写的《Mongodb管理与开发精要》这本书。从上图可以看出,结构类似与一个集群,其实完全可以当做一个集群。因为它确实和集群实现的作用是相同的。
一、部署Replica Sets.
接下来显示如何在一台服务器上面演示部署3个节点的Replica Sets
二、启动Replica服务
分别打开三个命令窗口,然后分别执行下面三句话。
mongod.exe --replSet rs1 --keyFile "D:\Program Files\mongodb\data\replica\key\r0" --port 28010 --dbpath "D:\Program Files\mongodb\data\replica\data\r0" --logpath "D:\Program Files\mongodb\data\replica\log\r0.log" --logappend mongod.exe --replSet rs1 --keyFile "D:\Program Files\mongodb\data\replica\key\r1" --port 28011 --dbpath "D:\Program Files\mongodb\data\replica\data\r1" --logpath "D:\Program Files\mongodb\data\replica\log\r1.log" --logappend cd /d D:\Program Files\mongodb\bin mongod.exe --replSet rs1 --keyFile "D:\Program Files\mongodb\data\replica\key\r2" --port 28012 --dbpath "D:\Program Files\mongodb\data\replica\data\r2" --logpath "D:\Program Files\mongodb\data\replica\log\r2.log" --logappend

喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+yP2horXHwry/zbuntsujrLP1yry7r1JlcGxpY2EgU2V0c7u3vrM8L3A+CjxwPjxpbWcgc3JjPQ=="http://www.2cto.com/uploadfile/Collfiles/20141030/201410300925258.png" alt="\">

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











When developing an e-commerce website, I encountered a difficult problem: how to provide users with personalized product recommendations. Initially, I tried some simple recommendation algorithms, but the results were not ideal, and user satisfaction was also affected. In order to improve the accuracy and efficiency of the recommendation system, I decided to adopt a more professional solution. Finally, I installed andres-montanez/recommendations-bundle through Composer, which not only solved my problem, but also greatly improved the performance of the recommendation system. You can learn composer through the following address:

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

MongoDB is suitable for unstructured data and high scalability requirements, while Oracle is suitable for scenarios that require strict data consistency. 1.MongoDB flexibly stores data in different structures, suitable for social media and the Internet of Things. 2. Oracle structured data model ensures data integrity and is suitable for financial transactions. 3.MongoDB scales horizontally through shards, and Oracle scales vertically through RAC. 4.MongoDB has low maintenance costs, while Oracle has high maintenance costs but is fully supported.
