Dual-machine disaster recovery configuration scheme of MongoDB and KT

Source: Internet
Author: User

Assume that there are two data centers (2/3 and 123/124 of test servers) for mutual disaster recovery (the disaster recovery data center is on standby for external services at the master data center ), applications only connect to the storage services of their own data centers (mongodb1.6.5 and KT 0.9.28). The storage services between the two data centers need to be synchronized with each other. The solution is as follows:

No.

MachineIPAnd Port

Service

Remarks

1

IP address 192.168.2.2: 10000

Master Data Center MongoDB mascript

And 8-way Synchronization

2

IP address 192.168.2.2: 20000

Primary data center MongoDB replica set1

2, 5, 9, 12 are data nodes, and 7, 14 are forensic nodes.

3

IP address 192.168.2.2: 30000

Primary data center KT node1

And 10 bidirectional Synchronization

4

IP address 192.168.2.3: 10000

Active Data Center MongoDB slavea

Copy data from 1 to 8

5

IP address 192.168.2.3: 20000

Primary data center MongoDB replica set2

2, 5, 9, 12 are data nodes, and 7, 14 are forensic nodes.

6

IP address 192.168.2.3: 30000

Primary data center KT node2

And 13 bidirectional Synchronization

7

IP address 192.168.2.3: 40000

Primary data center MongoDB replica arb1

Forensic Server 1

8

192.168.2.123: 10000

Disaster recovery data center MongoDB masterb

And 1 bidirectional Synchronization

9

192.168.2.123: 20000

Disaster recovery data center MongoDB replica set3

2, 5, 9, 12 are data nodes, and 7, 14 are forensic nodes.

10

192.168.2.123: 30000

Disaster recovery data center KT node1

And 3 bidirectional Synchronization

11

192.168.2.124: 10000

Disaster recovery data center MongoDB slaveb

Copy data from 1 to 8

12

192.168.2.124: 20000

Disaster recovery data center MongoDB replica set4

2, 5, 9, 12 are data nodes, and 7, 14 are forensic nodes.

13

192.168.2.124: 30000

Disaster recovery data center KT node2

And 6-way Synchronization

14

192.168.2.124: 40000

Disaster recovery data center MongoDB replica arb2

Forensic Server 2

This configuration set has the following features:

1. four copies of MongoDB Master/Slave structured data

2 MongoDB replica sets structure data storage 4 copies

3. Each KT2 node stores two copies of data(If you use KT like memcached, you need to use the same hash for different Server IP addresses on the client to hash keys to different nodes, that is, if the endpoint is not used as the hash value, the same key is kept and the same node is obtained after the Failover. This is only the logic of the client, synchronization between a group of nodes is only required for the server)

4. After switching to the disaster recovery data center, no configuration changes are required. After the data center is ready, make sure that the active server of the replica set is in the disaster recovery data center, otherwise, applications in the disaster recovery data center may still access the storage service in the data center.

Note:

1. In addition to four replica sets, two verification nodes are required because, after testing, if two replica sets in the same data center are quickly disabled, the master node cannot be correctly elected. If data backup in the same data center is not required, we can consider using only two data nodes.

2. tests show that if you do not subscribe to 1 on November 11, you can only accept 8 data changes. 1 data changes will not come over. This is also a defect of MongoDB. Cascade replication is not supported, if you subscribe to 1, two bandwidths will be generated in the leased line.

 

The specific configuration is as follows:

192.168.2.2

MongoDBMaster Port10000/11000

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 10000 -- dbpath/opt/MongoDB/10000 -- logpath/opt/MongoDB/10000/log -- rest -- oplogsize 1024 -- logappend -- master -- slave -- source 192.168.2.123: 10000 -- slavedelay 10 -- autoresync

MongoDB relica set 1Port20000/21000

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 20000 -- dbpath/opt/MongoDB/20000 -- logpath/opt/MongoDB/20000/log -- replset blub -- rest -- oplogsize 1024- logappend

/Root/mongodb-linux-x86_64-1.6.5/bin/Mongo -- port 20000

Config = {_ ID: 'blub', members :[

{_ ID: 0, host: '192. 168.2.2: 100 '},

{_ ID: 1, host: '192. 168.2.3: 100 '},

{_ ID: 2, host: '192. 168.2.123: 100 '},

{_ ID: 3, host: '192. 168.2.124: 100 '},

]}

Rs. Initiate (config)

Rs. Status ()

Rs. addarb ("192.168.2.124: 40000 ")

Rs. addarb ("192.168.2.3: 40000 ")

KT node1Port30000/31000

Kchashmgr create/opt/Kt/30000.kch

Ktserver-port 30000-ulog/opt/Kt/30000-ulog-Sid 1-mhost 192.168.2.123-mport 30000-RTS/opt/Kt/30000.rts-plsv/usr/local/libexec/ktplugservmemc. so-plex "Port = 31000 # opts = F"-DMN/opt/Kt/30000.kch

192.168.2.3

MongoDBSlave Port10000/11000

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 10000 -- dbpath/opt/MongoDB/10000 -- logpath/opt/MongoDB/10000/log -- rest -- oplogsize 1024 -- logappend-slave -- slavedelay 2 -- autoresync

