国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

MySQL 8.0 Reference Manual(讀書筆記90節(jié)--Replication)

這篇具有很好參考價(jià)值的文章主要介紹了MySQL 8.0 Reference Manual(讀書筆記90節(jié)--Replication)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

1.

The following options also have an impact on the source:

? For the greatest possible durability and consistency in a replication setup using InnoDB with transactions, you should use?innodb_flush_log_at_trx_commit=1 and sync_binlog=1 in the source's my.cnf file.

? Ensure that the skip_networking system variable is not enabled on the source. If networking has been disabled, the replica cannot communicate with the source and replication fails.

2.The default server_id value is 1.

The default server_id value from MySQL 8.0 is 1.Note that if a value of 0 (which was the default in earlier releases) was set previously for the server ID, you must restart the server to initialize the source with your new nonzero server ID.

Note that a value of 0 for the server ID prevents a replica from connecting to a source. If that server ID value (which was the default in earlier releases) was set previously, you must restart the server to initialize the replica with your new nonzero server ID. Otherwise【??e?rwa?z 否則;另;不然;在其他方面;亦;除此以外;】, a server restart is not needed when you change the server ID, unless you make other configuration changes that require it. For example, if binary logging was disabled on the server and you want it enabled for your replica, a server restart is required to enable this.

3.級(jí)聯(lián)復(fù)制

Binary logging is enabled by default on all servers. A replica is not required to have binary logging enabled for replication to take place. However, binary logging on a replica means that the replica's binary log can be used for data backups and crash recovery. Replicas that have binary logging enabled can also be used as part of a more complex replication topology. For example, you might want to set up replication servers using this chained arrangement:

A -> B -> C

Here, A serves as the source for the replica B, and B serves as the source for the replica C. For this to work, B must be both a source and a replica. Updates received from A must be logged by B to its binary log, in order to be passed on to C. In addition to binary logging, this replication topology requires the system variable log_replica_updates (from MySQL 8.0.26) or log_slave_updates (before MySQL 8.0.26) to be enabled. With replica updates enabled, the replica writes updates that are received from a source and performed by the replica's SQL thread to the replica's own binary log. The log_replica_updates or log_slave_updates system variable is enabled by default.

If you need to disable binary logging or replica update logging on a replica, you can do this by specifying the --skip-log-bin and --log-replica-updates=OFF or --log-slave-updates=OFF options for the replica. If you decide to re-enable these features on the replica, remove the relevant options and restart the server.

4.Creating a Data Snapshot Using mysqldump

By default, if GTIDs are in use on the source (gtid_mode=ON), mysqldump includes the GTIDs from the gtid_executed set on the source in the dump output to add them to the gtid_purged set on the replica. If you are dumping only specific databases or tables, it is important to note that the value that is included by mysqldump includes the GTIDs of all transactions in the gtid_executed set on the source, even those that changed suppressed【s??prest 被抑制的;(病)癥狀不顯明的;被刪去的;】 parts of the database, or other databases on the server that were not included in the partial【?pɑ?r?l 部分的,不完全的;<數(shù)>偏的;偏向一方的,偏袒的,不公平的;偏愛的,癖好的;】 dump. Check the description for mysqldump's --set-gtid-purged option to find the outcome of the default behavior for the MySQL Server versions you are using, and how to change the behavior if this outcome is not suitable for your situation.

/usr/local/mysql/bin/mysqldump --master-data=2 -u用戶 -p密碼 --databases 指定數(shù)據(jù)庫 --set-gtid-purged=off --single-transaction -R --triggers > /指定路徑/tmp_xxxxx.sql

?否則,會(huì)遇到如下錯(cuò)誤

ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.

?5.注意scheduled events

If the replication source server or existing replica that you are copying to create the new replica has any scheduled events, ensure that these are disabled on the new replica before you start it. If an event runs on the new replica that has already run on the source, the duplicated operation causes an error. The Event Scheduler is controlled by the event_scheduler system variable, which defaults to ON from MySQL 8.0, so events that are active on the original server run by default when the new replica starts up. To stop all events from running on the new replica, set the event_scheduler system variable to OFF or DISABLED on the new replica. Alternatively, you can use the ALTER EVENT statement to set individual events to DISABLE or DISABLE ON SLAVE to prevent them from running on the new replica. You can list the events on a server using the SHOW statement or the Information Schema EVENTS table.

6.

GTID assignment distinguishes between client transactions, which are committed on the source, and replicated transactions, which are reproduced on a replica. When a client transaction is committed on the source, it is assigned a new GTID, provided that the transaction was written to the binary log. Client transactions are guaranteed【ɡ?r?n?ti?d 保證;保障;擔(dān)保;確保;使必然發(fā)生;提供(產(chǎn)品)保修單(免費(fèi)掉換或修理有問題的產(chǎn)品);】 to have monotonically【m?n?'t?n?kl??單調(diào)地;單調(diào)地,無變化地;】 increasing GTIDs without gaps between the generated numbers. If a client transaction is not written to the binary log (for example, because the transaction was filtered out, or the transaction was read-only), it is not assigned a GTID on the server of origin.

