国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

mysql關于redo事務日志ib_logfile的了解

2024-07-24 12:32:17
字體:
來源:轉載
供稿:網(wǎng)友
         mysql關于redo事務日志ib_logfile的理解:

1、redo事務日志就是ib_logfile,兩個ib_logfile開頭的文件,它們就是log group中的redo log file,而且它們的大小完全一致且等于變量innodb_log_file_size定義的值
 
2、redo事務日志的作用就是用于crash recovery,crash recovery是數(shù)據(jù)庫重啟時自動的行為,無需為DBA執(zhí)行任何額外工作
 
3、MySQL以循環(huán)方式寫入重做日志文件,如果最后1個 ib_logfile 被寫滿,而第一個ib_logfile中所有記錄的事務對數(shù)據(jù)的變更已經(jīng)被持久化到磁盤中,將清空并重用之。
 
4、redo事務日志的概念類似oracle的online redo log,里面包含commit和uncommit的數(shù)據(jù)
 
5、寫redo事務日志有幾種方式,每隔1秒或每次事務提交,所以里面可以包含沒有提交uncommit的數(shù)據(jù)
 
6、show engine innodb status可以看到redo log的信息
 
       Log sequence number:表明當前redo log的最新LSN。
 
       Log flushed up to:表明當前已經(jīng)刷新到磁盤上redo log的LSN。
 
      Last checkpoint at :redo log記錄的更新已經(jīng)刷新到磁盤上的檢查點LSN,該LSN之前的redo log上記錄的更新已全部刷新到磁盤上,可以被覆蓋重復使用。
 
7、查看ib_logfile里的內容的方法
 
[root@mydb ~]# strings /var/lib/mysql/ib_logfile0
 
相關參數(shù)
 
innodb_log_file_size :每個redo log文件大小
 
innodb_log_files_in_group :redo log日志組成員個數(shù)
 
innodb_log_group_home_dir :redo log存放目錄
 
innodb_page_size :InnoDB表空間的頁面大小,默認16K
 
innodb_flush_log_at_timeout :日志刷新頻率,單位秒
 
Write and flush the logs every N seconds. innodb_flush_log_at_timeout allows the timeout period between flushes to be increased in order to reduce flushing and avoid impacting performance of binary log group commit. The default setting for innodb_flush_log_at_timeout is once per second.
 
每N秒寫入并刷新日志。 innodb_flush_log_at_timeout允許增加刷新之間的超時時間,以減少刷新并避免影響二進制日志組提交的性能。 innodb_flush_log_at_timeout的默認設置是每秒一次。
 
innodb_flush_log_at_trx_commit :控制commit動作是否刷新log buffer到磁盤
 
With a setting of 2, logs are written after each transaction commit and flushed to disk once per second
 
控制提交操作的嚴格ACID合規(guī)性與重新安排和批量完成與 提交 相關的I / O操作時可能實現(xiàn)的更高性能之間的平衡。
 
innodb_flush_log_at_timeout很多人誤以為是控制innodb_flush_log_at_trx_commit值為0和2時的1秒頻率,實際上并非如此。
 
以下四種方式將innodb日志緩沖區(qū)的日志刷新到磁盤
 
1、每秒一次執(zhí)行刷新Innodb_log_buffer到重做日志文件。即使某個事務還沒有提交,Innodb存儲引擎仍然每秒會將重做日志緩存刷新到重做日志文件。
 
2、每個事務提交時會將重做日志刷新到重做日志文件。
 
3、當重做日志緩存可用空間少于一半時,重做日志緩存被刷新到重做日志文件
 
4、當有checkpoint時,checkpoint在一定程度上代表了刷到磁盤時日志所處的LSN位置
 
https://dev.mysql.com/doc/refman/5.7/en/innodb-redo-log.html
 
The redo log is a disk-based data structure used during crash recovery to correct data written by incomplete transactions.
 
重做日志是在崩潰恢復期間用于糾正由未完成事務寫入的數(shù)據(jù)的基于磁盤的數(shù)據(jù)結構。
 
By default, the redo log is physically represented on disk as a set of files, named ib_logfile0 and ib_logfile1. MySQL writes to the redo log files in a circular fashion.
 
默認情況下,重做日志在磁盤上物理表示為一組文件,名為ib_logfile0和ib_logfile1。 MySQL以循環(huán)方式寫入重做日志文件。
 
A disk-based data structure used during crash recovery, to correct data written by incomplete transactions. During normal operation, it encodes requests to change InnoDB table data, which result from SQL statements or low-level API calls through NoSQL interfaces. Modifications that did not finish updating the data files before an unexpected shutdown are replayed automatically.
 
The redo log is physically represented as a set of files, typically named ib_logfile0 and ib_logfile1. The data in the redo log is encoded in terms of records affected; this data is collectively referred to as redo. The passage of data through the redo logs is represented by the ever-increasing LSN value. The original 4GB limit on maximum size for the redo log is raised to 512GB in MySQL 5.6.3.
 
在崩潰恢復期間使用的基于磁盤的數(shù)據(jù)結構,用于糾正由未完成的事務寫入的數(shù)據(jù)。 在正常操作期間,它編碼更改InnoDB表數(shù)據(jù)的請求,這些數(shù)據(jù)來自SQL語句或通過NoSQL接口的低級API調用。 在意外關閉之前未完成更新數(shù)據(jù)文件的修改會自動重播。
 
重做日志在物理上表示為一組文件,通常名為ib_logfile0和ib_logfile1。 重做日志中的數(shù)據(jù)根據(jù)受影響的記錄進行編碼; 這些數(shù)據(jù)統(tǒng)稱為重做。 數(shù)據(jù)通過重做日志的傳遞由不斷增加的LSN值表示。 在MySQL 5.6.3中,重做日志的最大大小的原始4GB限制被提升到512GB。

(編輯:武林網(wǎng))

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 镇雄县| 汕尾市| 娄烦县| 乌什县| 广东省| 常宁市| 康马县| 噶尔县| 治多县| 奉贤区| 黔南| 行唐县| 蒙城县| 汾西县| 措勤县| 若羌县| 黔江区| 江口县| 循化| 营口市| 项城市| 平遥县| 达孜县| 潜江市| 阿城市| 时尚| 建昌县| 宁乡县| 平阳县| 搜索| 方正县| 张家港市| 陇南市| 阳谷县| 随州市| 垣曲县| 台东市| 天全县| 勐海县| 灵山县| 贞丰县|