题目025
Choose the best answer.
Examine this partial report:
mysql> SHOW FULL PROCESSLIST;
+----+----------------+-----------+...
| Id | User | Host |...
+----+----------------+-----------+...
| 4 | event_scheduler| localhost |...
| 9 | root | localhost:51502 |...
| 10 | root | localhost:51670 |...
Examine this query:
SELECT SUM(m.CURRENT_NUMBER_OF_BYTES_USED)AS TOTAL
FROM performance_schema.memory_summary_by_thread_by_event_name m
INNER JOIN performance_schema.threads t
ON m.THREAD_ID = t.THREAD_ID
WHERE t.PROCESSLIST_ID = 10;
What information does this query provide?
○ A) total memory used by connection number 10
○ B) total memory used across all connections associated with the user on connection number 10
○ C) total memory used by the first 10 threads
○ D) total memory used by thread number 10
○ E) total memory used across all connections associated with the user on thread number 10
○ F) total memory used by the first 10 connections
翻译
选择最佳答案。
查看这份部分报告:
mysql> SHOW FULL PROCESSLIST;
+----+----------------+-----------+...
| Id | User | Host |...
+----+----------------+-----------+...
| 4 | event_scheduler| localhost |...
| 9 | root | localhost:51502 |...
| 10 | root | localhost:51670 |...
查看这条查询:
SELECT SUM(m.CURRENT_NUMBER_OF_BYTES_USED)AS TOTAL
FROM performance_schema.memory_summary_by_thread_by_event_name m
INNER JOIN performance_schema.threads t
ON m.THREAD_ID = t.THREAD_ID
WHERE t.PROCESSLIST_ID = 10;
这条查询提供了什么信息?
○ A) 连接编号为10的连接所使用的总内存
○ B) 与连接编号为10的连接上的用户相关的所有连接所使用的总内存
○ C) 前10个线程所使用的总内存
○ D) 线程编号为10的线程所使用的总内存
○ E) 与线程编号为10的线程上的用户相关的所有连接所使用的总内存
○ F) 前10个连接所使用的总内存
解析和答案
- 选项A:查询通过
WHERE t.PROCESSLIST_ID = 10
条件,将范围限定在PROCESSLIST_ID
为10的连接相关线程上,计算的是连接编号为10的连接所使用的总内存 ,A正确。 - 选项B:查询未涉及与连接编号10上用户相关的所有连接,仅针对
PROCESSLIST_ID
为10的连接 ,B错误。 - 选项C:不是计算前10个线程的总内存,而是特定
PROCESSLIST_ID
为10的连接相关内存 ,C错误。 - 选项D:不是针对线程编号10,而是
PROCESSLIST_ID
为10的连接 ,D错误。 - 选项E:没有涉及与线程编号10上用户相关的所有连接,E错误。
- 选项F:不是计算前10个连接的总内存 ,F错误。
所以答案是A。
知识点总结
- MySQL性能模式:了解
performance_schema
中memory_summary_by_thread_by_event_name
和threads
等表的结构和作用,掌握通过这些表查询内存使用等性能相关信息的方法。 SHOW PROCESSLIST
与性能分析:明白SHOW FULL PROCESSLIST
输出信息与性能模式表查询的关联,能够根据需求利用这些工具和信息进行数据库性能分析。
题目026
Choose the best answer
An attempt to recover an InnoDB Cluster fails.
Examine this set of messages and responses:
host3:3377 ssl JS > dba.rebootClusterFromCompleteOutage()
Reconfiguring the default cluster from complete outage...
The instance 'host1:3377' was part of the cluster configuration.
Would you like to rejoin it to the cluster? [y/N]: y
The instance 'host2:3377' was part of the cluster configuration.
Would you like to rejoin it to the cluster? [y/N]: y
Dba.rebootClusterFromCompleteOutage: The active session instance isn't the most updated in comparison with the ONLINE instances of the Cluster's metadata.
Please use the most up to date instance: 'host1:3377'. (RuntimeError)
Which statement is true?
○ A) The cluster is running and there is at least one ONLINE instance.
○ B) The instance deployed on host3 must be synchronized from a donor deployed on host1 by using the command cluster.addInstance(‘host1:3377’).
○ C) It is possible to determine the most up-to-date instance by comparing different global transaction identifier (GTID) sets with GTID_SUBSET(set1,set2).
○ D) The active session instancecis invalid and must be re-created by using the command shell.connect(‘host3:3377’).
○ E) The instance deployed on host3 must be rebuilt with a backup from the primary instance.
翻译
选择最佳答案
一次InnoDB集群恢复尝试失败。
查看这组消息和响应:
host3:3377 ssl JS > dba.rebootClusterFromCompleteOutage()
Reconfiguring the default cluster from complete outage...
The instance 'host1:3377' was part of the cluster configuration.
Would you like to rejoin it to the cluster? [y/N]: y
The instance 'host2:3377' was part of the cluster configuration.
Would you like to rejoin it to the cluster? [y/N]: y
Dba.rebootClusterFromCompleteOutage: The active session instance isn't the most updated in comparison with the ONLINE instances of the Cluster's metadata.
Please use the most up to date instance: 'host1:3377'. (RuntimeError)
以下哪项陈述是正确的?
○ A) 集群正在运行,并且至少有一个ONLINE实例。
○ B) 部署在host3上的实例必须通过使用命令cluster.addInstance(‘host1:3377’)从部署在host1上的捐赠者进行同步。
○ C) 可以通过使用GTID_SUBSET(set1,set2)比较不同的全局事务标识符(GTID)集来确定最新的实例。
○ D) 活动会话实例无效,必须使用命令shell.connect(‘host3:3377’)重新创建。
○ E) 部署在host3上的实例必须使用主实例的备份进行重建。
解析和答案
- 选项A:从恢复失败提示可知,集群并非处于正常运行状态,不存在至少一个ONLINE实例能使恢复顺利进行 ,A错误。
- 选项B:
cluster.addInstance()
主要用于添加新实例到集群,不是用于在恢复失败场景下使host3实例从host1同步 ,B错误。 - 选项C:在InnoDB集群中,可通过
GTID_SUBSET(set1,set2)
比较不同实例的GTID集,来确定哪个实例是最新的,这符合恢复时确定最新实例的原理 ,C正确。 - 选项D:错误提示是活动会话实例不是最新的,而非实例无效需重新创建 ,D错误。
- 选项E:题干未提及必须使用主实例备份重建host3实例,恢复失败提示重点在实例版本更新问题 ,E错误。
所以答案是C。
知识点总结
- InnoDB集群恢复:了解InnoDB集群恢复过程中可能遇到的问题,如实例版本不一致导致恢复失败等情况。
- GTID原理与应用:掌握全局事务标识符(GTID)在InnoDB集群中的作用,以及通过
GTID_SUBSET
等函数比较实例状态、确定最新实例的方法。
题目027
Choose three.
You must run multiple instances of MySQL Server on a single host.
Which three methods are supported?
□ A) Use system tools to lock each instance to its own CPU.
□ B) Use resource groups to lock different instances on separate CPUs.
□ C) Run mysqld with --datadir defined for each instance.
□ D) Run MySQL Server docker containers.
□ E) Start mysqld or mysqld_safe using different option files for each instance.
□ F) Use systemd with different settings for each instance.
翻译
选择三项。
你必须在单个主机上运行多个MySQL Server实例。
支持哪三种方法?
□ A) 使用系统工具将每个实例锁定到其自己的CPU。
□ B) 使用资源组将不同实例锁定到不同的CPU。
□ C) 为每个实例运行定义了–datadir的mysqld。
□ D) 运行MySQL Server Docker容器。
□ E) 为每个实例使用不同的选项文件启动mysqld或mysqld_safe。
□ F) 为每个实例使用具有不同设置的systemd。
解析和答案
- 选项A:虽然可以用系统工具分配CPU资源,但直接“锁定”每个实例到自己的CPU并非标准且简单可行的多实例部署方法,实际操作复杂且MySQL官方不推荐此为常规手段 ,A错误。
- 选项B:使用资源组锁定不同实例到不同CPU,不是MySQL多实例部署的常规支持方法,更多是系统资源管理概念,且操作复杂不直接对应多实例运行需求 ,B错误。
- 选项C:仅定义
--datadir
不足以完整支持多实例运行,还需考虑配置文件、端口等多方面差异 ,C错误。 - 选项D:通过运行MySQL Server Docker容器,可以利用容器的隔离特性在单个主机上轻松部署多个相互隔离的MySQL实例,是可行的方法 ,D正确。
- 选项E:为每个实例使用不同的选项文件(.cnf文件)启动
mysqld
或mysqld_safe
,可以分别配置每个实例的参数(如端口、数据目录等),实现多实例运行 ,E正确。 - 选项F:使用
systemd
并为每个实例设置不同的配置,可以管理每个MySQL实例的启动、停止等服务,是支持多实例运行的方法 ,F正确。
所以答案是D、E、F。
知识点总结
- MySQL多实例部署:掌握在单个主机上部署多个MySQL实例的常用方法,包括利用容器技术(如Docker)、配置不同选项文件以及借助系统服务管理工具(如systemd)等。
- 资源管理与配置:理解在多实例部署中,资源分配(如CPU、内存等)和参数配置(如端口、数据目录、配置文件等)的重要性,以及如何通过不同方法实现合理的资源管理和配置。
题目028
Choose three.
Which three settings control global buffers shared by all threads on a MySQL server?
□ A) tmp_table_size
□ B) innodb_buffer_pool_size
□ C) table_open_cache
□ D) sort_buffer_size
□ E) key_buffer_size
□ F) read_buffer_size
翻译
选择三项。
哪三个设置控制MySQL服务器上所有线程共享的全局缓冲区?
□ A) tmp_table_size
□ B) innodb_buffer_pool_size
□ C) table_open_cache
□ D) sort_buffer_size
□ E) key_buffer_size
□ F) read_buffer_size
解析和答案
- 选项A:
tmp_table_size
用于设置临时表的最大大小,它不是所有线程共享的全局缓冲区设置 ,A错误。 - 选项B:
innodb_buffer_pool_size
定义了InnoDB存储引擎的缓冲池大小,缓冲池用于缓存InnoDB表的数据和索引,是所有线程共享的重要全局缓冲区 ,B正确。 - 选项C:
table_open_cache
控制着MySQL能够同时打开的表的缓存数量,是所有线程共享的全局设置,影响表的打开和缓存管理 ,C正确。 - 选项D:
sort_buffer_size
是每个线程用于排序操作的缓冲区大小,是线程私有的,并非全局共享缓冲区设置 ,D错误。 - 选项E:
key_buffer_size
用于MyISAM存储引擎,控制索引块的缓存大小,是所有线程共享的全局缓冲区设置 ,E正确。 - 选项F:
read_buffer_size
是每个线程用于顺序读取的缓冲区大小,是线程私有的,不是全局共享缓冲区设置 ,F错误。
所以答案是B、C、E。
知识点总结
- MySQL缓冲区设置:了解MySQL中不同缓冲区设置(如
innodb_buffer_pool_size
、table_open_cache
、key_buffer_size
等)的功能和作用范围,区分哪些是全局共享缓冲区设置,哪些是线程私有的设置。 - 存储引擎相关设置:掌握不同存储引擎(如InnoDB、MyISAM)对应的缓冲区设置,以及这些设置对数据库性能的影响,能够根据需求合理调整相关参数。