SlideShare a Scribd company logo
1 of 23
Download to read offline
HA feature of Spider




                  Kentoku SHIBA
     kentokushiba at gmail dot com
Basic structure
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
       Spider's HA structure is composed of
  data nodes, spider nodes and monitoring nodes.
The part of structure

- Data nodes
Data nodes store real data.
Each data node that linked same Spider table store same data.
(like RAID 1)


- Spider nodes
The entrance of user access.
Spider nodes offer load balance, fail over and transparently access to
data node.


- Monitoring nodes
Monitoring nodes monitor data nodes.
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 doesn't monitor.
 1 : It monitors state of connection.
 2 : It monitors state of a table without where clause.
 The default value is 0
Monitoring parameters
- monitoring_kind(mkd)
 The kind of monitoring.
 0 : It doesn't 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
How to set up HA
  without stopping the service
How to set up HA



Spider can set up HA by each table.

     Here, I will explain how to set up HA,
           without stopping service.
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 = Spider
Connection ‘            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.
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.
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.
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_a
Connection ‘
   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.
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.
Finish

                         tbl_a     tbl_a        tbl_a
                         DB2       DB3          DB4
Alter table tbl_a
Connection ‘
   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.
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 table


You need to create a new node, in order to
maintain redundancy, when there is a trouble
at the node that composes the cluster.

  Here, I will explain how to add a table of a
  new node, without stopping the service.
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).
Step 1

     tbl_a             tbl_a   tbl_a     tbl_a
     DB8               DB2     DB3       DB4



Create 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.
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).
Step 3

      tbl_a              tbl_a     tbl_a        tbl_a
       DB8               DB2       DB3          DB4
Alter table tbl_a
Connection ‘
   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.
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.
Finish

      tbl_a              tbl_a     tbl_a        tbl_a
       DB8               DB2       DB3          DB4
Alter table tbl_a
Connection ‘
   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.
Any Questions?


Thank you for taking
    your time!!



  Kentoku SHIBA (kentokushiba at gmail dot com)
  http://wild-growth.blogspot.com/
  http://spiderformysql.com

More Related Content

What's hot

Custom Applications with Spark's RDD: Spark Summit East talk by Tejas Patil
Custom Applications with Spark's RDD: Spark Summit East talk by Tejas PatilCustom Applications with Spark's RDD: Spark Summit East talk by Tejas Patil
Custom Applications with Spark's RDD: Spark Summit East talk by Tejas PatilSpark Summit
 
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜Takahiro Inoue
 
How shit works: the CPU
How shit works: the CPUHow shit works: the CPU
How shit works: the CPUTomer Gabel
 
Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLYoshinori Matsunobu
 
Top NoSQL Data Modeling Mistakes
Top NoSQL Data Modeling MistakesTop NoSQL Data Modeling Mistakes
Top NoSQL Data Modeling MistakesScyllaDB
 
より深く知るオプティマイザとそのチューニング
より深く知るオプティマイザとそのチューニングより深く知るオプティマイザとそのチューニング
より深く知るオプティマイザとそのチューニングYuto Hayamizu
 
基本に戻ってInnoDBの話をします
基本に戻ってInnoDBの話をします基本に戻ってInnoDBの話をします
基本に戻ってInnoDBの話をしますyoku0825
 
Dok Talks #111 - Scheduled Scaling with Dask and Argo Workflows
Dok Talks #111 - Scheduled Scaling with Dask and Argo WorkflowsDok Talks #111 - Scheduled Scaling with Dask and Argo Workflows
Dok Talks #111 - Scheduled Scaling with Dask and Argo WorkflowsDoKC
 
Square Engineering's "Fail Fast, Retry Soon" Performance Optimization Technique
Square Engineering's "Fail Fast, Retry Soon" Performance Optimization TechniqueSquare Engineering's "Fail Fast, Retry Soon" Performance Optimization Technique
Square Engineering's "Fail Fast, Retry Soon" Performance Optimization TechniqueScyllaDB
 
