close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_delta.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.

Changes between Version 1 and Version 2 of MySQL_Replication


Ignore:
Timestamp:
Oct 7, 2008, 3:07:11 PM (16 years ago)
Author:
rider
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MySQL_Replication

    v1 v2  
    77Debian GNU/Linux Etch 4.0r4 with kernel 2.6.18[[BR]]
    88
     9=== Part1: 安裝MySQL 5.0 ===
     10
    911'''步驟一 :''' 安裝 MySQL (假定 Master1 & Master2 都還沒有安裝 MySQL database)[[BR]]
    1012
     
    1214''rider@ocean:~$ sudo apt-get install mysql-server-5.0 mysql-client-5.0''[[BR]]
    1315
    14 '''步驟二 :''' 為了要確保同步設定有效,我們讓MySQL可以在該網路介面上(interface)任意開啟監聽的埠(port)並藉由編輯 /etc/mysql/my.cnf 來註釋 bind-address.
     16'''步驟二 :''' 為了要確保同步設定有效,我們讓MySQL可以在該網路介面上(interface)任意開啟監聽的埠(port)並藉由編輯 /etc/mysql/my.cnf 將 bind-address註釋起來.
    1517
    1618使用指令[[BR]]
     
    2527
    2628使用指令[[BR]]
    27 ''rider@ocean:~$ sudo /etc/init.d/mysql restart''[[BR]]
     29''rider@ocean:~$ sudo su''[[BR]]
     30''root@ocean:~$ /etc/init.d/mysql restart''[[BR]]
    2831
    2932'''步驟四 :''' 檢查MySQL所開啟的連接埠
    3033
    3134使用指令[[BR]]
    32 ''rider@ocean:~$ netstat -tunlp | grep mysql''[[BR]]
     35''root@ocean:~$ netstat -tap | grep mysql''[[BR]]
    3336{{{
    34 tcp        0      0 *:mysql                 *:*                     LISTEN     2671/mysqld
     37tcp        0      0 *:mysql                 *:*                     LISTEN      21678/mysqld
    3538}}}
    3639
     
    3841
    3942使用指令[[BR]]
    40 ''rider@ocean:~$ sudo mysqladmin -u root password yourrootsqlpassword''[[BR]]
     43''root@ocean:~$ mysqladmin -u root password yourrootsqlpassword''[[BR]]
     44
     45'''/* @Master1 */''' [[BR]]
     46
     47'''步驟六 :''' 設定 root@master1.nchc.org.tw的MySQL使用者密碼
     48
     49使用指令[[BR]]
     50''root@ocean:~$ mysqladmin -h master1.nchc.org.tw -u root password yourrootsqlpassword''[[BR]]
     51
     52'''步驟七 :''' 設定一組同步使用者 slave2_user 給 Master2 能存取 Master1 的MySQL 資料庫的權限
     53
     54使用指令[[BR]]
     55''root@ocean:~$ mysql -u root -p''[[BR]] -> 登入MySQL
     56
     57''Enter password: rootmysqlpasswd''[[BR]] -> 輸入root 的 MySQL 登入密碼
     58
     59''GRANT REPLICATION SLAVE ON *.* TO 'slave2_user'@'%' IDENTIFIED BY 'slave2_password';[[BR]]FLUSH PRIVILEGES;[[BR]]quit;[[BR]]'' -> 設定使用者: slave2_user 的同步權限並給予密碼
     60
     61'''/* @Master2 */''' [[BR]]
     62
     63'''步驟八 :''' 設定 root@master2.nchc.org.tw的MySQL使用者密碼,與設定一組同步使用者 slave1_user 給 Master1 能存取 Master2 的MySQL 資料庫的權限(重複步驟六&七: 設定 Master1 MySQL的方法)
     64
     65使用指令[[BR]]
     66
     67''root@ocean:~$ mysqladmin -h master1.nchc.org.tw -u root password yourrootsqlpassword''[[BR]]
     68
     69''root@ocean:~$ mysql -u root -p''[[BR]] -> 登入MySQL
     70
     71''Enter password: rootmysqlpasswd''[[BR]] -> 輸入root 的 MySQL 登入密碼
     72
     73''GRANT REPLICATION SLAVE ON *.* TO 'slave1_user'@'%' IDENTIFIED BY 'slave1_password';[[BR]]FLUSH PRIVILEGES;[[BR]]quit;[[BR]]'' -> 設定使用者: slave1_user 的同步權限並給予密碼
     74
     75=== 注意事項 ===
    4176
    4277
    4378
     79
     80
     81
     82
     83
     84