MySQL Cluster篇11 — 单用户模式

概述

本章,您将学习 MySQL NDB Cluster 中的单用户模式。

单用户模式:针对 SQL 节点,NDB Cluster 中用来限制访问的具有维护性质的模式,其功能类似 Centos 6 以及之前版本的单用户模式。进入到单用户模式后:

  • 对数据库系统的访问仅限单个 SQL 节点,所有剩余的其他 SQL 节点都会被安全关闭
  • 正在运行中的事务会被终止且不允许启用新的事务

若要进入到单用户模式,需要在任意一个管理节点中使用 ndb_mgm 命令进入到交互终端并使用 enter single user mode node_id 命令,其中 node_id 替换为单个 SQL 节点的节点 ID

进入单用户模式

作者的 MySQL NDB Cluster 已经启动,节点 ID 为 4 的 SQL 节点将进入到单用户模式:

# 正常情况下的输出
Shell (192.168.100.10)> ndb_mgm -e show
Connected to management server at localhost port 1186 (using cleartext)
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=2    @192.168.100.12  (mysql-8.4.8 ndb-8.4.8, Nodegroup: 0, *)
id=3    @192.168.100.14  (mysql-8.4.8 ndb-8.4.8, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.100.10  (mysql-8.4.8 ndb-8.4.8)

[mysqld(API)]   1 node(s)
id=4    @192.168.100.16  (mysql-8.4.8 ndb-8.4.8)

# 节点 ID 为 4 的 SQL 节点将进入到单用户模式
Shell (192.168.100.10)> ndb_mgm -e "enter single user mode 4"
Single user mode entered
Access is granted for API node 4 only.

# 再次查看
Shell (192.168.100.10)> ndb_mgm -e show
Connected to management server at localhost port 1186 (using cleartext)
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=2    @192.168.100.12  (mysql-8.4.8 ndb-8.4.8, single user mode, Nodegroup: 0, *)
id=3    @192.168.100.14  (mysql-8.4.8 ndb-8.4.8, single user mode, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.100.10  (mysql-8.4.8 ndb-8.4.8)

[mysqld(API)]   1 node(s)
id=4    @192.168.100.16  (mysql-8.4.8 ndb-8.4.8, allowed single user)

退出单用户模式

若当前的维护工作已经完成,则可以让整个集群环境恢复到正常模式,等待连接的 SQL 节点将再次被允许成功连接:

# 节点 ID 为 4 的 SQL 节点将退出单用户模式
Shell (192.168.100.10)> ndb_mgm -e "exit single user mode 4"
Exiting single user mode in progress.
Use ALL STATUS or SHOW to see when single user mode has been exited.

# 恢复正常
Shell (192.168.100.10)> ndb_mgm -e show
Connected to management server at localhost port 1186 (using cleartext)
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=2    @192.168.100.12  (mysql-8.4.8 ndb-8.4.8, Nodegroup: 0, *)
id=3    @192.168.100.14  (mysql-8.4.8 ndb-8.4.8, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.100.10  (mysql-8.4.8 ndb-8.4.8)

[mysqld(API)]   1 node(s)
id=4    @192.168.100.16  (mysql-8.4.8 ndb-8.4.8)
Avatar photo

关于 陸風睿

GNU/Linux 从业者、开源爱好者、技术钻研者,撰写文档既是兴趣也是工作内容之一。Q - "281957576";WeChat - "jiulongxiaotianci",Github - https://github.com/jimcat8
用一杯咖啡支持我们,我们的每一篇[文档]都经过实际操作和精心打磨,而不是简单地从网上复制粘贴。期间投入了大量心血,只为能够真正帮助到您。
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