GreatSQL社区

搜索

[待回复] mysql slave 延 迟

47 5 3 天前

s l ave
innodb_redo_log_capacity                 | 104857600  


mysql> show variables like '%parallel%';
+------------------------------+---------------+
| Variable_name                | Value         |
+------------------------------+---------------+
| innodb_parallel_read_threads | 4             |
| replica_parallel_type        | LOGICAL_CLOCK |
| replica_parallel_workers     | 8             |
| slave_parallel_type          | LOGICAL_CLOCK |
| slave_parallel_workers       | 8             |
+------------------------------+---------------+
5 rows in set (0.00 sec)

mysql> show variables like '%binlog_group_commit%';
+-----------------------------------------+-------+
| Variable_name                           | Value |
+-----------------------------------------+-------+
| binlog_group_commit_sync_delay          | 0     |
| binlog_group_commit_sync_no_delay_count | 0     |
+-----------------------------------------+-------+
2 rows in set (0.01 sec)

mysql> show variables like '%binlog_transaction_dependency_tracking%';
+----------------------------------------+----------+
| Variable_name                          | Value    |
+----------------------------------------+----------+
| binlog_transaction_dependency_tracking | WRITESET |
+----------------------------------------+----------+
sql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Queueing source event to the relay log
                  Master_Host: 10.1***20
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.021892
          Read_Master_Log_Pos: 187617675
               Relay_Log_File: gacspcdb03-relay-bin.000064
                Relay_Log_Pos: 187607668
        Relay_Master_Log_File: binlog.021892
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 187607498
              Relay_Log_Space: 187618144
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 67927
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 20
                  Master_UUID: 2c93e685-afd1-11eb-a93d-005056a35f7a
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: 2c93e685-afd1-11eb-a93d-005056a35f7a:1367742875-1368497434
            Executed_Gtid_Set: 2c93e685-afd1-11eb-a93d-005056a35f7a:1-1368497434,
8daf9ffe-afd1-11eb-a9d4-005056a315fe:1-1098484648
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
       Master_public_key_path:
        Get_master_public_key: 0
            Network_Namespace:
1 row in set, 1 warning (0.00 sec)

mysql>  show variables like '%buffer_pool%';
+-------------------------------------+----------------+
| Variable_name                       | Value          |
+-------------------------------------+----------------+
| innodb_buffer_pool_chunk_size       | 134217728      |
| innodb_buffer_pool_dump_at_shutdown | ON             |
| innodb_buffer_pool_dump_now         | OFF            |
| innodb_buffer_pool_dump_pct         | 25             |
| innodb_buffer_pool_filename         | ib_buffer_pool |
| innodb_buffer_pool_in_core_file     | ON             |
| innodb_buffer_pool_instances        | 8              |
| innodb_buffer_pool_load_abort       | OFF            |
| innodb_buffer_pool_load_at_startup  | ON             |
| innodb_buffer_pool_load_now         | OFF            |
| innodb_buffer_pool_size             | 17179869184    |
+-------------------------------------+----------------+
11 rows in set (0.00 sec)


主库

mysql> show variables like '%innodb_redo%';
+------------------------------+-----------+
| Variable_name                | Value     |
+------------------------------+-----------+
| innodb_redo_log_archive_dirs |           |
| innodb_redo_log_capacity     | 104857600 |
| innodb_redo_log_encrypt      | OFF       |
+------------------------------+-----------+


ysql> show master status\G
*************************** 1. row ***************************
             File: binlog.021980
         Position: 332593495
     Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set: 2c93e685-afd1-11eb-a93d-005056a35f7a:1-1371476438,
8daf9ffe-afd1-11eb-a9d4-005056a315fe:1-1098484648
1 row in set (0.00 sec)

