MySQL 8.0 OCP 1Z0-908 题目解析(38)
题目151
Choose the best answer.
Four nodes are configured to use circular replication.
Examine these configuration parameters for each node:
slave_parallel_type=DATABASE
slave_parallel_workers=4
slave_preserve_commit_order=0
Which statement is true?
○ A) Each slave thread is responsible for updating a specific database.
○ B) Cross-database constraints can cause database inconsistency.
○ C) Setting slave_parallel_type=DATABASE
won’t work for circular replication; it should be set to LOGICAL_CLOCK
.
○ D) Increasing slave_parallel_workers
will improve high availability.
○ E) Setting slave_preserve_commit_order
to ON
will improve data consistency.
○ F) Setting transaction_allow_batching
to ON
will improve data consistency.
翻译
选择最佳答案。
四个节点配置为使用环形复制。
查看每个节点的以下配置参数:
slave_parallel_type=DATABASE
slave_parallel_workers=4
slave_preserve_commit_order=0
哪个陈述是正确的?
○ A) 每个从线程负责更新一个特定的数据库。
○ B) 跨数据库约束可能导致数据库不一致。
○ C) 设置 slave_parallel_type=DATABASE
不适用于环形复制,应设置为 LOGICAL_CLOCK
。
○ D) 增加 slave_parallel_workers
将提高高可用性。
○ E) 将 slave_preserve_commit_order
设置为 ON
将提高数据一致性。
○ F) 将 transaction_allow_batching
设置为 ON
将提高数据一致性。
解析和答案
- 选项A:
slave_parallel_type=DATABASE
表示从库并行复制时按数据库分配工作线程,但不是每个从线程负责一个特定数据库,而是多个线程可以处理不同数据库的事务,A错误。 - 选项B:在环形复制中,当使用
slave_parallel_type=DATABASE
进行并行复制时,不同数据库的事务可能并行执行,而跨数据库的约束可能无法得到有效保证,从而导致数据库不一致,B正确。 - 选项C:
slave_parallel_type=DATABASE
可以用于环形复制,只是在某些场景下可能存在问题,并非完全不适用于环形复制,C错误。 - 选项D:增加
slave_parallel_workers
主要是提高从库的复制性能,而不是直接提高高可用性,D错误。 - 选项E:
slave_preserve_commit_order=0
表示不保持提交顺序,设置为ON
(即1)才会保持提交顺序,从而提高数据一致性,但当前参数是0,E错误。 - 选项F:
transaction_allow_batching
主要用于控制事务批处理,与数据一致性没有直接关系,F错误。
综上,正确答案是 B。
知识点总结
- MySQL 并行复制:了解
slave_parallel_type
、slave_parallel_workers
和slave_preserve_commit_order
等参数的作用,以及它们在环形复制中的影响。 - 数据一致性问题:认识到在并行复制环境中,特别是使用按数据库并行的方式时,跨数据库约束可能导致的数据不一致风险。
- 参数配置影响:掌握各个复制相关参数对复制性能和数据一致性的影响,以便根据实际需求进行合理配置。
题目152
Choose the best answer.
Max_used_connections = 94
Open_files = 5000
Opened_files = 5000
Open_table_definitions = 3000
Open_tables = 1024
Opened_table_definitions = 2869
Opened_tables = 3500000
Table_definition_cache = 3582
Threads_running = 58
Uptime = 100000GLOBAL STATUS 2:
Com_create_table = 500505
Com_drop_table = 500498
Com_flush = 31
Created_tmp_disk_tables = 400400
Created_tmp_tables = 1201200
Handler_read_rnd = 92
Open_files = 5000
Opened_files = 7505
Open_table_definitions = 3000
Open_tables = 1024
Opened_table_definitions = 2873
Opened_tables = 3503500
Threads_connected = 67
Threads_running = 64
Uptime = 100100
Your MySQL system normally supports 50-75 concurrent connections.
Which configuration change will improve performance?
○ A) increase max_connections
○ B) decrease open_files_limit
○ C) decrease table_definition_cache
○ D) increase table_open_cache
翻译
选择最佳答案。
Max_used_connections = 94
Open_files = 5000
Opened_files = 5000
Open_table_definitions = 3000
Open_tables = 1024
Opened_table_definitions = 2869
Opened_tables = 3500000
Table_definition_cache = 3582
Threads_running = 58
Uptime = 100000GLOBAL STATUS 2:
Com_create_table = 500505
Com_drop_table = 500498
Com_flush = 31
Created_tmp_disk_tables = 400400
Created_tmp_tables = 1201200
Handler_read_rnd = 92
Open_files = 5000
Opened_files = 7505
Open_table_definitions = 3000
Open_tables = 1024
Opened_table_definitions = 2873
Opened_tables = 3503500
Threads_connected = 67
Threads_running = 64
Uptime = 100100
你的 MySQL 系统通常支持 50-75 个并发连接。
哪个配置更改将提高性能?
○ A) 增加 max_connections
○ B) 减少 open_files_limit
○ C) 减少 table_definition_cache
○ D) 增加 table_open_cache
解析和答案
- 选项A:
Max_used_connections
为 94,而系统通常支持 50-75 个并发连接,说明当前max_connections
可能足够,增加它不一定能提高性能,A错误。 - 选项B:
Open_files
已经达到 5000,减少open_files_limit
可能会导致文件打开失败,影响性能,B错误。 - 选项C:
Opened_table_definitions
数值较大,说明table_definition_cache
可能不足,减少它会使情况更糟,C错误。 - 选项D:
Opened_tables
数值非常大,而Open_tables
为 1024,说明table_open_cache
可能太小,导致频繁打开表,增加table_open_cache
可以缓存更多的表,减少表打开操作,从而提高性能,D正确。
综上,正确答案是 D。
知识点总结
- MySQL 连接与表缓存:了解
max_connections
、open_files_limit
、table_definition_cache
和table_open_cache
等参数的作用和影响。 - 性能分析:通过查看系统状态变量(如
Max_used_connections
、Opened_tables
、Open_tables
等)来分析性能瓶颈,确定需要调整的配置参数。 - 表缓存优化:掌握
table_open_cache
参数对表打开操作的影响,以及如何通过调整该参数来提高性能。
题目153
Choose the best answer.
Examine this snippet from the binary log file named binlog.000036
:
# at 500324
#191120 14:55:16 server id 1 end_log_pos 500453 CRC32 0x98159515 Query thread_id=9 exec_time=2 error_code=0 Xid = 1106
SET TIMESTAMP=1574222116/*!*/;
DROP TABLE `rental` /* generated by server */
/*!*/;
The rental
table was accidentally dropped, and you must recover the table.
You have restored the last backup, which corresponds to the start of the binlog.000036
binary log.
Which command will complete the recovery?
○ A) mysqlbinlog --stop-position=500324 binlog.000036 | mysql
○ B) mysqlbinlog --stop-datetime='2019-11-20 14:55:16' binlog.000036 | mysql
○ C) mysqlbinlog --stop-datetime='2019-11-20 14:55:18' binlog.000036 | mysql
○ D) mysqlbinlog --stop-position=500453 binlog.000036 | mysql
翻译
选择最佳答案。
查看名为 binlog.000036
的二进制日志文件片段:
# at 500324
#191120 14:55:16 server id 1 end_log_pos 500453 CRC32 0x98159515 Query thread_id=9 exec_time=2 error_code=0 Xid = 1106
SET TIMESTAMP=1574222116/*!*/;
DROP TABLE `rental` /* generated by server */
/*!*/;
rental
表被意外删除,你需要恢复该表。
你已恢复了最后一次备份,该备份对应 binlog.000036
二进制日志的起始位置。
哪个命令将完成恢复?
○ A) mysqlbinlog --stop-position=500324 binlog.000036 | mysql
○ B) mysqlbinlog --stop-datetime='2019-11-20 14:55:16' binlog.000036 | mysql
○ C) mysqlbinlog --stop-datetime='2019-11-20 14:55:18' binlog.000036 | mysql
○ D) mysqlbinlog --stop-position=500453 binlog.000036 | mysql
解析和答案
- 选项A:
--stop-position=500324
表示在二进制日志中位置500324
处停止恢复,这个位置在DROP TABLE
语句之前,能够避免恢复DROP TABLE
操作,从而恢复rental
表,A正确。 - 选项B:
--stop-datetime='2019-11-20 14:55:16'
是基于时间点停止恢复,这个时间点可能不准确,因为二进制日志中的时间戳可能与实际操作时间有细微差别,并且可能会包含DROP TABLE
操作,B错误。 - 选项C:
--stop-datetime='2019-11-20 14:55:18'
同样是基于时间点停止恢复,时间不准确且可能包含DROP TABLE
操作,C错误。 - 选项D:
--stop-position=500453
会恢复到DROP TABLE
语句执行之后的位置,无法恢复rental
表,D错误。
综上,正确答案是 A。
知识点总结
- 二进制日志恢复:掌握使用
mysqlbinlog
工具从二进制日志中恢复数据的方法,包括基于位置(--stop-position
)和基于时间(--stop-datetime
)的恢复方式。 - 关键操作识别:能够在二进制日志中识别关键操作(如
DROP TABLE
)的位置和时间戳,以便在恢复时避免这些操作。 - 备份与恢复策略:理解备份与二进制日志结合进行数据恢复的原理,即在恢复最后一次备份后,通过二进制日志恢复备份之后的操作,但要排除误操作。
题目154
Choose two.
Which two statements are true about the mysqld-auto.cnf file?
□ A) It is always updated with changes to system variables.
□ B) This file is for logging purposes only and is never processed.
□ C) It is read and processed at the end of startup configuration.
□ D) This file is for storing MySQL Server configuration options in JSON format.
□ E) It is read and processed at the beginning of startup configuration.
□ F) This file is for storing MySQL server_uuid values only.
翻译
选择两个答案。
关于 mysqld-auto.cnf 文件,哪两个陈述是正确的?
□ A) 它总是随着系统变量的更改而更新。
□ B) 此文件仅用于日志记录,从不被处理。
□ C) 它在启动配置结束时被读取和处理。
□ D) 此文件用于以 JSON 格式存储 MySQL 服务器配置选项。
□ E) 它在启动配置开始时被读取和处理。
□ F) 此文件仅用于存储 MySQL server_uuid 值。
解析和答案
- 选项A:
mysqld-auto.cnf
文件并非总是随着系统变量的更改而更新,只有部分系统变量的更改会触发其更新,A错误。 - 选项B:该文件不仅用于日志记录,还会在服务器启动时被处理,B错误。
- 选项C:
mysqld-auto.cnf
文件在服务器启动配置的最后阶段被读取和处理,C正确。 - 选项D:
mysqld-auto.cnf
文件以 JSON 格式存储 MySQL 服务器的配置选项,D正确。 - 选项E:它不是在启动配置开始时被处理,而是在最后阶段,E错误。
- 选项F:该文件不仅存储
server_uuid
,还存储其他配置选项,F错误。
所以答案是CD。
知识点总结
- mysqld-auto.cnf 文件作用:
mysqld-auto.cnf
文件用于存储 MySQL 服务器的配置选项,这些选项以 JSON 格式保存,通常是在服务器运行过程中动态调整的系统变量。 - 启动处理顺序:在 MySQL 服务器启动时,
mysqld-auto.cnf
文件在所有其他配置文件(如my.cnf
)处理完毕后被读取和处理,确保其中的配置选项能够覆盖之前的设置。 - 动态配置存储:该文件主要用于存储动态调整的系统变量,例如通过
SET GLOBAL
命令修改的变量,这些变量的更改会被持久化到mysqld-auto.cnf
文件中,以便在服务器重启后仍然有效。
题目155
Choose two.
All MySQL Server instances belonging to InnoDB Cluster have SSL configured and enabled.
You must configure InnoDB Cluster to use SSL for group communication.
Which two statements are true?
□ A) An existing InnoDB Cluster must be dissolved and created from scratch to enable SSL for group communication.
□ B) If only some InnoDB Cluster members are enabled for SSL group communication, and --ssl-mode=PREFERRED, communication will fall back to unencrypted connection.
□ C) SSL group communication must be enabled at cluster creation time by specifying createCluster({memberSslMode:‘REQUIRED’}).
□ D) SSL group communication can be enabled for an existing cluster, one instance at time, by setting group_replication_ssl_mode.
□ E) SSL group communication requires the use of an additional set of parameters group_replication_recovery_*.
□ F) Configuring SSL group communication also configures SSL distributed recovery.
翻译
选择两个答案。
属于 InnoDB Cluster 的所有 MySQL 服务器实例都已配置并启用了 SSL。
你必须将 InnoDB Cluster 配置为使用 SSL 进行组通信。
哪两个陈述是正确的?
□ A) 必须解散现有的 InnoDB Cluster 并从头创建才能为组通信启用 SSL。
□ B) 如果只有部分 InnoDB Cluster 成员启用了 SSL 组通信,并且 --ssl-mode=PREFERRED,通信将回退到未加密连接。
□ C) 必须在集群创建时通过指定 createCluster({memberSslMode:‘REQUIRED’}) 来启用 SSL 组通信。
□ D) 可以通过设置 group_replication_ssl_mode 为现有集群逐个实例启用 SSL 组通信。
□ E) SSL 组通信需要使用一组额外的参数 group_replication_recovery_*。
□ F) 配置 SSL 组通信也会配置 SSL 分布式恢复。
解析和答案
- 选项A:不需要解散现有集群并重新创建,A错误。
- 选项B:当
--ssl-mode=REQUIRED
时,若部分成员未启用 SSL 才会导致问题,而不是PREFERRED
,B错误。 - 选项C:在创建集群时可以通过
createCluster({memberSslMode:'REQUIRED'})
来启用 SSL 组通信,C正确。 - 选项D:不能逐个实例设置来启用 SSL 组通信,D错误。
- 选项E:SSL 组通信确实需要使用
group_replication_recovery_*
相关参数,E正确。 - 选项F:配置 SSL 组通信不会自动配置 SSL 分布式恢复,F错误。
所以答案是CE。
知识点总结
- InnoDB Cluster SSL配置:了解在 InnoDB Cluster 中配置 SSL 进行组通信的相关知识,包括配置的时机和所需参数等。
- 集群创建与SSL:知道可以在创建 InnoDB Cluster 时通过指定
memberSslMode:'REQUIRED'
来启用 SSL 组通信。 - 参数作用:清楚
group_replication_recovery_*
等参数在 SSL 组通信中的作用,它们是启用 SSL 组通信所需要的额外参数。 - SSL模式影响:明白不同的
--ssl-mode
(如REQUIRED
、PREFERRED
)对集群成员通信的影响,确保正确配置以满足安全需求。 - 现有集群配置:了解对于现有集群,不能简单地逐个实例设置来启用 SSL 组通信,需要遵循正确的配置流程。
- 分布式恢复与SSL:知道配置 SSL 组通信和 SSL 分布式恢复是不同的配置项,配置 SSL 组通信不会自动配置 SSL 分布式恢复。