当前位置:网站首页>Some points to pay attention to when closing mongodb services (as well as related commands when opening)
Some points to pay attention to when closing mongodb services (as well as related commands when opening)
2022-06-25 23:01:00 【Ah_ Bata】
involves MongoDB All operations are used user_mongo User action
( One ) Close the service
- You can use
ps -ef | grep [ The service name ]Query related processes , And then usekill -2 [ The service name ]The end of the process ( Close the service ) - Closing the service must not be used kill -9 Kill process !!! Because the service cannot be started when it is restarted !
( Two ) Close replica set
- When closing a replica set , The replica set master node must be closed last , If it closes before the replica node closes , Failover occurs , That is, the master node of the replica set changes from the original master node to the original replica node .
( 3、 ... and ) Close the partitioned cluster
- Need to follow Mongos→Shard→Config Server In this order , because Config Server It records the metadata of the entire partitioned cluster , and Mongos and Shard Both need to work with Config Server Interaction , therefore Config Server Must be the last to close , and mongos As a client-side interaction component, it can be closed first , On the contrary .
- Shut down the services in the server , for example :Config Server All three servers need to be shut down ,Shard All three servers have 3 Both need to be closed 3 individual ,Mongos Only the server nosql01 And the server nosql02 Yes, so just close both of them .
( Four ) Command to start the service
- First you need to get into MongoDB Of bin Can only be opened under the directory
- Turn on Config Server:
./mongod -f /opt/servers/mongodb_demo/shardcluster/configServer/configFile/mongodb_config.conf - Turn on Shard1:
./mongod -f /opt/servers/mongodb_demo/shardcluster/shard/configFile/mongodb_shard1.conf - Turn on Shard2:
./mongod -f /opt/servers/mongodb_demo/shardcluster/shard/configFile/mongodb_shard2.conf - Turn on Shard3:
./mongod -f /opt/servers/mongodb_demo/shardcluster/shard/configFile/mongodb_shard3.conf - Turn on Mongos:
./mongos -f /opt/servers/mongodb_demo/shardcluster/mongos/configFile/mongodb_mongos.conf
( 5、 ... and ) Turn off the balancer Balancer
- Before closing the partitioned cluster , Need to be in the database gateway perform
sh.stopBalancer()Command to turn off the balancer Balancer, Stop the migration and partition of blocks .
( 6、 ... and ) Restart the fragmented cluster
- Need to be in the database gateway perform
sh.startBalancer()Command to turn on the balancer - Be careful : After the security authentication is enabled, you need to use root The balancer can only be started after the user with permission has been authenticated , In which MongoDB Service process ( Specify the port number ) Executive sh.stopBalancer() Commands are added wherever they are root Authorize the user and execute sh.startBalancer() command .
- Relevant command ( Get into MongoDB After service ):
use admin
db.auth(“itcastAdmin”,”itcastAdmin”)
db.createUser({
user:”admin”,pwd:”admin”,roles:[{
role:”root”,db:”admin”}]})
db.auth(“admin”,”admin”)
use gateway
sh.startBalancer()
边栏推荐
- MySQL数据库索引
- Trillions of hot money smashed into the space economy. Is it really a good business?
- Privatization lightweight continuous integration deployment scheme -- 03 deployment of Web services (Part 2)
- Tlog helps Pangu framework realize microservice link log tracking
- Relinearization in homomorphic encryption (ckks)
- 2022-2028 global industrial TFT LCD industry survey and trend analysis report
- What should it personnel over 35 years old do if they are laid off by the company one day?
- Some reflections on preparing for the Blue Bridge Cup
- Use apiccloud AVM multi terminal component to quickly realize the search function in the app
- Yyds dry goods inventory JD 2, why is redis so fast?
猜你喜欢

Basic concepts of processor scheduling

Privatization lightweight continuous integration deployment scheme -- 03 deployment of Web services (Part 2)

Zhihu Gaozan: what ability is important, but most people don't have it?

Utilisation de la classe Ping d'Unity

Ribbon core ⼼ source code analysis
![[intensive lecture] 2022 PHP intermediate and advanced interview questions (II)](/img/50/c9572beaa035d5e6e78a57fcd1302c.jpg)
[intensive lecture] 2022 PHP intermediate and advanced interview questions (II)
![[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF](/img/a1/09d2dc0ec47c54530da4d42d218d1c.jpg)
[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF

2022-2028 global co extrusion production line industry research and trend analysis report

实战:typora里面如何快捷改变字体颜色(博客分享-完美)-2022.6.25(已解决)

2022-2028 global transmission type photoelectric circuit breaker industry research and trend analysis report
随机推荐
Initialization process of gstlibav
oracle -- 表操作
1281_FreeRTOS_vTaskDelayUntil实现分析
在线CRUDhasone关联查询报错Unabletouseinternalvariable:List
Trillions of hot money smashed into the space economy. Is it really a good business?
目前期货怎么开户安全些?哪些期货公司靠谱些?
Unity technical manual - particle foundation main module attributes - upper
Touring band: a 5g based multi camera remote distributed video production experiment
Development trend of China's power carrier communication industry and Research Report on the 14th five year plan 2022 ~ 2028
简单好用的缓存库 gcache
How to use the find command
小程序绘制一个简单的饼图
Analysis of China's tractor manufacturing and operation situation and forecast report of prospect trend 2022-2028
Why absolute positioning overlaps
等价类,边界值,场景法的使用方法和运用场景
adb常用命令
2022 love analysis · panoramic report of it operation and maintenance manufacturers
Facing the "industry, University and research" gap in AI talent training, how can shengteng AI enrich the black land of industrial talents?
Fastjson反序列化随机性失败
Why can't the mobile phone be used and the computer be connected