/Root/mongodb-linux-x86_64-1.6.5/bin/Mongo -- port 10000

Use local

DB. Sources. insert ({"host": "192.168.2.2: 10000 "});

DB. Sources. insert ({"host": "192.168.2.123: 10000 "});

MongoDB relica set 2Port20000/21000

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 20000 -- dbpath/opt/MongoDB/20000 -- logpath/opt/MongoDB/20000/log -- replset blub -- rest -- oplogsize 1024- logappend

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- Port 40000 -- dbpath/opt/MongoDB/40000 -- logpath/opt/MongoDB/40000/log -- replset blub -- rest -- oplogsize 1- logappend

/Root/mongodb-linux-x86_64-1.6.5/bin/Mongo -- port 20000

Config = {_ ID: 'blub', members :[

{_ ID: 0, host: '192. 168.2.2: 100 '},

{_ ID: 1, host: '192. 168.2.3: 100 '},

{_ ID: 2, host: '192. 168.2.123: 100 '},

{_ ID: 3, host: '192. 168.2.124: 100 '},

]}

Rs. Initiate (config)

Rs. Status ()

Rs. addarb ("192.168.2.124: 40000 ")

Rs. addarb ("192.168.2.3: 40000 ")

KT node2Port30000/31000

Kchashmgr create/opt/Kt/30000.kch

Ktserver-port 30000-ulog/opt/Kt/30000-ulog-Sid 1-mhost 192.168.2.124-mport 30000-RTS/opt/Kt/30000.rts-plsv/usr/local/libexec/ktplugservmemc. so-plex "Port = 31000 # opts = F"-DMN/opt/Kt/30000.kch

192.168.2.123

MongoDBMaster Port10000/11000

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 10000 -- dbpath/opt/MongoDB/10000 -- logpath/opt/MongoDB/10000/log -- rest -- oplogsize 1024 -- logappend -- master -- slave -- source 192.168.2.2: 10000 -- slavedelay 10 -- autoresync

MongoDB relica set 3Port20000/21000

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 20000 -- dbpath/opt/MongoDB/20000 -- logpath/opt/MongoDB/20000/log -- replset blub -- rest -- oplogsize 1024- logappend

/Root/mongodb-linux-x86_64-1.6.5/bin/Mongo -- port 20000

Config = {_ ID: 'blub', members :[

{_ ID: 0, host: '192. 168.2.2: 100 '},

{_ ID: 1, host: '192. 168.2.3: 100 '},

{_ ID: 2, host: '192. 168.2.123: 100 '},

{_ ID: 3, host: '192. 168.2.124: 100 '},

]}

Rs. Initiate (config)

Rs. Status ()

Rs. addarb ("192.168.2.124: 40000 ")

Rs. addarb ("192.168.2.3: 40000 ")

KT node1Port30000/31000

Kchashmgr create/opt/Kt/30000.kch

Ktserver-port 30000-ulog/opt/Kt/30000-ulog-Sid 2-mhost 192.168.2.2-mport 30000-RTS/opt/Kt/30000.rts-plsv/usr/local/libexec/ktplugservmemc. so-plex "Port = 31000 # opts = F"-DMN/opt/Kt/30000.kch

192.168.2.124

MongoDBSlave Port10000/11000

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 10000 -- dbpath/opt/MongoDB/10000 -- logpath/opt/MongoDB/10000/log -- rest -- oplogsize 1024 -- logappend -- slave -- slavedelay 2 -- autoresync

/Root/mongodb-linux-x86_64-1.6.5/bin/Mongo -- port 10000

Use local

DB. Sources. insert ({"host": "192.168.2.123: 10000 "});

DB. Sources. insert ({"host": "192.168.2.2: 10000 "});

MongoDB relica set 4

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- port 20000 -- dbpath/opt/MongoDB/20000 -- logpath/opt/MongoDB/20000/log -- replset blub -- rest -- oplogsize 1024 -- logappend

/Root/mongodb-linux-x86_64-1.6.5/bin/mongod -- fork -- Port 40000 -- dbpath/opt/MongoDB/40000 -- logpath/opt/MongoDB/40000/log -- replset blub -- rest -- oplogsize 1 -- logappend

/Root/mongodb-linux-x86_64-1.6.5/bin/Mongo -- port 20000

Config = {_ ID: 'blub', members :[

{_ ID: 0, host: '192. 168.2.2: 100 '},

{_ ID: 1, host: '192. 168.2.3: 100 '},

{_ ID: 2, host: '192. 168.2.123: 100 '},

{_ ID: 3, host: '192. 168.2.124: 100 '},

]}

Rs. Initiate (config)

Rs. Status ()

Rs. addarb ("192.168.2.124: 40000 ")

Rs. addarb ("192.168.2.3: 40000 ")

KT node2Port30000/31000(And192.168.2.4: 30000Synchronization)

Kchashmgr create/opt/Kt/30000.kch

Ktserver-port 30000-ulog/opt/Kt/30000-ulog-Sid 2-mhost 192.168.2.3-mport 30000-RTS/opt/Kt/30000.rts-plsv/usr/local/libexec/ktplugservmemc. so-plex "Port = 31000 # opts = f" DMN/opt/Kt/30000.kch

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.