Go, memcached, microservices
Go, memcached, microservicesGo, memcached, microservices
Go, memcached, microservicesmosa siru
 
MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"
MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"
MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"Kentaro Yoshida
 
Conhecendo Apache Cassandra @Movile
Conhecendo Apache Cassandra  @MovileConhecendo Apache Cassandra  @Movile
Conhecendo Apache Cassandra @MovileEiti Kimura
 
Your first ClickHouse data warehouse
Your first ClickHouse data warehouseYour first ClickHouse data warehouse
Your first ClickHouse data warehouseAltinity Ltd
 
Ceph Object Storage Performance Secrets and Ceph Data Lake Solution
Ceph Object Storage Performance Secrets and Ceph Data Lake SolutionCeph Object Storage Performance Secrets and Ceph Data Lake Solution
Ceph Object Storage Performance Secrets and Ceph Data Lake SolutionKaran Singh
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseSeveralnines
 
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep DiveMongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep DiveMongoDB
 
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...Altinity Ltd
 
Concurrency Patterns with MongoDB
Concurrency Patterns with MongoDBConcurrency Patterns with MongoDB
Concurrency Patterns with MongoDBYann Cluchey
 
NoSQL Data Modeling 101
NoSQL Data Modeling 101NoSQL Data Modeling 101
NoSQL Data Modeling 101ScyllaDB
 

What's hot (20)

Custom Applications with Spark's RDD: Spark Summit East talk by Tejas Patil
Custom Applications with Spark's RDD: Spark Summit East talk by Tejas PatilCustom Applications with Spark's RDD: Spark Summit East talk by Tejas Patil
Custom Applications with Spark's RDD: Spark Summit East talk by Tejas Patil
 
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
 
How shit works: the CPU
How shit works: the CPUHow shit works: the CPU
How shit works: the CPU
 
Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQL
 
Top NoSQL Data Modeling Mistakes
Top NoSQL Data Modeling MistakesTop NoSQL Data Modeling Mistakes
Top NoSQL Data Modeling Mistakes
 
より深く知るオプティマイザとそのチューニング
より深く知るオプティマイザとそのチューニングより深く知るオプティマイザとそのチューニング
より深く知るオプティマイザとそのチューニング
 
基本に戻ってInnoDBの話をします
基本に戻ってInnoDBの話をします基本に戻ってInnoDBの話をします
基本に戻ってInnoDBの話をします
 
Dok Talks #111 - Scheduled Scaling with Dask and Argo Workflows
Dok Talks #111 - Scheduled Scaling with Dask and Argo WorkflowsDok Talks #111 - Scheduled Scaling with Dask and Argo Workflows
Dok Talks #111 - Scheduled Scaling with Dask and Argo Workflows
 
Square Engineering's "Fail Fast, Retry Soon" Performance Optimization Technique
Square Engineering's "Fail Fast, Retry Soon" Performance Optimization TechniqueSquare Engineering's "Fail Fast, Retry Soon" Performance Optimization Technique
Square Engineering's "Fail Fast, Retry Soon" Performance Optimization Technique
 
Go, memcached, microservices
Go, memcached, microservicesGo, memcached, microservices
Go, memcached, microservices
 
MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"
MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"
MySQLと組み合わせて始める全文検索プロダクト"elasticsearch"
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
Conhecendo Apache Cassandra @Movile
Conhecendo Apache Cassandra  @MovileConhecendo Apache Cassandra  @Movile
Conhecendo Apache Cassandra @Movile
 
Your first ClickHouse data warehouse
Your first ClickHouse data warehouseYour first ClickHouse data warehouse
Your first ClickHouse data warehouse
 
Ceph Object Storage Performance Secrets and Ceph Data Lake Solution
Ceph Object Storage Performance Secrets and Ceph Data Lake SolutionCeph Object Storage Performance Secrets and Ceph Data Lake Solution
Ceph Object Storage Performance Secrets and Ceph Data Lake Solution
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash Course
 
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep DiveMongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
 
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
 