Replicated transactions retain the same GTID that was assigned to the transaction on the server of origin. The GTID is present before the replicated transaction begins to execute, and is persisted【p?r?s?st?d 持續(xù)存在;保持;維持;頑強(qiáng)地堅(jiān)持;執(zhí)著地做】 even if the replicated transaction is not written to the binary log on the replica, or is filtered out on the replica. The MySQL system table mysql.gtid_executed is used to preserve【pr??z??rv 保存;保護(hù);保留;維護(hù);保鮮;保養(yǎng);貯存;維持…的原狀;使繼續(xù)存活;】 the assigned GTIDs of all the transactions applied on a MySQL server, except those that are stored in a currently active binary log file.

只會(huì)執(zhí)行一次

The auto-skip function for GTIDs means that a transaction committed on the source can be applied no more than once on the replica, which helps to guarantee consistency. Once a transaction with a given GTID has been committed on a given server, any attempt to execute a subsequent【?s?bs?kw?nt 隨后的;之后的;后來的;接后的;】 transaction with the same GTID is ignored by that server. No error is raised, and no statement in the transaction is executed.

7.

If a transaction with a given GTID has started to execute on a server, but has not yet committed or rolled back, any attempt to start a concurrent【k?n?k??r?nt 同時(shí)發(fā)生的;同意的,一致的;<律>有相等權(quán)力的,同時(shí)(實(shí)施)的;合作的;協(xié)調(diào)的;并存的;<數(shù)>共點(diǎn)的,會(huì)合的;共同(或同時(shí))起作用的;】 transaction on the server with the same GTID blocks. The server neither begins to execute the concurrent transaction nor returns control to the client. Once the first attempt at the transaction commits or rolls back, concurrent sessions that were blocking on the same GTID may proceed. If the first attempt rolled back, one concurrent session proceeds【pro??si?dz , ?pro?si?dz 行進(jìn);前往;繼續(xù)做(或從事、進(jìn)行);接著做;繼而做;】 to attempt the transaction,and any other concurrent sessions that were blocking on the same GTID remain blocked. If the first attempt committed, all the concurrent sessions stop being blocked, and auto-skip all the statements of the transaction.

?8.GTID Sets

A GTID set is a set comprising【k?m?pra?z?? 包括;包含;組成;構(gòu)成;由…組成;是(某事物的)組成部分;】 one or more single GTIDs or ranges of GTIDs. GTID sets are used in a MySQL server in several ways. For example, the values stored by the gtid_executed and gtid_purged system variables are GTID sets. The START REPLICA (or before MySQL 8.0.22, START SLAVE) clauses UNTIL SQL_BEFORE_GTIDS and UNTIL SQL_AFTER_GTIDS can be used to make a replica process transactions only up to the first GTID in a GTID set, or stop after the last GTID in a GTID set. The built-in functions GTID_SUBSET() and GTID_SUBTRACT() require GTID sets as input.

A range of GTIDs originating from the same server can be collapsed into a single expression, as shown here:

3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5

The above example represents the first through fifth transactions originating【??r?d??ne?t?? 起源;創(chuàng)建;發(fā)明;發(fā)端于;發(fā)源;創(chuàng)立;】 on the MySQL server whose server_uuid is 3E11FA47-71CA-11E1-9E33-C80AA9429562. Multiple single GTIDs or ranges of GTIDs originating from the same server can also be included in a single expression, with the GTIDs or ranges separated by colons, as in the following example:

3E11FA47-71CA-11E1-9E33-C80AA9429562:1-3:11:47-49

A GTID set can include any combination of single GTIDs and ranges of GTIDs, and it can include GTIDs originating from different servers. This example shows the GTID set stored in the gtid_executed system variable (@@GLOBAL.gtid_executed) of a replica that has applied transactions from more than one source:

2174B383-5441-11E8-B90A-C80AA9429562:1-3, 24DA167-0C0C-11E8-8442-00059A3C7B00:1-19

When GTID sets are returned from server variables, UUIDs are in alphabetical【??lf??bet?kl 按字母順序排列的;按字母(表)順序的;】 order, and numeric intervals are merged and in ascending order.文章來源地址http://www.zghlxwxcb.cn/news/detail-858224.html

