User Tools

Site Tools


doc:appunti:linux:sa:mysql_replica_master_master

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:mysql_replica_master_master [2019/09/30 09:51] – [Configurare la replica master-master] niccolodoc:appunti:linux:sa:mysql_replica_master_master [2025/03/12 15:03] (current) – [Verifica dello stato SLAVE] niccolo
Line 91: Line 91:
 SHOW SLAVE STATUS; SHOW SLAVE STATUS;
 </code> </code>
 +===== Verifica dello stato SLAVE =====
 +
 +Come utente Unix root ci si collega al database MASTER/SLAVE:
 +
 +<code>
 +mysql dbname
 +</code>
 +
 +Per vedere lo stato di slave:
 +
 +<code sql>
 +SHOW STATUS LIKE 'Slave_running';
 +</code>
 +
 +<code>
 ++---------------+-------+
 +| Variable_name | Value |
 ++---------------+-------+
 +| Slave_running | ON    |
 ++---------------+-------+
 +</code>
 +
 +Per verificare lo stato di slave e in particolare il numero di log in corso di replica (**Relay_Master_Log_File**):
 +
 +<code sql>
 +SHOW SLAVE STATUS\G;
 +</code>
 +
 +<code>
 +MariaDB [dbname]> SHOW SLAVE STATUS\G;
 +*************************** 1. row ***************************
 +               Slave_IO_State: Waiting for master to send event
 +                  Master_Host: 172.16.2.163
 +                  Master_User: replication
 +                  Master_Port: 3306
 +                Connect_Retry: 60
 +              Master_Log_File: mariadb-bin.004356
 +          Read_Master_Log_Pos: 845159197
 +               Relay_Log_File: relay-bin.012490
 +                Relay_Log_Pos: 819964666
 +        Relay_Master_Log_File: mariadb-bin.004300
 +             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: 819964380
 +              Relay_Log_Space: 61048049539
 +              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: 6789
 +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: 2
 +</code>
 +
 +Se **durante la sincronizzazione uno statement fallisce** si vede l'errore. È possibile far ripartire la sincronizzazione saltando un singolo statement con i comandi:
 +
 +<code sql>
 +STOP SLAVE;
 +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 +START SLAVE;
 +</code>
 +
 ===== Crash test ===== ===== Crash test =====
  
doc/appunti/linux/sa/mysql_replica_master_master.1569829874.txt.gz · Last modified: 2019/09/30 09:51 by niccolo