<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        MySQL超簡單的配置-主主配置

        來源:懂視網 責編:小采 時間:2020-11-09 16:10:40
        文檔

        MySQL超簡單的配置-主主配置

        MySQL超簡單的配置-主主配置:MySQL同步就是怎么簡單,鄙視那些自私自利的人, 本人的筆記: http://note.youdao.com/share/id=d70f203ee0407a475fcfa47b62b51500nbsp;技術是需要共享的麻煩朋友幫收藏頂一頂。 ###################################
        推薦度:
        導讀MySQL超簡單的配置-主主配置:MySQL同步就是怎么簡單,鄙視那些自私自利的人, 本人的筆記: http://note.youdao.com/share/id=d70f203ee0407a475fcfa47b62b51500nbsp;技術是需要共享的麻煩朋友幫收藏頂一頂。 ###################################

        MySQL同步就是怎么簡單,鄙視那些自私自利的人, 本人的筆記: http://note.youdao.com/share/?id=d70f203ee0407a475fcfa47b62b51500nbsp;技術是需要共享的麻煩朋友幫收藏頂一頂。 ###################################################### MySQL server-id=

        MySQL同步就是怎么簡單,鄙視那些自私自利的人,
        本人的筆記:
        http://note.youdao.com/share/?id=d70f203ee0407a475fcfa47b62b51500&type=note
        ######################################################
        技術是需要共享的 麻煩朋友幫收藏頂一頂。
        ###################################################### MySQL $velocityCount-->
        server-id	= 1
        log-bin=mysql-bin
        log-slave-updates
        #slave-skip-errors=all
        sync_binlog=1
        auto_increment_increment=2
        auto_increment_offset=1
        replicate_wild_ignore_table=mysql.%
        replicate_wild_ignore_table=test.%
        innodb_file_per_table=1
        binlog_format =mixed
        server-id	= 2
        log-bin=mysql-bin
        log-slave-updates
        #slave-skip-errors=all
        sync_binlog=1
        auto_increment_increment=2
        auto_increment_offset=2
        replicate_wild_ignore_table=mysql.%
        replicate_wild_ignore_table=test.%
        innodb_file_per_table=1
        binlog_format =mixed
        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
        ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
        192.168.1.46 Ahost
        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
        ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
        192.168.1.47 Bhost
        ###################################### 
        # Firewall configuration written by system-config-firewall 
        # Manual customization of this file is not recommended. 
        *filter 
        :INPUT ACCEPT [0:0] 
        :FORWARD ACCEPT [0:0] 
        :OUTPUT ACCEPT [0:0] 
        -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT 
        -A INPUT -p icmp -j ACCEPT 
        -A INPUT -i lo -j ACCEPT 
        -A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT 
        -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT 
        -A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT 
        -A INPUT -j REJECT –reject-with icmp-host-prohibited 
        -A FORWARD -j REJECT –reject-with icmp-host-prohibited 
        COMMIT 
        #####################################
        防火墻
        1) 重啟后生效 
        開啟: chkconfig iptables on 
        關閉: chkconfig iptables off 
        
        防火墻
        2) 即時生效,重啟后失效 
        開啟: service iptables start 
        關閉: service iptables stop 
        #####################################
        一般是事務回滾造成的:
        解決辦法:
        mysql> slave stop;
        mysql> set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
        mysql> slave start;
        ######################################
        
        
        解決辦法一、
        Slave_SQL_Running: No
        1.程序可能在slave上進行了寫操作
        2.也可能是slave機器重起后,事務回滾造成的.
        
        
        
         Last_SQL_Errno: 1677
         Last_SQL_Error: Column 1 of table 'test.t' cannot be converted from type 'int' to type 'bigint(20)'
         解決方法:這個案例是從網上找到的,自己動手實驗了一把。從錯誤信息來看表面上是由于在slave上無法執行一條轉換字段類型的SQL語句。實際上并不是有這種語句直接引起的,而是間接引起的(之前某些操作導致主從表字段類型不一致,接下來對這個表進行DML時就會報錯)。它的意思是在對這個表t進行DML操作時,發現主從上表結果不一致,比如這里是說在主上t的字段1是int類型,但是從上t的字段1是bigint類型,所以報錯。那么為什么要報錯呢?這是從安全角度考慮,因為如果字段類型不一致可能會導致數據截斷之類的問題。那么解決方法呢?通過參數slave_type_conversions進行控制,它有三種取值:
        ALL_LOSSY:僅支持有損轉換,什么叫有損?比如一個值本來是bigint存儲為9999999999999,現在轉換為int類型勢必會要截斷從而導致數據不一致。
        ALL_NON_LOSSY:僅支持無損轉換,只能在無損的情況下才能進行轉換
        ALL_LOSSY,ALL_NON_LOSSY:有損/無算轉換都支持
        空,即不設置這個參數:必須主從的字段類型一模一樣。
        注意: 前面說的這幾中情況都只在binlog_format=ROW的情況下才有效。
        
        
         Last_SQL_Errno: 1194
         Last_SQL_Error: Error 'Table 'traincenter' is marked as crashed and should be repaired' on query. Default database: 'basketballman'. Query: 'update traincenter set points='4',pointstime='1361912066' where uid = '1847482697' limit 1'
         解決方法:myisam表traincenter損壞,直接repair table即可。至于為什么myisam類型表比innodb更容易損壞,我覺得有兩個原因:1,innodb有double write機制,損壞或者half write的頁可以用它恢復,第二innodb是事務引擎,都有操作都是事務的,而myisam是非事務的,存在寫一半但是操作終止情況。
        
        
         Last_IO_Errno: 1236
         Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
         解決方法:主庫上的binlog文件已經不存在但是在index file中確有相應記錄存在。我這里發生這個錯誤的原因在于由于復制中斷時間很長,報警出來一直沒人處理,這個中斷時間超過master上binlog超期時間,等恢復復制時需要的binlog已經由于其超期而被刪掉,沒辦法只好重建這個實例了。以大家都要引以為戒
        stop slave;
        reset slave; 
        slave start;
        
        
         Last_IO_Errno: 1593
         Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
         解決方法:主從配置的server-id一樣,而在主從復制環境中server-id一樣的binlog events都會被過濾掉。具體server-id的含義可以了解一下復制原理。這個一般是因為拷貝配置文件時忘記修改server-id導致,遇到這類問題也比較容易,平時操作謹慎一點即可。
        
        
         Last_Errno: 1053
         Last_Error: Query partially completed on the master (error on master: 1053) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; . Query: 'insert into ...
         解決方法:查詢在master上部分完成,然后終止了。這馬上又能想到是myisam表,結果也正是這樣。由于myisam不支持事務所以可能存在一個查詢完成一部分然后失敗的情況。解決方法一般也就是提示信息給出的跳過一個binlog event。不過確認跳過之前最好還是查詢一下master上是否真的存在相應的記錄,因為錯誤信息同時還會給出它認為在master上執行一部分然后終止的查詢語句。
        
        
         Last_SQL_Errno: 1666
         Last_SQL_Error: Error executing row event: 'Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT.' 
         解決方法:這個案例的背景是做一個ABC結構的復制,B、C中設定的binlog_format=statement,A中的是MIXED,所以當B嘗試重做A過來的relay log,然后記錄binlog(傳給C)時發現relay log的binlog_format與自己設定的binlog_format不一致。我當時就是直接先更改BC的binlog_format=MIXED解決。
        
        
         Last_Errno: 1032
         Last_Error: Could not execute Update_rows event on table db.table; Can't find record in 'table', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000064, end_log_pos 158847
         解決方法:這個是在binlog_format=row復制下發生的。原因是因為row格式復制是最嚴格的,所以在mysql看來如果在從庫上找不到要更新的這條記錄,那么就代表主從數據不一致,因此報錯。另外順便說一句,對于row格式binlog,如果某個更新操作實際上并沒有更新行,這個操作是不會記binlog的,因為row格式的binlog宗旨就是只記錄發生了改變的行。所以這個解決辦法根據你自己實際應用來定,最好的方法還是重做slave吧,這樣更放心。
        
        
         Last_Errno: 28
         Last_Error: Error in Append_block event: write to '/tmp/SQL_LOAD-32343798-72213798-1.data' failed
         解決方法: 首先說錯誤原因:主庫執行load data infile,同步到從庫后load data infile存放的文件默認是放在/tmp(由參數slave_load_tmpdir控制),而/tmp空間不夠因此報錯。因此只要將從庫上slave_load_tmpdir設置到一個磁盤空間足夠大的分區就行。
        ①##########################
        show variables like 'server_id';
        ②##########################
        server-id	= 1
        log-bin=mysql-bin
        log-slave-updates
        #slave-skip-errors=all
        sync_binlog=1
        auto_increment_increment=2
        auto_increment_offset=1
        innodb_file_per_table=1
        binlog_format =mixed
        ③##########################
        GRANT REPLICATION CLIENT,REPLICATION SLAVE ON *.* TO'repl'@'%' IDENTIFIED BY '123456';
        ④##########################
        SHOW GRANTS FOR repl@'%';
        ⑤##########################
        FLUSH PRIVILEGES;
        ⑥##########################
        show master status\G 
        *************** 1. row **************
         File: mysql-bin.000005
         Position: 37312
         Binlog_Do_DB:
        Binlog_Ignore_DB: 
        ⑦##########################
        change master to
        master_host='192.168.1.47',
        master_user='repl',
        master_password='123456',
        master_log_file='mysql-bin.000006',
        master_log_pos=11792,
        master_port=3306;
        ⑧##########################
        show slave status\G
        ⑨##########################
        start slave;
        ############################
        如果起不來就reset slave
        ############################
        ①##########################
        show variables like 'server_id';
        ②##########################
        server-id	= 9
        log-bin=mysql-bin
        log-slave-updates
        #slave-skip-errors=all
        sync_binlog=1
        auto_increment_increment=2
        auto_increment_offset=2
        innodb_file_per_table=1
        binlog_format =mixed
        ③##########################
        GRANT REPLICATION CLIENT,REPLICATION SLAVE ON *.* TO'repl'@'%' IDENTIFIED BY '123456';
        ④##########################
        SHOW GRANTS FOR repl@'%';
        ⑤##########################
        FLUSH PRIVILEGES;
        ⑥##########################
        show master status\G
        ************* 1. row ****************
         File: mysql-bin.000006
         Position: 11792
         Binlog_Do_DB:
        Binlog_Ignore_DB: 
        ⑦##########################
        change master to
        master_host='192.168.1.46',
        master_user='repl',
        master_password='123456',
        master_log_file='mysql-bin.000005',
        master_log_pos=37312,
        master_port=3306;
        ⑧##########################
        show slave status\G
        ⑨##########################
        start slave;
        ############################
        如果起不來就reset slave
        ############################

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        MySQL超簡單的配置-主主配置

        MySQL超簡單的配置-主主配置:MySQL同步就是怎么簡單,鄙視那些自私自利的人, 本人的筆記: http://note.youdao.com/share/id=d70f203ee0407a475fcfa47b62b51500nbsp;技術是需要共享的麻煩朋友幫收藏頂一頂。 ###################################
        推薦度:
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: aⅴ免费在线观看| 亚洲欧洲第一a在线观看| 精品韩国亚洲av无码不卡区| 中文字幕在线观看亚洲视频| 亚洲精品福利你懂| 中文字幕av无码无卡免费| 免费一看一级毛片全播放| 亚洲人成人无码网www电影首页| 亚洲avav天堂av在线不卡| 久久精品国产亚洲av天美18| 日韩免费一区二区三区| 亚洲精品你懂的在线观看| 亚洲精品无码成人| 无码人妻一区二区三区免费看| 天天干在线免费视频| 亚洲精品乱码久久久久久久久久久久 | 亚洲成电影在线观看青青| 国产亚洲视频在线| 精品国产sm捆绑最大网免费站| 亚洲伊人精品综合在合线| 久久99精品免费视频| 亚洲欧洲中文日产| 青草草在线视频永久免费| 91亚洲国产在人线播放午夜| 久久精品国产亚洲AV麻豆王友容| 亚洲综合精品第一页| 9277手机在线视频观看免费| 亚洲成A人片在线观看中文| 亚洲第一成年人网站| a级毛片无码免费真人久久| 四虎影视免费在线| 免费无码又爽又黄又刺激网站 | 新最免费影视大全在线播放| 1000部拍拍拍18勿入免费视频下载 | 日韩免费观看一区| 久久久久无码专区亚洲av| 亚洲日日做天天做日日谢| 免费看黄视频网站| 亚洲欧洲日产韩国在线| 亚洲第一页日韩专区| 少妇性饥渴无码A区免费|