到了這里,關(guān)于MySQL 8.0 Reference Manual(讀書筆記90節(jié)--Replication)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • MySQL 8.0 Reference Manual(讀書筆記35節(jié)-- 字符編碼(2))

    Every character string literal has a character set and a collation. For the simple statement SELECT \\\'string\\\', the string has the connection default character set and collation defined by the character_set_connection and collation_connection system variables. A character string literal may have an optional character set introducer and COLLATE clause, to desig

    2024年04月13日
    瀏覽(24)
  • MySQL 8.0 Reference Manual(讀書筆記36節(jié)-- 字符編碼(3))

    Regardless of how you configure the MySQL character set for application use, you must also consider the environment within which those applications execute. For example, if you intend to send statements using UTF-8 text taken from a file that you create in an editor, you should edit the file with the locale of your environment set to UTF-8 so that the file e

    2024年04月13日
    瀏覽(27)
  • MySQL 8.0 Reference Manual(讀書筆記64節(jié)--InnoDBTransaction Model)

    The InnoDB transaction model aims to combine the best properties【?prɑp?rtiz 財(cái)產(chǎn); 特性; 房地產(chǎn); 不動(dòng)產(chǎn); 財(cái)物; 莊園; 所有物; 房屋及院落; 】 of a multi-versioning database with traditional two-phase locking. InnoDB performs locking at the row level and runs queries as nonlocking consistent reads by default, in the style of Oracle. T

    2024年04月22日
    瀏覽(25)
  • MySQL 8.0 Reference Manual(讀書筆記65節(jié)--InnoDBLocks Set)

    A locking read, an UPDATE, or a DELETE generally set record locks on every index record that is scanned in the processing of an SQL statement. It does not matter whether there are WHERE conditions in the statement that would exclude the row. InnoDB does not remember the exact【?ɡ?z?kt 準(zhǔn)確的; 精確的; 嚴(yán)格的; 精密的; 嚴(yán)謹(jǐn)?shù)? 嚴(yán)密的; 一絲

    2024年04月22日
    瀏覽(26)
  • MySQL 8.0 Reference Manual(讀書筆記67節(jié)--Phantom Rows)

    The so-called phantom problem occurs within a transaction when the same query produces different sets of rows at different times. For example, if a SELECT is executed twice, but returns a row the second time that was not returned the first time, the row is a “phantom” row. Suppose that there is an index on the id column of the child table and that you wa

    2024年03月23日
    瀏覽(21)
  • MySQL 8.0 Reference Manual(讀書筆記63節(jié)--InnoDB Locking)

    MySQL 8.0 Reference Manual(讀書筆記63節(jié)--InnoDB Locking)

    To implement a large-scale, busy, or highly reliable database application, to port substantial【s?b?st?n?l】 code from a different database system, or to tune MySQL performance, it is important to understand InnoDB locking and the InnoDB transaction model. InnoDB implements【??mpl?ments 實(shí)施; 執(zhí)行; 貫徹; 使生效; 】 standard row-level lock

    2024年04月22日
    瀏覽(27)
  • MySQL 8.0 Reference Manual(讀書筆記40節(jié)-- Data Types(2))

    MySQL 8.0 Reference Manual(讀書筆記40節(jié)-- Data Types(2))

    The string data types are CHAR, VARCHAR, BINARY, VARBINARY, BLOB, TEXT, ENUM, and SET. In some cases, MySQL may change a string column to a type different from that given in a CREATE TABLE or ALTER TABLE statement.? For definitions of character string columns (CHAR, VARCHAR, and the TEXT types), MySQL interprets【?n?t??rpr?ts 詮釋; 說明; 把…理解

    2024年04月17日
    瀏覽(49)
  • MySQL 8.0 Reference Manual(讀書筆記39節(jié)-- Data Types(1))

    Data type descriptions use these conventions: ? For integer types, M indicates the maximum display width. For floating-point and fixed-point types, M is the total number of digits that can be stored (the precision). For string types, M is the maximum length. The maximum permissible value of M depends on the data type. ? D applies to floating-point and fi

    2024年04月16日
    瀏覽(24)
  • MySQL 8.0 Reference Manual(讀書筆記41節(jié)-- Data Types(3))

    MySQL 8.0 Reference Manual(讀書筆記41節(jié)-- Data Types(3))

    Data type specifications can have explicit【?k?spl?s?t 明確的; 詳述的; 直言的, 坦率的; 一目了然的; 】 or implicit【?m?pl?s?t 含蓄的; 完全的; 內(nèi)含的; 無疑問的; 不直接言明的; 成為一部分的; 】 default values. A DEFAULT value clause in a data type specification explicitly indicates a default value for a colum

    2024年04月17日
    瀏覽(31)
  • MySQL 8.0 Reference Manual(讀書筆記80節(jié)-- InnoDB Row Formats)

    The row format of a table determines how its rows are physically stored, which in turn can affect the performance of queries and DML operations. As more rows fit into a single disk page, queries and index lookups can work faster, less cache memory is required in the buffer pool, and less I/O is required to write out updated values. The data in each table is

    2024年04月08日
    瀏覽(27)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包