mysql同步部分指定的表

<p>主上修改my.cnf文件:</p><p>server-id=1
</p><p>log-bin=mysql-bin</p><p>从上修改配置文件 my.cnf</p><pre class="brush:bash;toolbar:false">server-id=2 relay-log=replay-bin read-only=1 replicate-ignore-db=mysql replicate-ignore-db=test replicate-ignore-db=information_schema replicate-wild-do-table=mysys.channel#需要同步的一个表 replicate-wild-do-table=mysys.isp_channel#需要同步的一个表 创建同步的用户(主上) GRANTREPLICATIONSLAVE,REPLICATIONCLIENTON*.*torep@&#39;22.2.2.22&#39;identifiedby&#39;slave_password&#39;;</pre><p>同步到主库(在从上操作)</p><pre class="brush:sql;toolbar:false">SLAVESTOP; resetslave; CHANGEMASTERTOMASTER_HOST=&#39;111.11.1.11&#39;, MASTER_USER=&#39;rep&#39;, MASTER_PASSWORD=&#39;slave_password&#39;, MASTER_LOG_FILE=&#39;mysql-bin.000001&#39;, MASTER_LOG_POS=0; startslave; showslavestatus\G</pre><p>在从上验证:</p><pre class="brush:sql;toolbar:false">mysql&gt;showslavestatus\G; ***************************1.row*************************** Slave_IO_State:Waitingformastertosendevent Master_Host:111.11.1.11 Master_User:rep Master_Port:3306 Connect_Retry:60 Master_Log_File:mysql-bin.000001 Read_Master_Log_Pos:593 Relay_Log_File:replay-bin.000001 Relay_Log_Pos:730 Relay_Master_Log_File:mysql-bin.000001 Slave_IO_Running:Yes Slave_SQL_Running:Yes Replicate_Do_DB: Replicate_Ignore_DB:mysql,test,information_schema Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table:mysys.channel,mysys.isp_channel,mysys.department,mysys.department_business,mysys.sms_key Replicate_Wild_Ignore_Table: Last_Errno:0 Last_Error: Skip_Counter:0 Exec_Master_Log_Pos:593 Relay_Log_Space:730 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:0 1rowinset(0.00sec) ERROR: Noqueryspecified</pre>
RangeTime:0.007754s
RangeMem:205.55 KB
返回顶部 留言