Concurrency Patterns with MongoDB
Concurrency Patterns with MongoDBConcurrency Patterns with MongoDB
Concurrency Patterns with MongoDB
 
NoSQL Data Modeling 101
NoSQL Data Modeling 101NoSQL Data Modeling 101
NoSQL Data Modeling 101
 

Similar to Spider HA 20100922(DTT#7)

How to migrate_to_sharding_with_spider
How to migrate_to_sharding_with_spiderHow to migrate_to_sharding_with_spider
How to migrate_to_sharding_with_spiderKentoku
 
"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TERyosuke IWANAGA
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Kai Zhao
 
DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2Pranav Prakash
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytWrushabhShirsat3
 
Oracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New FeaturesOracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New FeaturesAlex Zaballa
 
Solving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalizationSolving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalizationdmcfarlane
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: RenormalizeAriel Weil
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: RenormalizeAriel Weil
 
Alternator webinar september 2019
Alternator webinar   september 2019Alternator webinar   september 2019
Alternator webinar september 2019Nadav Har'El
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL ISankhya_Analytics
 
Introducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible API
Introducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible APIIntroducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible API
Introducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible APIScyllaDB
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoDave Stokes
 
Using spider for sharding in production
Using spider for sharding in productionUsing spider for sharding in production
Using spider for sharding in productionKentoku
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018Dave Stokes
 
Data storage systems
Data storage systemsData storage systems
Data storage systemsdelimitry
 

Similar to Spider HA 20100922(DTT#7) (20)

How to migrate_to_sharding_with_spider
How to migrate_to_sharding_with_spiderHow to migrate_to_sharding_with_spider
How to migrate_to_sharding_with_spider
 
"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
 
DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
Ddl vs dml
Ddl vs dmlDdl vs dml
Ddl vs dml
 
MongoDB & PHP
MongoDB & PHPMongoDB & PHP
MongoDB & PHP
 
Oracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New FeaturesOracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New Features
 
Solving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalizationSolving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalization
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: Renormalize
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: Renormalize
 
Alternator webinar september 2019
Alternator webinar   september 2019Alternator webinar   september 2019
Alternator webinar september 2019
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
 
SKILLWISE-DB2 DBA
SKILLWISE-DB2 DBASKILLWISE-DB2 DBA
SKILLWISE-DB2 DBA
 
Introducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible API
Introducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible APIIntroducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible API
Introducing Project Alternator - Scylla’s Open-Source DynamoDB-compatible API
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
 
Using spider for sharding in production
Using spider for sharding in productionUsing spider for sharding in production
Using spider for sharding in production
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018
 
Data storage systems
Data storage systemsData storage systems
Data storage systems
 

More from Kentoku

An issue of all slaves stop replication
An issue of all slaves stop replicationAn issue of all slaves stop replication
An issue of all slaves stop replicationKentoku
 
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほかMariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほかKentoku
 
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介Kentoku
 
Spider storage engine (dec212016)
Spider storage engine (dec212016)Spider storage engine (dec212016)
Spider storage engine (dec212016)Kentoku
 
Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介Kentoku
 
MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721Kentoku
 
Sharding with spider solutions 20160721
Sharding with spider solutions 20160721Sharding with spider solutions 20160721
Sharding with spider solutions 20160721Kentoku
 
Mroonga 20141129
Mroonga 20141129Mroonga 20141129
Mroonga 20141129Kentoku
 
MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218Kentoku
 
Mroonga 20131129
Mroonga 20131129Mroonga 20131129
Mroonga 20131129Kentoku
 
Newest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires ArgentinaNewest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires ArgentinaKentoku
 
Spiderの最新動向 20131009
Spiderの最新動向 20131009Spiderの最新動向 20131009
Spiderの最新動向 20131009Kentoku
 
Spiderの最新動向 20130419
Spiderの最新動向 20130419Spiderの最新動向 20130419
Spiderの最新動向 20130419Kentoku
 
Mroonga 20121129
Mroonga 20121129Mroonga 20121129
Mroonga 20121129Kentoku
 
Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Kentoku
 
Introducing mroonga 20111129
Introducing mroonga 20111129Introducing mroonga 20111129
Introducing mroonga 20111129Kentoku
 
hs_spider_hs_something_20110906
hs_spider_hs_something_20110906hs_spider_hs_something_20110906
hs_spider_hs_something_20110906Kentoku
 
Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)Kentoku
 
Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)Kentoku
 
Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2Kentoku
 

