Home  >  Article  >  Database  >  【MongoDB】windows下搭建Mongo主(Master)/从(slave)数据库同

【MongoDB】windows下搭建Mongo主(Master)/从(slave)数据库同

WBOY
WBOYOriginal
2016-06-07 16:06:141173browse

在前面一系列的文章中,我们讲述了mongodb的基本操作,高级查询以及索引的使用。该篇博客主要说明在windows系统如何创建主从数据库同步; 需要启动两个mongoDb文档数据库,一个是主模式启动,另一个是属于从模式启动。 1. 创建主从服务器 主服务器:192.168.

在前面一系列的文章中,我们讲述了mongodb的基本操作,高级查询以及索引的使用。该篇博客主要说明在windows系统如何创建主从数据库同步;

需要启动两个mongoDb文档数据库,一个是主模式启动,另一个是属于从模式启动。

1. 创建主从服务器

主服务器:192.168.1.131:27017

备服务器:192.168.1.131:27015

创建主服务器

\

创建备服务器:喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+ICAgICAgPGltZyBzcmM9"http://www.2cto.com/uploadfile/Collfiles/20141023/2014102309102071.png" alt="\">

2.启动主备服务

\

\

3.进行同步数据测试

在主机上创建数据库,并插入数据:

\

\

客户端以及主备机的关系图


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn