亚洲韩日午夜视频,欧美日韩在线精品一区二区三区,韩国超清无码一区二区三区,亚洲国产成人影院播放,久草新在线,在线看片AV色

您好,歡迎來到思海網(wǎng)絡,我們將竭誠為您提供優(yōu)質(zhì)的服務! 誠征網(wǎng)絡推廣 | 網(wǎng)站備案 | 幫助中心 | 軟件下載 | 購買流程 | 付款方式 | 聯(lián)系我們 [ 會員登錄/注冊 ]
促銷推廣
客服中心
業(yè)務咨詢
有事點擊這里…  531199185
有事點擊這里…  61352289
點擊這里給我發(fā)消息  81721488
有事點擊這里…  376585780
有事點擊這里…  872642803
有事點擊這里…  459248018
有事點擊這里…  61352288
有事點擊這里…  380791050
技術支持
有事點擊這里…  714236853
有事點擊這里…  719304487
有事點擊這里…  1208894568
有事點擊這里…  61352289
在線客服
有事點擊這里…  531199185
有事點擊這里…  61352288
有事點擊這里…  983054746
有事點擊這里…  893984210
當前位置:首頁 >> 技術文章 >> 文章瀏覽
技術文章

MySQL互為主從配置

添加時間:2011-3-10  添加: admin 

MySQL-VIP:192.168.1.200 

2 MySQL-master1:192.168.1.201 

3 MySQL-master2:192.168.1.202     

4   

5 OS版本:CentOS 5.4 

6 MySQL版本:5.0.89 

7 Keepalived版本:1.1.20

 一、MySQL master-master配置

  1、修改MySQL配置文件

  兩臺MySQL均如要開啟binlog日志功能,開啟方法:在MySQL配置文件[MySQLd]段中加上log-bin=MySQL-bin選項

  兩臺MySQL的server-ID不能一樣,默認情況下兩臺MySQL的serverID都是1,需將其中一臺修改為2即可

  2、將192.168.1.201設為192.168.1.202的主服務器

  在192.168.1.201上新建授權(quán)用戶

view source
< id="highlighter_12830_clipboard" title="copy to clipboard" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="16" height="16" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash">
print?
01 MySQL> grant replication slave on *.* to 'replication'@'%' identified by 'replication'; 

02 Query OK, 0 rows affected (0.00 sec)     

03   

04 MySQL> show master status; 

05 +------------------+----------+--------------+------------------+ 

06 | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | 

07 +------------------+----------+--------------+------------------+ 

08 | MySQL-bin.000003 |      374 |              |                  | 

09 +------------------+----------+--------------+------------------+ 

10 1 row in set (0.00 sec) 

11   在192.168.1.202上將192.168.1.201設為自己的主服務器 

12   

13 MySQL> change master to master_host='192.168.1.201',master_user='replication',master_password='replication',master_log_file='MySQL-bin.000003',master_log_pos=374; 

14 Query OK, 0 rows affected (0.05 sec)     

15   

16 MySQL> start slave; 

17 Query OK, 0 rows affected (0.00 sec)     

18   

19 MySQL> show slave status\G 

20 *************************** 1. row *************************** 

21              Slave_IO_State: Waiting for master to send event 

22                 Master_Host: 192.168.1.201 

23                 Master_User: replication 

24                 Master_Port: 3306 

25               Connect_Retry: 60 

26             Master_Log_File: MySQL-bin.000003 

27         Read_Master_Log_Pos: 374 

28              Relay_Log_File: MySQL-master2-relay-bin.000002 

29               Relay_Log_Pos: 235 

30       Relay_Master_Log_File: MySQL-bin.000003 

31            Slave_IO_Running: Yes 

32           Slave_SQL_Running: Yes 

33             Replicate_Do_DB: 

34         Replicate_Ignore_DB: 

35          Replicate_Do_Table: 

36      Replicate_Ignore_Table: 

37     Replicate_Wild_Do_Table: 

38 Replicate_Wild_Ignore_Table: 

