Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view the creation time of a binlog file in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to view the creation time of binlog files in Linux, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

1. Use the stat command

Stat mysql-bin.016126

File: 'mysql-bin.016126'

Size: 262146609 Blocks: 512016 IO Block: 4096 regular file

Device: fd02h/64770d Inode: 135529302 Links: 1

Access: (0640 Compact Murray r -) Uid: (5701/actiontech-mysql) Gid: (5701/actiontech-mysql)

Access: 2019-04-28 1414 41purl 42.967043003 + 0800

Modify: 2019-04-26 1615 2415 21.823932020 + 0800

Change: 2019-04-26 1615 2415 21.823932020 + 0800

1. Access time, read the contents of this file once, and this time will be updated. For example, use more, cat and other commands on this file. Neither ls nor stat commands modify the access time of the file.

2. Modification time. Modification time is the last time the content of the file was modified. For example: save the file after vi. This is the time listed in ls-l.

3. State change time. Is the time when the I node of the file was last modified. Modify the file attribute once through the chmod and chown commands, and this time will be updated.

If the file has not been modified after creation, the modification time is the creation time; if the state has not changed after the creation of the file, then the state change time is the creation time; if the file has not been read after the file creation, then access time = creation time. For used files, these are basically unlikely.

2. Use debugfs

Get the root file directory where the binlog file is stored

Grep 'datas' / etc/fstab/dev/mapper/centos-datas / datas ext4 defaults 1 2

Get the binlog file inode number

Ls-I mysql-bin.016127135529232 mysql-bin.016127

Get the file creation time

Debugfs-R 'stat' / dev/mapper/centos-datas

Debugfs 1.42.9 (28-Dec-2013)

Inode: 135529232 Type: regular Mode: 0640 Flags: 0x80000

Generation: 2396969921 Version: 0x00000000:00000001

User: 5701 Group: 5701 Size: 262147164

File ACL: 0 Directory ACL: 0

Links: 1 Blockcount: 512016

Fragment: Address: 0 Number: 0 Size: 0

Ctime: 0x5cc2c082:47dcd9bc-- Fri Apr 26 16:25:38 2019

Atime: 0x5cc55c49:2929fd18-- Sun Apr 28 15:54:49 2019

Mtime: 0x5cc2c082:47dcd9bc-- Fri Apr 26 16:25:38 2019

Crtime: 0x5cc2c035:c470d1d0-- Fri Apr 26 16:24:21 2019

Size of extra inode fields: 28

EXTENTS:

Crtime is the time when the file was created

The difference between the last modification time of crtime and mtime files is 1 minute and 17 seconds.

It takes more than 1 minute for MySQL to finish writing a binlog file.

Be careful

The xfs file system does not support using debugfs to view the creation time of files

Grep root / etc/fstab / dev/mapper/centos-root / xfs defaults 1 1ls-I / test1 357556 / test1debugfs-R 'stat' / dev/mapper/centos-root debugfs 1.42.9 (28-Dec-2013) / dev/mapper/centos-root: Bad magic number in super-block while opening filesystem stat: Filesystem not open

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

On how to view the creation time of the binlog file in Linux to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report