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

Reduction of mongodb fragments and addition of configsvr nodes

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Add configsvr to sharding

MongoDB requires 1 or 3 configsver instances, otherwise it cannot be started

1. Export the config library from the original configuration service (21000) and import the new configuration service (21001mem21002):

# mongodump-- port 21000-d config # Export

# mongorestore-- port 21001-d configdump/config # Import

# mongorestore-- port 21002-d configdump/config # Import

Restart the mongos service:

Restart all shard service instances

Expansion completed

# #

Fragment reduction configsvr

There used to be three configdb, now only one is needed, the operation process:

When mongos starts, only one configsvrip and port need to be configured

Mongos-- configdb 192.168.13.11 port 21000-- port

Restart the mongos service:

Restart all shard service instances

# # #

Different config reported an error

Error: error: {

"$err": "setShardVersion failed shard:shard2:shard2/192.168.13.11:22002192.168.13.12:22002 {configdb: {stored:\" 192.168.13.11 configdb 21000192.168.13.12 stored 21000\, given:\ "192.168.13.11 configdb 21000\"}, ok: 0.0 Errmsg:\ "mongos specified adifferent config database string: stored: 192.168.13.11 stored 21000192.168.13.12 vs given 21000 vs given: 192.168.13.13 stored 21000\", $gleStats: {lastOpTime: Timestamp 0 | 0, electionId:ObjectId ('58255aae0182cbf39c07f16b')}} "

If you reduce and increase the config link mongo

The above error occurred in querying database tables and adding new database tables. The following methods will solve the problem.

Restart the mongos service:

Restart all shard service instances

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

Database

Wechat

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

12
Report