全部回复(5)
770750140 3 天前
[root@ga log]# iostat -dmx 1
Linux 4.18.0-240.el8.x86_64 (gacspcdb03) 09/24/2025 _x86_64_(16 CPU)

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.38    0.45      0.02      0.01     0.03     0.16   6.43  26.51    1.07    1.06   0.00    48.35    12.90   0.62   0.05
sdb            145.58  453.22      5.63      7.75     0.01   229.25   0.01  33.59    0.01    0.07   0.00    39.59    17.50   0.02   0.92
scd0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.05    0.00   0.00     0.03     0.00   0.49   0.00
dm-0             0.32    0.43      0.02      0.00     0.00     0.00   0.00   0.00    1.07    0.84   0.00    54.78    11.85   0.58   0.04
dm-1             0.07    0.18      0.00      0.00     0.00     0.00   0.00   0.00    0.57    1.38   0.00     4.00     4.00   0.32   0.01
dm-2             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.48    0.74   0.00     4.34     9.11   1.09   0.00
dm-3           140.85  679.51      5.63      6.37     0.00     0.00   0.00   0.00    0.14    0.04   0.02    40.92     9.59   0.01   0.87
dm-4             0.02    0.80      0.00      1.38     0.00     0.00   0.00   0.00    1.91   29.71   0.02     4.00  1770.78   3.67   0.30

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              1.00    1.00      0.01      0.01     0.00     0.00   0.00   0.00    0.00    1.00   0.00     8.00     8.00   1.00   0.20
sdb             30.00 1606.00      0.47     12.49     0.00  1014.00   0.00  38.70    0.70    0.65   0.19    16.00     7.97   0.61 100.00
scd0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-0             1.00    1.00      0.01      0.01     0.00     0.00   0.00   0.00    0.00    0.00   0.00     8.00     8.00   1.00   0.20
dm-1             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-2             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-3            30.00 2620.00      0.47     12.50     0.00     0.00   0.00   0.00    0.47    0.66   1.75    16.00     4.88   0.38  99.90
dm-4             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              8.00   15.00      2.23      0.12     1.00     0.00  11.11   0.00    2.62    0.80   0.02   285.00     8.43   1.04   2.40
sdb              2.00 1348.00      0.03      9.38     0.00   740.00   0.00  35.44    1.00    0.78   0.37    16.00     7.13   0.74 100.10
scd0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-0             6.00   12.00      2.23      0.10     0.00     0.00   0.00   0.00    2.67    0.92   0.03   380.00     8.62   1.11   2.00
dm-1             0.00    1.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    1.00   0.00     0.00     4.00   2.00   0.20
dm-2             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-3             2.00 2087.00      0.03      9.38     0.00     0.00   0.00   0.00    1.00    0.78   1.63    16.00     4.60   0.48 100.10
dm-4             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
sdb              2.00 1454.00      0.03      9.89     0.00   796.00   0.00  35.38    0.50    0.72   0.28    16.00     6.96   0.69  99.90
scd0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-1             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-2             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-3             2.00 2250.00      0.03      9.89     0.00     0.00   0.00   0.00    0.50    0.70   1.59    16.00     4.50   0.44  99.90
dm-4             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
sdb              2.00 1644.00      0.03     10.96     0.00   884.00   0.00  34.97    1.00    0.67   0.19    16.00     6.82   0.61 100.00
scd0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-1             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-2             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
dm-3             2.00 2528.00      0.03     10.96     0.00     0.00   0.00   0.00    0.00    0.60   1.52    16.00     4.44   0.40 100.10
dm-4             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     0.00     0.00   0.00   0.00
yejr 3 天前
770750140 发表于 2025-9-24 10:34
[root@ga log]# iostat -dmx 1
Linux 4.18.0-240.el8.x86_64 (gacspcdb03) 09/24/2025 _x86_64_(16 CPU)

服务器的I/O性能也太差了吧,这么点iops就把I/O跑满了,应该优先升级磁盘设备
770750140 3 天前
yejr 发表于 2025-9-24 10:41
服务器的I/O性能也太差了吧,这么点iops就把I/O跑满了,应该优先升级磁盘设备 ...

之前问红帽,说util这个值并不能代表磁盘性能,只能说明这一刻有没有io,这个值不是很准确
To be clear, this is no performance issue but new larger values reflect a change in how statistics are gathered. These changes are seen within field #10 in /proc/diskstats as a result of how that data is tracked and reported. This field is used by both %util and svctm and can be inflated and inaccurate due to changing from a precise measured method to a sampling/approximation statistical gathering method.
This is a known linux kernel bug that will not be fixed within RHEL 8. A future release note is planned for RHEL 8 and 9 that reads in part as follows:
770750140 3 天前
770750140 发表于 2025-9-24 15:16
之前问红帽,说util这个值并不能代表磁盘性能,只能说明这一刻有没有io,这个值不是很准确
To be clear,  ...

io的响应时间 await 这一列是正常的1ms
caihe.li 前天 10:30
770750140 发表于 2025-9-24 15:24
io的响应时间 await 这一列是正常的1ms

用dd去实际测速试试
770750140

1

主题

0

博客

8

贡献

新手上路

Rank: 1

积分
15

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2025-9-27 02:49 , Processed in 0.022334 second(s), 14 queries , Redis On.
快速回复 返回顶部 返回列表