More from Kentoku (20)

An issue of all slaves stop replication
An issue of all slaves stop replicationAn issue of all slaves stop replication
An issue of all slaves stop replication
 
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほかMariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
 
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
 
Spider storage engine (dec212016)
Spider storage engine (dec212016)Spider storage engine (dec212016)
Spider storage engine (dec212016)
 
Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介
 
MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721
 
Sharding with spider solutions 20160721
Sharding with spider solutions 20160721Sharding with spider solutions 20160721
Sharding with spider solutions 20160721
 
Mroonga 20141129
Mroonga 20141129Mroonga 20141129
Mroonga 20141129
 
MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218
 
Mroonga 20131129
Mroonga 20131129Mroonga 20131129
Mroonga 20131129
 
Newest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires ArgentinaNewest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires Argentina
 
Spiderの最新動向 20131009
Spiderの最新動向 20131009Spiderの最新動向 20131009
Spiderの最新動向 20131009
 
Spiderの最新動向 20130419
Spiderの最新動向 20130419Spiderの最新動向 20130419
Spiderの最新動向 20130419
 
Mroonga 20121129
Mroonga 20121129Mroonga 20121129
Mroonga 20121129
 
Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129
 
Introducing mroonga 20111129
Introducing mroonga 20111129Introducing mroonga 20111129
Introducing mroonga 20111129
 
hs_spider_hs_something_20110906
hs_spider_hs_something_20110906hs_spider_hs_something_20110906
hs_spider_hs_something_20110906
 
Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)
 
Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)
 
Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2
 

Spider HA 20100922(DTT#7)

  • 1. HA feature of Spider Kentoku SHIBA kentokushiba at gmail dot com
  • 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 Spider's HA structure is composed of data nodes, spider nodes and monitoring nodes.
  • 4. The part of structure - Data nodes Data nodes store real data. Each data node that linked same Spider table store same data. (like RAID 1) - Spider nodes The entrance of user access. Spider nodes offer load balance, fail over and transparently access to data node. - Monitoring nodes Monitoring nodes monitor data nodes.
  • 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 doesn't monitor. 1 : It monitors state of connection. 2 : It monitors state of a table without where clause. The default value is 0
  • 6. Monitoring parameters - monitoring_kind(mkd) The kind of monitoring. 0 : It doesn't 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. How to set up HA without stopping the service
  • 8. How to set up HA Spider can set up HA by each table. Here, I will explain how to set up HA, without stopping service.
  • 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 = Spider Connection ‘ 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. 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. 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. 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_a Connection ‘ 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. 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. Finish tbl_a tbl_a tbl_a DB2 DB3 DB4 Alter table tbl_a Connection ‘ 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. How to add new node after failover and preparing new server without stopping the service
  • 16. Create a table of a new node to the clustered table You need to create a new node, in order to maintain redundancy, when there is a trouble at the node that composes the cluster. Here, I will explain how to add a table of a new node, without stopping the service.
  • 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. Step 1 tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4 Create 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. 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. Step 3 tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4 Alter table tbl_a Connection ‘ 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. 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. Finish tbl_a tbl_a tbl_a tbl_a DB8 DB2 DB3 DB4 Alter table tbl_a Connection ‘ 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. Any Questions? Thank you for taking your time!! Kentoku SHIBA (kentokushiba at gmail dot com) http://wild-growth.blogspot.com/ http://spiderformysql.com