HA feature of Spider                  Kentoku SHIBA     kentokushiba at gmail dot com
Basic structure
Basic structure             tbl_a      tbl_a             tbl_a             DB11       DB12              DB13              ...
The part of structure- Data nodesData nodes store real data.Each data node that linked same Spider table store same data.(...
Monitoring parameters- monitoring_bg_interval(mbi) Interval of background monitoring.(microsecond) The default value is 10...
Monitoring parameters- monitoring_kind(mkd) The kind of monitoring. 0 : It doesnt monitor. 1 : It monitors state of connec...
How to set up HA  without stopping the service
How to set up HASpider can set up HA by each table.     Here, I will explain how to set up HA,           without stopping ...
Initial Structure                        tbl_a   Create table tbl_a (                                  col_a int,         ...
Step 1           tbl_a     tbl_a              tbl_a            DB2      DB3                 DB4           tbl_a           ...
Step 2            tbl_a     tbl_a     tbl_a            DB2       DB3       DB4                                   Create ta...
Step 3     insert into mysql.spider_link_mon_servers     (db_name, table_name, link_id, sid, server, scheme, host, port, s...
Step 4           tbl_a         tbl_a                      tbl_a           DB2            DB3                       DB4    ...
Finish                         tbl_a     tbl_a        tbl_a                         DB2       DB3          DB4Alter table ...
How to add new node   after failover    and preparing new server   without stopping the service
Create a table of a new node to the clustered tableYou need to create a new node, in order tomaintain redundancy, when the...
Initial Structure               tbl_a         tbl_a        tbl_a                DB2          DB3           DB4            ...
Step 1     tbl_a             tbl_a   tbl_a     tbl_a     DB8               DB2     DB3       DB4Create table tbl_a (   tbl...
Step 2  tbl_a       tbl_a      tbl_a     tbl_a  DB8          DB2       DB3       DB4                                      ...
Step 3      tbl_a              tbl_a     tbl_a        tbl_a       DB8               DB2       DB3          DB4Alter table ...
Step 4  tbl_a      tbl_a         tbl_a                      tbl_a  DB8        DB2            DB3                       DB4...
Finish      tbl_a              tbl_a     tbl_a        tbl_a       DB8               DB2       DB3          DB4Alter table ...
Any Questions?Thank you for taking    your time!!  Kentoku SHIBA (kentokushiba at gmail dot com)  http://wild-growth.blogs...
Upcoming SlideShare
Loading in …5
×

Spider HA 20100922(DTT#7)

5,675 views

Published on

Introducing HA feature of Spider

2 Comments
4 Likes
Statistics
Notes
No Downloads
Views
Total views
5,675
On SlideShare
0
From Embeds
0
Number of Embeds
2,649
Actions
Shares
0
Downloads
47
Comments
2
Likes
4
Embeds 0
No embeds

No notes for slide

Spider HA 20100922(DTT#7)

  1. 1. HA feature of Spider Kentoku SHIBA kentokushiba at gmail dot com
  2. 2. Basic structure
  3. 3. Basic structure tbl_a tbl_a tbl_a DB11 DB12 DB13 Data nodes tbl_a DB7 tbl_a DB7 DB6 DB6 DB1 DB21 Spider nodes Monitoring nodes Spiders HA structure is composed of data nodes, spider nodes and monitoring nodes.
  4. 4. The part of structure- Data nodesData nodes store real data.Each data node that linked same Spider table store same data.(like RAID 1)- Spider nodesThe entrance of user access.Spider nodes offer load balance, fail over and transparently access todata node.- Monitoring nodesMonitoring nodes monitor data nodes.
  5. 5. Monitoring parameters- monitoring_bg_interval(mbi) Interval of background monitoring.(microsecond) The default value is 10000000- monitoring_bg_kind(mbk) The kind of background monitoring. 0 : It doesnt monitor. 1 : It monitors state of connection. 2 : It monitors state of a table without where clause. The default value is 0
  6. 6. Monitoring parameters- monitoring_kind(mkd) The kind of monitoring. 0 : It doesnt monitor. 1 : It monitors state of connection. 2 : It monitors state of a table without where clause. The default value is 0- monitoring_limit(mlt) The limititation of records at monitoring table. (Only when monitoring_kind is bigger than 1, it is effective.) 0 or more : Number of limitation. The default value is 1- monitoring_server_id(msi) The server_id of monitoring MySQL server. The default value is self server_id
  7. 7. How to set up HA without stopping the service
  8. 8. How to set up HASpider can set up HA by each table. Here, I will explain how to set up HA, without stopping service.
  9. 9. Initial Structure tbl_a Create table tbl_a ( col_a int, DB2 col_b int, primary key(col_a)Create table tbl_a ( ) engine = InnoDB; col_a int, col_b int, primary key(col_a)) engine = SpiderConnection ‘ tbl_a table “tbl_a”, user “user”, password “pass”, DB1 host “DB2”‘; There are 1 MySQL server with Spider and 1 remote MySQL server without Spider.
  10. 10. Step 1 tbl_a tbl_a tbl_a DB2 DB3 DB4 tbl_a Create table tbl_a ( col_a int, DB1 col_b int, primary key(col_a) ) engine = InnoDB;Add new data nodes(DB3 and DB4) and tables.
  11. 11. Step 2 tbl_a tbl_a tbl_a DB2 DB3 DB4 Create table tbl_a ( col_a int, col_b int, primary key(col_a) ) engine = Spider tbl_a Connection ‘ table “tbl_a”, DB1 tbl_a DB7 user “user”, password “pass”, DB6 host “DB2 DB3 DB4” DB5 ‘; Add new monitoring nodes (DB5, DB6, DB7) and tables.
  12. 12. Step 3 insert into mysql.spider_link_mon_servers (db_name, table_name, link_id, sid, server, scheme, host, port, socket, username, password) values tbl_a tbl_a tbl_a (db_name, tbl_a, 0, DB5_sid, null, mysql, DB5, 3306, null, user, pass‘), (db_name, tbl_a, 0, DB6_sid, null, mysql, DB6, 3306, null, user, pass‘), DB2 DB3 DB4 (db_name, tbl_a, 0, DB7_sid, null, mysql, DB7, 3306, null, user, pass‘);Alter table tbl_aConnection ‘ table “tbl_a”, user “user”, password “pass”, host “DB2 DB3 DB4”, tbl_a mbk “2”, mkd “2”, msi “DB5_sid”, DB1 tbl_a DB7 link_status “0 2 2” DB6‘; DB5 Register monitornig node information to MySQL servers with Spider. Then alter table on DB1.
  13. 13. Step 4 tbl_a tbl_a tbl_a DB2 DB3 DB4 tbl_a Select spider_copy_tables(‘tbl_a’, ‘’, ‘’); DB1 tbl_a DB7 DB6 DB5 Copy data from DB2 to DB3 and DB4.
  14. 14. Finish tbl_a tbl_a tbl_a DB2 DB3 DB4Alter table tbl_aConnection ‘ table “tbl_a”, user “user”, password “pass”, host “DB2 DB3 DB4”, tbl_a mbk “2”, mkd “2”, msi “DB5_sid”, link_status “0 1 1” DB1 tbl_a DB7‘; DB6 DB5 Alter table on DB1.
  15. 15. How to add new node after failover and preparing new server without stopping the service
  16. 16. Create a table of a new node to the clustered tableYou need to create a new node, in order tomaintain redundancy, when there is a troubleat the node that composes the cluster. Here, I will explain how to add a table of a new node, without stopping the service.
  17. 17. Initial Structure tbl_a tbl_a tbl_a DB2 DB3 DB4 tbl_a DB1 tbl_a DB7 DB6 DB5 There are 4 MySQL servers with Spider (include 3 monitoring nodes) and 3 MySQL servers without Spider (including 1 broken node).
  18. 18. Step 1 tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4Create table tbl_a ( tbl_a col_a int, col_b int, DB1 tbl_a DB7 primary key(col_a) DB6) engine = InnoDB; DB5 Add new data node(DB8) and table.
  19. 19. Step 2 tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4 Alter table tbl_a tbl_a Connection ‘ table “tbl_a”, user “user”, DB1 tbl_a DB7 password “pass”, DB6 host “DB2 DB4 DB8” DB5 ‘; Alter table on monitoring nodes (DB5, DB6 and DB7).
  20. 20. Step 3 tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4Alter table tbl_aConnection ‘ table “tbl_a”, user “user”, password “pass”, host “DB2 DB4 DB8”, tbl_a mbk “2”, mkd “2”, msi “DB5_sid”, DB1 tbl_a DB7 link_status “0 0 2” DB6‘; DB5 Alter table on DB1.
  21. 21. Step 4 tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4 tbl_a Select spider_copy_tables(‘tbl_a’, ‘’, ‘’); DB1 tbl_a DB7 DB6 DB5 Copy data from DB2 to DB8.
  22. 22. Finish tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4Alter table tbl_aConnection ‘ table “tbl_a”, user “user”, password “pass”, host “DB2 DB4 DB8”, tbl_a mbk “2”, mkd “2”, msi “DB5_sid”, DB1 tbl_a DB7 link_status “0 0 1” DB6‘; DB5 Alter table on DB1.
  23. 23. Any Questions?Thank you for taking your time!! Kentoku SHIBA (kentokushiba at gmail dot com) http://wild-growth.blogspot.com/ http://spiderformysql.com

×