39                  Last_Errno: 0 

40                  Last_Error: 

41                Skip_Counter: 0 

42         Exec_Master_Log_Pos: 374 

43             Relay_Log_Space: 235 

44             Until_Condition: None 

45              Until_Log_File: 

46               Until_Log_Pos: 0 

47          Master_SSL_Allowed: No 

48          Master_SSL_CA_File: 

49          Master_SSL_CA_Path: 

50             Master_SSL_Cert: 

51           Master_SSL_Cipher: 

52              Master_SSL_Key: 

53       Seconds_Behind_Master: 0 

54 1 row in set (0.00 sec)

  3、將192.168.1.202設為192.168.1.201的主服務器

  在192.168.1.202上新建授權(quán)用戶

view source
< id="highlighter_331829_clipboard" title="copy to clipboard" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="16" height="16" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash">
print?
01 MySQL> grant replication slave on *.* to 'replication'@'%' identified by 'replication'; 

02 Query OK, 0 rows affected (0.00 sec)     

03   

04 MySQL> show master status; 

05 +------------------+----------+--------------+------------------+ 

06 | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | 

07 +------------------+----------+--------------+------------------+ 

08 | MySQL-bin.000003 |      374 |              |                  | 

09 +------------------+----------+--------------+------------------+ 

10 1 row in set (0.00 sec)

  在192.168.1.201上,將192.168.1.202設為自己的主服務器

view source
< id="highlighter_574354_clipboard" title="copy to clipboard" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="16" height="16" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash">
print?
01 MySQL> change master to master_host='192.168.1.202',master_user='replication',master_password='replication',master_log_file='MySQL-bin.000003',master_log_pos=374; 

02 Query OK, 0 rows affected (0.05 sec)     

03   

04 MySQL> start slave; 

05 Query OK, 0 rows affected (0.00 sec)     

06   

07 MySQL> show slave status\G 

08 *************************** 1. row *************************** 

09              Slave_IO_State: Waiting for master to send event 

10                 Master_Host: 192.168.1.202 

11                 Master_User: replication 

12                 Master_Port: 3306 

13               Connect_Retry: 60 

14             Master_Log_File: MySQL-bin.000003 

15         Read_Master_Log_Pos: 374 

16              Relay_Log_File: MySQL-master1-relay-bin.000002 

17               Relay_Log_Pos: 235 

18       Relay_Master_Log_File: MySQL-bin.000003 

19            Slave_IO_Running: Yes 

20           Slave_SQL_Running: Yes 

21             Replicate_Do_DB: 

22         Replicate_Ignore_DB: 

23          Replicate_Do_Table: 

24      Replicate_Ignore_Table: 

25     Replicate_Wild_Do_Table: 

26 Replicate_Wild_Ignore_Table: 

27                  Last_Errno: 0 

28                  Last_Error: 

29                Skip_Counter: 0 

30         Exec_Master_Log_Pos: 374 

31             Relay_Log_Space: 235 

32             Until_Condition: None 

33              Until_Log_File: 

34               Until_Log_Pos: 0 

35          Master_SSL_Allowed: No 

36          Master_SSL_CA_File: 

37          Master_SSL_CA_Path: 

38             Master_SSL_Cert: 

39           Master_SSL_Cipher: 

40              Master_SSL_Key: 

41       Seconds_Behind_Master: 0 

42 1 row in set (0.00 sec)

關健詞:互為主從

分享到:

頂部 】 【 關閉
版權(quán)所有:佛山思海電腦網(wǎng)絡有限公司 ©1998-2024 All Rights Reserved.
聯(lián)系電話:(0757)22630313、22633833
中華人民共和國增值電信業(yè)務經(jīng)營許可證: 粵B1.B2-20030321 備案號:粵B2-20030321-1
網(wǎng)站公安備案編號:44060602000007 交互式欄目專項備案編號:200303DD003  
察察 工商 網(wǎng)安 舉報有獎  警警  手機打開網(wǎng)站