2015-11-26 17:16:42.0|分类: MongoDB|浏览量: 1822
在一台电脑测试副本集,副本集成员开启不同的端口号27017,设置不同的mongodb数据路径 This procedure describes deploying a replica set in a development or test environment. For a production deployment, refer to the Deploy a Replica Set tutorial. This tutorial describes how to create a three-member replica set from three existing mongod instances running with access control disabled. To deploy a replica set with enabled access control, see Deploy Replica Set and Configure Authentication and Authorization. If you wish to deploy a replica set from a single MongoDB instance, see Convert a Standalone to a Replica Set. For more information on replica set deployments, see the Replication andReplica Set Deployment Architectures documentation. OverviewThree member replica sets provide enough redundancy to survive most network partitions and other system failures. These sets also have sufficient capacity for many distributed read operations. Replica sets should always have an odd number of members. This ensures that elections will proceed smoothly. For more about designing replica sets, see the Replication overview. The basic procedure is to start the mongod instances that will become members of the replica set, configure the replica set itself, and then add the mongod instances to it. RequirementsFor test and development systems, you can run your mongod instances on a local system, or within a virtual instance. Before you can deploy a replica set, you must install MongoDB on each system that will be part of yourreplica set. If you have not already installed MongoDB, see the installation tutorials. Before creating your replica set, you should verify that your network configuration allows all possible connections between each member. For a successful replica set deployment, every member must be able to connect to every other member. For instructions on how to check your connection, see Test Connections Between all Members. ConsiderationsReplica Set NamingIMPORTANT These instructions should only be used for test or development deployments. The examples in this procedure create a new replica set named rs0. If your application connects to more than one replica set, each set should have a distinct name. Some drivers group replica set connections by replica set name. You will begin by starting three mongod instances as members of a replica set named rs0. Procedure
Check the status of your replica set at any time with the rs.status() operation. SEE ALSO The documentation of the following shell functions for more information: You may also consider the simple setup script as an example of a basic automatically-configured replica set. Refer to Replica Set Read and Write Semantics for a detailed explanation of read and write semantics in MongoDB. |