Home > database >  Through the gate access directing a copy set IP address
Through the gate access directing a copy set IP address

Time:09-19

In 10.235 the three network virtual machine deployment of the directing a copy of the set, the virtual machine deployment of the network segment Springboot engineering can normal visit,
The spring configuration file:
Data:
Mongo:
Uri: mongo://iot: [email protected]:27017,10.235. 10.11:27018,10.235. 10.12:27019/db

Then for some reason, the database need behind all nets brake, applications accessed through network gateway,
Nets brake configuration information is as follows:
Nets brake mongo
172.255.254.23:27017 10.235.10.10:27017
172.255.254.23:27018 10.235.10.10:27018
172.255.254.23:27019 10.235.10.10:27019

Change after the spring configuration file:
Data:
Mongo:
Uri: mongo://iot: [email protected]:27017172255 254.23:27018172255 254.23:27019/db

Now problem is the application link mongo abnormalities, log information is as follows:

Connected mongo final application is using a real (net) after the brake mongo service IP address, rather than the network gateway IP address, so the timeout:


But to the spring configuration file instead of single node can be used:
Data:
Mongo:
Uri: mongo://iot: [email protected]:27017/db

CodePudding user response:

Copy should be set mode connection after connection of IP and implement rs. The results of the status

CodePudding user response:

reference 1st floor rucypli response:
copy should be set mode connection after connection of IP and implement rs. The results of the status inconsistency

What is a good solution?

CodePudding user response:

Temporarily in a silly way to ensure high availability,
Copies of the following is not to have set way to start:
Data:
Mongo:
Uri: mongo://iot: [email protected]:27017/db

So, dynamic wrote three sources uri: mongo://iot: [email protected]:27017/db, uri: mongo://iot: [email protected]:27018/db, uri: mongo://iot: [email protected]:27019/db
And then determine which program is available, feel good 2 b, like write the BUG,

CodePudding user response:

I connected to a similar mistake in python, reduce pymongo driver a large version, 3.8 to 2.9

CodePudding user response:

CodePudding user response:

The connecting way of directing a replicate set wrong, the correct url format is

CodePudding user response:

refer to 7th floor ThreeeOrange response:
mongo copy set way of connection is wrong, the correct url is

Mongo:///username: password @ host1 [: port1] [... hostN [: portN]] [/[database]? [options]]

The copy set after the connection string to add replicaSet=your replicaSet name
  • Related