In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
What is the function of the Lock-Tables parameter in MySQLump? aiming at this question, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Mysqldump has a parameter, lock-tables, which has not been thoroughly understood before, until the last time a netizen asked, "does the parameter lock-tables lock all the tables in the current library or the current export table at one time?". He always thought that he was just locking the current export table. After reading the parameter description later, he thought that it was just locking the current export table.
-l,-- lock-tables Lock all tables for read. (Defaults to on; use-skip-lock-tables to disable.)
I'm not sure myself, so I tested it at that time. Prepare a slightly larger library, if the database is too small, then the mysqldum command may export all the libraries at once, it is difficult to see the experimental results clearly.
Execute the following command to make a logical backup
[root@DB-Server] # mysqldump-u root-p-default-character-set=utf8-- opt-- extended-insert=false-- lock-tables MyDB > db_backup_MyDB.sql Enter password:
Execute the following command immediately at the same time
Mysql > show open tables where in_use > 0 +-+ | Database | Table | In_use | Name_locked | +-+- -+ | MyDB | AO_60DB71_VERSION | 1 | 0 | | MyDB | AO_AEFED0_TEAM_TO_MEMBER | 1 | 0 | | MyDB | AO_4B00E6_STASH_SETTINGS | 1 | 0 | | MyDB | AO_2D3BEA_FOLIOCF | 1 | 0 | MyDB | AO_AEFED0_TEAM_ROLE | 1 | 0 | MyDB | AO_60DB71_DETAILVIEWFIELD | 1 | 0 | MyDB | AO_60DB71_LEXORANK | 1 | 0 | MyDB | AO _ 6714C7_REPORT_SCHEDULE | 1 | 0 | MyDB | AO_E8B6CC_SYNC_AUDIT_LOG | 1 | 0 | MyDB | cwd_application | 1 | 0 | MyDB | clusternode | 1 | 0 | MyDB | AO_86ED1B_GRACE_PERIOD | 1 | 0 | | MyDB | AO_60DB71_WORKINGDAYS | 1 | 0 | | MyDB | cwd_directory | 1 | 0 | | MyDB | AO_2D3BEA_BASELINE | 1 | 0 | | MyDB | fieldlayoutitem | 1 | 0 | | MyDB | | JQUARTZ_BLOB_TRIGGERS | 1 | 0 | MyDB | AO_013613_HD_SCHEME_MEMBER | 1 | 0 | | MyDB | AO_2D3BEA_ALLOCATION | 1 | 0 | MyDB | AO_013613_WL_SCHEME | 1 | 0 | | MyDB | AO_7DEABF_EXEC_CLUSTER | _ MESSAGE | 1 | 0 |....
As shown in the screenshot above, when you execute the mysqldump command, use the show open tables where in_use > 0 command, and you will see that all the tables in the MyDB have an In_use value of 1, which means that when the mysqldump command is executed, all the tables in the current library are locked at once. Instead of locking the current export table.
In_use description
The number of table locks or lock requests there are for the table. For example, if one client acquires a lock for a table using LOCK TABLE t1 WRITE, In_use will be 1. If another client issues LOCK TABLE t1 WRITE while the table remains locked, the client will block waiting for the lock, but the lock request causes In_use to be 2. If the count is zero, the table is open but not currently being used. In_use is also increased by the HANDLER... OPEN statement and decreased by HANDLER... CLOSE.
The answer to the question about the role of Lock-Tables parameters in MySQLump is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.