Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to delete add replica set and modify replica set IP and other information by MongoDB

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article shows you how to delete add replica set and modify replica set IP and other information, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article, I hope you can get something.

MongoDB delete, add replica set, and modify replica set IP and other information

Add a copy and enter under login to the primary node

Rs.add ("ip:port")

Delete copy

Rs.remove ("ip:port")

New arbitration node

Rs.addArb ("ip:port")

Modify the copy host:

Shard1:PRIMARY > cfg = rs.conf ()

{

"_ id": "shard1"

"version": 5

"protocolVersion": NumberLong (1)

"members": [

{

"_ id": 0

"host": "127.0.0.1 purl 2777"

"arbiterOnly": false

"buildIndexes": true

"hidden": false

"priority": 1

"tags": {

}

"slaveDelay": NumberLong (0)

"votes": 1

}

]

"settings": {

"chainingAllowed": true

"heartbeatIntervalMillis": 2000

"heartbeatTimeoutSecs": 10

"electionTimeoutMillis": 10000

"getLastErrorModes": {

}

"getLastErrorDefaults": {

"w": 1

"wtimeout": 0

}

"replicaSetId": ObjectId ("5d9c7a7e76695600e03e231f")

}

}

Shard1:PRIMARY > cfg.members [0] .host = "10.13.10.2pur2777"

10.130.10.72:2777

Shard1:PRIMARY > rs.reconfig (cfg)

{"ok": 1}

Shard1:PRIMARY > rs.status ()

{

"set": "shard1"

Date: ISODate ("2019-10-09T02:59:26.916Z")

"myState": 1

"term": NumberLong (1)

"heartbeatIntervalMillis": NumberLong (2000)

"members": [

{

"_ id": 0

"name": "10.130.10.72 purl 2777"

"health": 1

"state": 1

"stateStr": "PRIMARY"

"uptime": 54711

"optime": {

Ts: Timestamp (1570589961, 1)

"t": NumberLong (1)

}

OptimeDate: ISODate ("2019-10-09T02:59:21Z")

ElectionTime: Timestamp (1570536062, 2)

ElectionDate: ISODate ("2019-10-08T12:01:02Z")

"configVersion": 6

"self": true

}

]

"ok": 1

}

The above is MongoDB how to delete add replica set and modify replica set IP and other information, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report