当前位置:网站首页>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()
边栏推荐
- ES6学习-- LET
- 2022-2028 global cloud based remote browser isolation industry research and trend analysis report
- Interview shock 23: talk about thread life cycle and transformation process?
- 数据治理,说起来容易,做起来难
- Why can't the mobile phone be used and the computer be connected
- Intimacy - [comfortable exit] - final communication to reduce injury
- 27 Chinese scholars including Yaoban and chendanqi from Tsinghua won the awards, and the list of winners of Sloan award in 2022 was issued
- Unity技术手册 - 粒子基础主模块属性-上
- MATLAB Programming Notes
- ORACLE - 数据查询
猜你喜欢

2022爱分析· IT运维厂商全景报告

Another breakthrough! Alibaba cloud enters the Gartner cloud AI developer service Challenger quadrant
[invitation letter] on March 4, the platform enabled digital intelligence Innovation -- UFIDA BiP PAAS cloud platform IUAP digital intelligence hundred cities forum · Jinan Station

ES6学习-- LET

数据治理,说起来容易,做起来难

2022-2028 global DC linear variable differential transformer (LVDT) industry survey and trend analysis report

How to design a complex business system? From the understanding of domain design, cloud native, micro service, and middle platform

2022-2028 global horizontal reciprocating compressor industry research and trend analysis report

NRM source switching tool

2022-2028 global proton exchange membrane hydrogen electrolyzer industry survey and trend analysis report
随机推荐
Unity技术手册 - GetKey和GetAxis和GetButton
2022-2028 global industrial touch screen industry research and trend analysis report
c语言与数据库的创建使用
如何用jmeter做接口测试
Talk about adapter mode
2022-2028 global variable frequency compressor technology industry research and trend analysis report
Analysis report on scale investigation and investment development suggestions of China's special equipment inspection and testing industry 2022-2028
Simple and easy-to-use cache library gcache
Nacos source code analysis 01 code structure
Yyds dry goods inventory CEPH installation visual dashboard
2022-2028 global carbon fiber unidirectional tape industry research and trend analysis report
Dio encapsulated by the flutter network request (cookie management, adding interceptors, downloading files, exception handling, canceling requests, etc.)
oracle -- 表操作
Openwrt (VIII) application layer development
小程序绘制一个简单的饼图
实战:typora里面如何快捷改变字体颜色(博客分享-完美)-2022.6.25(已解决)
How to design a complex business system? From the understanding of domain design, cloud native, micro service, and middle platform
Unity技术手册 - 粒子基础主模块属性-上
ES6 -- 形参设置初始值、拓展运算符、迭代器、生成函数
zabbix_server配置文件详解