1.2. Start the SLAVE1 node:
Mongod-dbpath=d:\program_file\mongo\db2-logpath=d:\program_file\mongo\log\mongodb2.log--port 18002--slave--rest --nojournal--source localhost:18001
1.3. Start the Slave2 node:
Mongod-dbpath=d:\program_file\mongo\db3-logpath=d:\program_file\mongo\log\mongodb2.log--port 18003--slave--rest --nojournal--source localhost:18001
1.4. Open the main library and create a new library and table:
D:\program_file\mongo\mongodb\bin>mongo-port 18001
MongoDB Shell version:2.4.8
Connecting To:127.0.0.1:18001/test
Server has startup warnings:
Thu Mar 11:36:06.084 [Initandlisten]
Thu 11:36:06.084 [Initandlisten] * * Note:this is a bit MongoDB binary.
Thu 11:36:06.084 [Initandlisten] * * Bit builds are limited to less than 2GB of data (or less with--journa L).
Thu 11:36:06.084 [Initandlisten] * * * This journaling defaults to out for bit and are currently off.
Thu Mar 11:36:06.084 [Initandlisten] * * * http://dochub.mongodb.org/core/32bit
Thu Mar 11:36:06.084 [Initandlisten]
Thu Mar 11:36:06.192 [Initandlisten]
Thu 11:36:06.192 [Initandlisten] * * Warning:mongod started without--replset yet 1 documents are present in local. System.replset
Thu 11:36:06.192 [Initandlisten] * * Restart with--replset unless-are doing-maintenance and no other C Lients are connected.
Thu 11:36:06.192 [Initandlisten] * * * The TTL collection monitor would not start because to this.
Thu 11:36:06.192 [Initandlisten] * * For more info | http://dochub.mongodb.org/core/ttlcollections
Thu Mar 11:36:06.192 [Initandlisten]
> Show DBS;
Admin 0.0625GB
Local 0.15625GB
Maketion 0.0625GB
MyDB 0.0625GB
> Use test
Switched to DB test
> Db.test.insert ({_id:1,name: "Name_test"});
> Db.test.find ()
{"_id": 1, "name": "Name_test"}
1.5. Open from the library to see if the newly established database and table are synchronized:
D:\program_file\mongo\mongodb\bin>mongo-port 18002
MongoDB Shell version:2.4.8
Connecting To:127.0.0.1:18002/test
Server has startup warnings:
Thu Mar 11:44:17.236 [Initandlisten]
Thu 11:44:17.236 [Initandlisten] * * Note:this is a bit MongoDB binary.
Thu 11:44:17.236 [Initandlisten] * * Bit builds are limited to less than 2GB of data (or less with--journa L).
Thu 11:44:17.236 [Initandlisten] * * * This journaling defaults to out for bit and are currently off.
Thu Mar 11:44:17.236 [Initandlisten] * * * http://dochub.mongodb.org/core/32bit
Thu Mar 11:44:17.236 [Initandlisten]
Thu Mar 11:44:17.263 [Initandlisten]
Thu 11:44:17.263 [Initandlisten] * * Warning:mongod started without--replset yet 1 documents are present in local. System.replset
Thu 11:44:17.263 [Initandlisten] * * Restart with--replset unless-are doing-maintenance and no other C Lients are connected
Thu 11:44:17.263 [Initandlisten] * * * The TTL collection monitor would not start because to this.
Thu 11:44:17.263 [Initandlisten] * * For more info | http://dochub.mongodb.org/core/ttlcollections
Thu Mar 11:44:17.263 [Initandlisten]
> Show DBS;
Admin 0.0625GB
Local 0.09375GB
Maketion 0.0625GB
MyDB 0.0625GB
Test 0.0625GB
> Use test;
Switched to DB test
> Show Collections;
System.indexes
Test
> Db.test.find ();
{"_id": 1, "name": "Name_test"}
>
As you can see, a new library test is created, and the table: Test and data are synchronized.
-----------------------------------------------------------------------------------
2 experimental replica set, and verify the automatic switching primary successful, grasping the graph experiment process
The following is configured as a Replset test environment for the previous period:
2.1 Establishment of the relevant directory:
mkdir D:\Program_file\mongo\key
mkdir D:\PROGRAM_FILE\MONGO\DB1
mkdir D:\PROGRAM_FILE\MONGO\DB2
mkdir D:\PROGRAM_FILE\MONGO\DB3
mkdir D:\PROGRAM_FILE\MONGO\DB4
--After file copy add--fastsync parameter to start (copy if not primary, the node before the start copy will become primary)
D:\Program_file\mongo\mongodb\bin\mongod.exe--replset rs1--keyfile d:\program_file\mongo\key\r4-dbpath=d:\ Program_file\mongo\db4-logpath=d:\program_file\mongo\log\mongodb4.log--logappend--journal--port 28014--fastsync
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.