SlideShare uma empresa Scribd logo
1 de 52
Baixar para ler offline
Tungsten University:
                      Unleashing the Power of
                         Tungsten Connectors
                   Gilles Rayrat, Director of Operations/France



©Continuent 2013
What is Tungsten Connector?




                       Native
                      protocol
               App     COM_QUERY
                      COM_INIT_DB
                      COM_DROP_DB

                                    Connector




©Continuent 2013                      2
A Key Tungsten Component


               •   Provide access to the master


               •   Handle database failures


               •   Can access slaves for reads




©Continuent 2013                       3
Deployments




©Continuent 2013         4
Deployment 1: app servers
                   App Server    App Server    App Server    App Server    App Server
                   + Connector   + Connector   + Connector   + Connector   + Connector




©Continuent 2013                                  5
Deployment 2: database servers
                   App Server   App Server   App Server         App Server   App Server   App Server


                                                          ...


                                             Software Load Balancer




©Continuent 2013                                          6
Deployment 3: dedicated hosts
                   App Server   App Server   App Server           App Server   App Server   App Server


                                                          ...


                                             Hardware Load Balancer

                                                                ...




©Continuent 2013                                          7
Deployment best practice


                   Install with port 3306!


                   tools/tpm con!gure <data service name>
                     <options>
                     --connector-listen-port=3306




©Continuent 2013                             8
Closer view


               •   Performance


               •   Failure handling




©Continuent 2013                      9
Packet Streaming

               •   Fast operations, Low overhead

               •   Full transparency


                       Protocol packet
                            COM_QUERY
                         select * from t




           App
                                           Connector
                                                        Protocol packet
                                                                 OK
                                                          ResultSet Rows:1




©Continuent 2013                                   10
Closer view


               •   Performance


               •   Failure handling




©Continuent 2013                      11
Connector-Manager link

                                                App Logic                         App Logic
                                            Tungsten Connector                Tungsten Connector




                                                                                                   Monitoring and control
                   Monitoring and control




                                               Manager            Manager            Manager

                                               Replicator        Replicator          Replicator


                                               Slave             Master              Slave

©Continuent 2013                                                    12
Node Failure

                    “Pause” incoming connection requests
                                      +




               Planned switch:               Unplanned Failover:
              wait for disconnect            break connections
                                         +
                   Transparent retry (autocommit tx only)


©Continuent 2013                    13
Demo?



                            u1                  u3


                            u2                  u4
                   europe                asia

                                 world

©Continuent 2013                   14
Installation

               •   tools/tpm con!gure <data service name>
                   <options>
                   --dataservice-connectors=node1,node2,...


               •   --connector-listen-port
                   --connector-user
                   --connector-password
                   --connector-smartscale=true


               •   tools/tpm help con!gure
©Continuent 2013                      15
Specifying Users




               •   --connector-user=user1


               •   additional users in
                    tungsten-connector/conf/user.map




©Continuent 2013                         16
user map

  <user> <password> <data service> [<preferred site>]


  tungsten_testing private world europe
  myuser p4$$ asia
  alice - othersvc



  No need to restart

©Continuent 2013           17
Connection Protocol




                         version #, ..., salt

                   App    Database, user,
                         Salted password




©Continuent 2013                 18
A Man in the Middle




                         Connector


                   App
                                     ?

©Continuent 2013              19
Clear text passwords
                   •   Workaround:
                       @script /opt/continuent/share/gen_user_map.sh




                   •   output identical to regular user.map


                   •   Can be any script: SQL requests, encrypting, etc.


                   •   Accepts parameters




©Continuent 2013                             20
Application con!guration




©Continuent 2013            21
Application con!guration - PHP
                   <?php

                   $host = “u1”; 

                   $port = 9999;

                   $username = “tungsten_testing”;

                   $password = “secret_private”;

                   $dbname = “myapp";

                   $connection = mysqli_connect($host, $username,
                   $password, $dbname, $port);

                   ......... More application logic here .........

                   ?>


©Continuent 2013                           22
Application con!guration - Java

               •   Hibernate
                   hibernate.connection.url=jdbc:mysql://u1:9999/mydb


               •   JBoss
                   <connection-url>jdbc:mysql://u1:9999/database</
                   connection-url>


               •   JDBC
                   jdbc:mysql://u1:9999/dbname




©Continuent 2013                         23
Application con!guration - Ruby on
           Rails
                   prod:

                     adapter: mysql2

                     encoding: utf8

                     database: my_db_name

                     username: tungsten_testing

                     password: private

                     host: u1

                     port: 9999




©Continuent 2013                            24
Read/write splitting


               •   Automatic


               •   Application Controlled




©Continuent 2013                      25
Automatic R/W splitting


               •   No application changes


               •   Only outside transaction boundaries


               •   2 variants:
                   •   Smart Scale

                   •   @direct connections


©Continuent 2013                             26
Automatic R/W splitting - smartScale



               •   AKA ‘session consistency’ QoS


               •   Ability to see session’s writes




©Continuent 2013                        27
SmartScale
                                                   Master   Transaction
                                                   DBMS     History Log




                   write
                                       Session x
       App                             Session y
                                       ...
                                                                       Slave
                                                                      replay
                           Connector                                 position

                                                   Slave
                                                   DBMS



©Continuent 2013                  28
SmartScale
                                                  Master   Transaction
                                                  DBMS     History Log



                   read

                                      Session x
       App

                          Connector                                   Slave
                                                                     replay
                                                                    position

                                                  Slave
                                                  DBMS



©Continuent 2013                 29
SmartScale
                                                  Master   Transaction
                                                  DBMS     History Log



                   read

                                      Session x
       App

                          Connector                                   Slave
                                                                     replay
                                                                    position

                                                  Slave
                                                  DBMS



©Continuent 2013                 30
SmartScale

               •   Enabling:


          tpm configure <data service name>
                        <other options>
                        --connector-smartscale=true
                        --connector-smartscale-sessionid=
                               DATABASE |
                               USER |
                               CONNECTION |
                               PROVIDED_IN_DBNAME



©Continuent 2013               31
SmartScale


               •   Choose you sessionId:
                   •   PROVIDED_IN_DBNAME (++)
                       => set dbname to ”mydb?sessionId=12345”

                   •   CONNECTION (+)

                   •   USER (-)

                   •   DATABASE (--)




©Continuent 2013                          32
Demo?




©Continuent 2013   33
SmartScale


                   Limitations:


                   •   single connector instance


                   •   select function_that_writes();


                   •   ephemeral SQL objects




©Continuent 2013                             34
SmartScale


                   Trade-o":


                   •   Can read outdated data from other sessions


                   •   Poor e!ciency in write intensive environments




©Continuent 2013                           35
Automatic R/W splitting - directReads


               •   Blind R/W splitting

               •   Fast


               •   Similar limitations:
                   •   ephemeral SQL objects

                   •   select function_that_writes();

                   •   Reads potentially outdated data



©Continuent 2013                             36
DirectReads

               •   Enabling
                   tpm configure <ds> <opts>
                         --connector-rwsplitting=true

               •   Other users in user.map
                   @direct user2
                   @direct user3



               •   Can be backed by a c3p0 pool



©Continuent 2013                      37
Read/write splitting


               •   Automatic


               •   Application Controlled




©Continuent 2013                      38
Application-driven R/W splitting

               •   More e#cient...

               •   ...but potentially dangerous


               •   3 possibilities:
                   •   SQL comments

                   •   QoS in database name

                   •   @hostoption




©Continuent 2013                          39
Selective R/W Splitting

               •   Must enable directReads

                   tpm update ...
                   --connector-rwsplitting=true 
                   --property=selective.rwsplitting=true



               •   Embedded SQL comment:
         !!! mysql -u... -c


         /* TUNGSTEN_URL_PROPERTY=qos=RO_RELAXED */select @@hostname;



©Continuent 2013                      40
Demo?




©Continuent 2013   41
QoS at connection time


           •       No connector con!guration change


           •       connect to “mydb@qos=RO_RELAXED”




©Continuent 2013                      42
Demo?




©Continuent 2013   43
Host-based routing


           •       /etc/hosts
                   127.0.0.1 master.localhost
                   127.0.0.2 slave.localhost

           •       tpm configure <data service name> <other options>
                           --connector-rw-addresses=master.localhost
                           --connector-ro-addresses=slave.localhost




©Continuent 2013                           44
Demo?




©Continuent 2013   45
SOR (multi site)

                   •   Getting a local slave


     <user> <password> <data service> [<preferred site>]


     tungsten_testing private world europe




©Continuent 2013                          46
Demo?




©Continuent 2013   47
Performance

                   •   Pool for DirectReads
                       tpm configure <ds> <opts>
                          --connector-rwsplitting=true
                          --property=directReadsUsePool=true

                   •
          JDBC driver
--property=jdbc.driver.options=

cacheServerCon!guration=true&characterSetResults=UTF8
                       https://docs.continuent.com/wiki/display/
                       TEDOC/Improving+Connection+Speed


©Continuent 2013                        48
Getting connector information

               •   “tungsten connection status” for last request
     mysql> tungsten connection status;
     +---------------------------------------------------------------+
     | message                                                       |
     +---------------------------------------------------------------+
     | internal(OPEN) DIRECT TO u1@default(master:ONLINE) STATUS(OK) |
     +---------------------------------------------------------------+
     1 row in set (0.01 sec)




               •   “tungsten show processlist” for real client
                   addresses
     mysql> tungsten show processlist;
     +------------+------+----------+-----------+----------+---------+------+-------+------+
     | DataSource | Id   | User     | Host      | db       | Command | Time | State | Info |
     +------------+------+----------+-----------+----------+---------+------+-------+------+
     | u1         | 1342 | tungsten | mac:64477 | tungsten | Sleep   |   20 |       | NULL |
     +------------+------+----------+-----------+----------+---------+------+-------+------+
     1 row in set (0.13 sec)




©Continuent 2013                                             49
Troubleshooting


               •   tungsten-connector/log/connector.log


               •   Lots of connections in TIME_WAIT state

               •   Too many open !les

               •   OutOfMemory error

               •   New connections hanging



©Continuent 2013                        50
Tungsten University Sessions

           •       Manage multi-master or fan-in replication
                   topologies - March 7th & 12th

           •       Zero-downtime maintenance and schema
                   operations - March 21st & 26th

           •       Geographically distributed MySQL clusters -
                   April 11th & 16th

           •       Replicate between MySQL and Oracle -
                   May 2nd & 7th



©Continuent 2013                        51
560 S. Winchester Blvd., Suite 500     Our Blogs:
San Jose, CA 95128                     http://scale-out-blog.blogspot.com
Tel +1 (866) 998-3642                  http://datacharmer.org/blog
Fax +1 (408) 668-1009                  http://www.continuent.com/news/blogs
e-mail: sales@continuent.com



                              Continuent Web Page:
                           http://www.continuent.com

                             Tungsten Replicator 2.0:
                   http://code.google.com/p/tungsten-replicator

©Continuent 2013

Mais conteúdo relacionado

Semelhante a Tungsten University: Unleashing the Power of Tungsten Connectors

Tungsten University: Configure and provision Tungsten clusters
Tungsten University: Configure and provision Tungsten clustersTungsten University: Configure and provision Tungsten clusters
Tungsten University: Configure and provision Tungsten clustersContinuent
 
Building Tungsten Clusters with PostgreSQL Hot Standby and Streaming Replication
Building Tungsten Clusters with PostgreSQL Hot Standby and Streaming ReplicationBuilding Tungsten Clusters with PostgreSQL Hot Standby and Streaming Replication
Building Tungsten Clusters with PostgreSQL Hot Standby and Streaming ReplicationLinas Virbalas
 
Tungsten University: Geographically Distributed Multi-Master MySQL Clusters
Tungsten University: Geographically Distributed Multi-Master MySQL ClustersTungsten University: Geographically Distributed Multi-Master MySQL Clusters
Tungsten University: Geographically Distributed Multi-Master MySQL ClustersContinuent
 
Tungsten University: Setup and Operate Tungsten Replicators
Tungsten University: Setup and Operate Tungsten ReplicatorsTungsten University: Setup and Operate Tungsten Replicators
Tungsten University: Setup and Operate Tungsten ReplicatorsContinuent
 
OpenStack Summit Portland April 2013 talk - Quantum and EC2
OpenStack Summit Portland April 2013 talk - Quantum and EC2OpenStack Summit Portland April 2013 talk - Quantum and EC2
OpenStack Summit Portland April 2013 talk - Quantum and EC2Naveen Joy
 
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...InfluxData
 
Living the Easy Life with Rules-Based Autonomic Database Clusters
Living the Easy Life with Rules-Based Autonomic Database ClustersLiving the Easy Life with Rules-Based Autonomic Database Clusters
Living the Easy Life with Rules-Based Autonomic Database ClustersLinas Virbalas
 
Managing application performance for cloud apps bmc
Managing application performance for cloud apps bmcManaging application performance for cloud apps bmc
Managing application performance for cloud apps bmcKhazret Sapenov
 
Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)Michael Elder
 
Database Performance With Proxy Architectures
Database  Performance With  Proxy  ArchitecturesDatabase  Performance With  Proxy  Architectures
Database Performance With Proxy ArchitecturesPerconaPerformance
 
SDC SR2 2013 - RCP Software Delivery
SDC SR2 2013 - RCP Software Delivery SDC SR2 2013 - RCP Software Delivery
SDC SR2 2013 - RCP Software Delivery Genuitec, LLC
 
Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...
Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...
Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...Continuent
 
Realizing Parallelism and Transparency in Applications through Idempotence
Realizing Parallelism and Transparency in Applications through IdempotenceRealizing Parallelism and Transparency in Applications through Idempotence
Realizing Parallelism and Transparency in Applications through IdempotenceKarthik Sankar
 
2596 - Integrating PureApplication System Into Your Network
2596 - Integrating PureApplication System Into Your Network2596 - Integrating PureApplication System Into Your Network
2596 - Integrating PureApplication System Into Your NetworkHendrik van Run
 
Improving Software Delivery with DevOps & Software Defined Environments
Improving Software Delivery with DevOps & Software Defined EnvironmentsImproving Software Delivery with DevOps & Software Defined Environments
Improving Software Delivery with DevOps & Software Defined EnvironmentsMichael Elder
 
Distributed application usecase on docker
Distributed application usecase on dockerDistributed application usecase on docker
Distributed application usecase on dockerHiroshi Miura
 
Migration & upgrades best practice upgrade pathways to emc documentum 7
Migration & upgrades   best practice upgrade pathways to emc documentum 7Migration & upgrades   best practice upgrade pathways to emc documentum 7
Migration & upgrades best practice upgrade pathways to emc documentum 7Haytham Ghandour
 

Semelhante a Tungsten University: Unleashing the Power of Tungsten Connectors (20)

Tungsten University: Configure and provision Tungsten clusters
Tungsten University: Configure and provision Tungsten clustersTungsten University: Configure and provision Tungsten clusters
Tungsten University: Configure and provision Tungsten clusters
 
Building Tungsten Clusters with PostgreSQL Hot Standby and Streaming Replication
Building Tungsten Clusters with PostgreSQL Hot Standby and Streaming ReplicationBuilding Tungsten Clusters with PostgreSQL Hot Standby and Streaming Replication
Building Tungsten Clusters with PostgreSQL Hot Standby and Streaming Replication
 
Tungsten University: Geographically Distributed Multi-Master MySQL Clusters
Tungsten University: Geographically Distributed Multi-Master MySQL ClustersTungsten University: Geographically Distributed Multi-Master MySQL Clusters
Tungsten University: Geographically Distributed Multi-Master MySQL Clusters
 
Tungsten University: Setup and Operate Tungsten Replicators
Tungsten University: Setup and Operate Tungsten ReplicatorsTungsten University: Setup and Operate Tungsten Replicators
Tungsten University: Setup and Operate Tungsten Replicators
 
OpenStack Summit Portland April 2013 talk - Quantum and EC2
OpenStack Summit Portland April 2013 talk - Quantum and EC2OpenStack Summit Portland April 2013 talk - Quantum and EC2
OpenStack Summit Portland April 2013 talk - Quantum and EC2
 
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
 
Performance vision Version 2.15 news
Performance vision Version 2.15 newsPerformance vision Version 2.15 news
Performance vision Version 2.15 news
 
Living the Easy Life with Rules-Based Autonomic Database Clusters
Living the Easy Life with Rules-Based Autonomic Database ClustersLiving the Easy Life with Rules-Based Autonomic Database Clusters
Living the Easy Life with Rules-Based Autonomic Database Clusters
 
Managing application performance for cloud apps bmc
Managing application performance for cloud apps bmcManaging application performance for cloud apps bmc
Managing application performance for cloud apps bmc
 
Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)
 
Database Performance With Proxy Architectures
Database  Performance With  Proxy  ArchitecturesDatabase  Performance With  Proxy  Architectures
Database Performance With Proxy Architectures
 
SDC SR2 2013 - RCP Software Delivery
SDC SR2 2013 - RCP Software Delivery SDC SR2 2013 - RCP Software Delivery
SDC SR2 2013 - RCP Software Delivery
 
Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...
Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...
Harnessing the Power of Master/Slave Clusters to Operate Data-Driven Business...
 
Automation of end-to-end QOS
Automation of end-to-end QOSAutomation of end-to-end QOS
Automation of end-to-end QOS
 
Realizing Parallelism and Transparency in Applications through Idempotence
Realizing Parallelism and Transparency in Applications through IdempotenceRealizing Parallelism and Transparency in Applications through Idempotence
Realizing Parallelism and Transparency in Applications through Idempotence
 
X Means Y
X Means YX Means Y
X Means Y
 
2596 - Integrating PureApplication System Into Your Network
2596 - Integrating PureApplication System Into Your Network2596 - Integrating PureApplication System Into Your Network
2596 - Integrating PureApplication System Into Your Network
 
Improving Software Delivery with DevOps & Software Defined Environments
Improving Software Delivery with DevOps & Software Defined EnvironmentsImproving Software Delivery with DevOps & Software Defined Environments
Improving Software Delivery with DevOps & Software Defined Environments
 
Distributed application usecase on docker
Distributed application usecase on dockerDistributed application usecase on docker
Distributed application usecase on docker
 
Migration & upgrades best practice upgrade pathways to emc documentum 7
Migration & upgrades   best practice upgrade pathways to emc documentum 7Migration & upgrades   best practice upgrade pathways to emc documentum 7
Migration & upgrades best practice upgrade pathways to emc documentum 7
 

Mais de Continuent

Tungsten Webinar: v6 & v7 Release Recap, and Beyond
Tungsten Webinar: v6 & v7 Release Recap, and BeyondTungsten Webinar: v6 & v7 Release Recap, and Beyond
Tungsten Webinar: v6 & v7 Release Recap, and BeyondContinuent
 
Continuent Tungsten Value Proposition Webinar
Continuent Tungsten Value Proposition WebinarContinuent Tungsten Value Proposition Webinar
Continuent Tungsten Value Proposition WebinarContinuent
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControl
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControlWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControl
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControlContinuent
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB ClusterWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB ClusterContinuent
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQL
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQLWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQL
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQLContinuent
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera ClusterWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera ClusterContinuent
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS AuroraWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS AuroraContinuent
 
Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...
Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...
Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...Continuent
 
Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...
Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...
Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...Continuent
 
Webinar Slides: Intelligent Database Proxies: Routing & Transparent Failover
Webinar Slides: Intelligent Database Proxies: Routing & Transparent FailoverWebinar Slides: Intelligent Database Proxies: Routing & Transparent Failover
Webinar Slides: Intelligent Database Proxies: Routing & Transparent FailoverContinuent
 
Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...
Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...
Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...Continuent
 
Training Slides: 205 - Installing and Configuring Tungsten Dashboard
Training Slides: 205 - Installing and Configuring Tungsten DashboardTraining Slides: 205 - Installing and Configuring Tungsten Dashboard
Training Slides: 205 - Installing and Configuring Tungsten DashboardContinuent
 
Training Slides: 352 - Tungsten Replicator for MongoDB & Kafka
Training Slides: 352 - Tungsten Replicator for MongoDB & KafkaTraining Slides: 352 - Tungsten Replicator for MongoDB & Kafka
Training Slides: 352 - Tungsten Replicator for MongoDB & KafkaContinuent
 
Training Slides: 351 - Tungsten Replicator for Data Warehouses
Training Slides: 351 - Tungsten Replicator for Data WarehousesTraining Slides: 351 - Tungsten Replicator for Data Warehouses
Training Slides: 351 - Tungsten Replicator for Data WarehousesContinuent
 
Training Slides: 303 - Replicating out of a Cluster
Training Slides: 303 - Replicating out of a ClusterTraining Slides: 303 - Replicating out of a Cluster
Training Slides: 303 - Replicating out of a ClusterContinuent
 
Training Slides: 206 - Using the Tungsten Cluster AMI
Training Slides: 206 - Using the Tungsten Cluster AMITraining Slides: 206 - Using the Tungsten Cluster AMI
Training Slides: 206 - Using the Tungsten Cluster AMIContinuent
 
Training Slides: 254 - Using the Tungsten Replicator AMI
Training Slides: 254 - Using the Tungsten Replicator AMITraining Slides: 254 - Using the Tungsten Replicator AMI
Training Slides: 254 - Using the Tungsten Replicator AMIContinuent
 
Training Slides: 253 - Filter like a Pro
Training Slides: 253 - Filter like a ProTraining Slides: 253 - Filter like a Pro
Training Slides: 253 - Filter like a ProContinuent
 
Training Slides: 252 - Monitoring & Troubleshooting
Training Slides: 252 - Monitoring & TroubleshootingTraining Slides: 252 - Monitoring & Troubleshooting
Training Slides: 252 - Monitoring & TroubleshootingContinuent
 
Training Slides: 302 - Securing Your Cluster With SSL
Training Slides: 302 - Securing Your Cluster With SSLTraining Slides: 302 - Securing Your Cluster With SSL
Training Slides: 302 - Securing Your Cluster With SSLContinuent
 

Mais de Continuent (20)

Tungsten Webinar: v6 & v7 Release Recap, and Beyond
Tungsten Webinar: v6 & v7 Release Recap, and BeyondTungsten Webinar: v6 & v7 Release Recap, and Beyond
Tungsten Webinar: v6 & v7 Release Recap, and Beyond
 
Continuent Tungsten Value Proposition Webinar
Continuent Tungsten Value Proposition WebinarContinuent Tungsten Value Proposition Webinar
Continuent Tungsten Value Proposition Webinar
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControl
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControlWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControl
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #7: ClusterControl
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB ClusterWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQL
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQLWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQL
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #4: MS Azure Database MySQL
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera ClusterWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #2: Galera Cluster
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS AuroraWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
 
Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...
Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...
Webinar Slides: AWS Aurora MySQL Replacement: Break Away From Geo-Limitations...
 
Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...
Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...
Webinar Slides: No Data Loss MySQL: Guaranteed Credit Card Transaction Availa...
 
Webinar Slides: Intelligent Database Proxies: Routing & Transparent Failover
Webinar Slides: Intelligent Database Proxies: Routing & Transparent FailoverWebinar Slides: Intelligent Database Proxies: Routing & Transparent Failover
Webinar Slides: Intelligent Database Proxies: Routing & Transparent Failover
 
Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...
Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...
Webinar Slides: High Volume MySQL HA: SaaS Continuous Operations with Terabyt...
 
Training Slides: 205 - Installing and Configuring Tungsten Dashboard
Training Slides: 205 - Installing and Configuring Tungsten DashboardTraining Slides: 205 - Installing and Configuring Tungsten Dashboard
Training Slides: 205 - Installing and Configuring Tungsten Dashboard
 
Training Slides: 352 - Tungsten Replicator for MongoDB & Kafka
Training Slides: 352 - Tungsten Replicator for MongoDB & KafkaTraining Slides: 352 - Tungsten Replicator for MongoDB & Kafka
Training Slides: 352 - Tungsten Replicator for MongoDB & Kafka
 
Training Slides: 351 - Tungsten Replicator for Data Warehouses
Training Slides: 351 - Tungsten Replicator for Data WarehousesTraining Slides: 351 - Tungsten Replicator for Data Warehouses
Training Slides: 351 - Tungsten Replicator for Data Warehouses
 
Training Slides: 303 - Replicating out of a Cluster
Training Slides: 303 - Replicating out of a ClusterTraining Slides: 303 - Replicating out of a Cluster
Training Slides: 303 - Replicating out of a Cluster
 
Training Slides: 206 - Using the Tungsten Cluster AMI
Training Slides: 206 - Using the Tungsten Cluster AMITraining Slides: 206 - Using the Tungsten Cluster AMI
Training Slides: 206 - Using the Tungsten Cluster AMI
 
Training Slides: 254 - Using the Tungsten Replicator AMI
Training Slides: 254 - Using the Tungsten Replicator AMITraining Slides: 254 - Using the Tungsten Replicator AMI
Training Slides: 254 - Using the Tungsten Replicator AMI
 
Training Slides: 253 - Filter like a Pro
Training Slides: 253 - Filter like a ProTraining Slides: 253 - Filter like a Pro
Training Slides: 253 - Filter like a Pro
 
Training Slides: 252 - Monitoring & Troubleshooting
Training Slides: 252 - Monitoring & TroubleshootingTraining Slides: 252 - Monitoring & Troubleshooting
Training Slides: 252 - Monitoring & Troubleshooting
 
Training Slides: 302 - Securing Your Cluster With SSL
Training Slides: 302 - Securing Your Cluster With SSLTraining Slides: 302 - Securing Your Cluster With SSL
Training Slides: 302 - Securing Your Cluster With SSL
 

Tungsten University: Unleashing the Power of Tungsten Connectors

  • 1. Tungsten University: Unleashing the Power of Tungsten Connectors Gilles Rayrat, Director of Operations/France ©Continuent 2013
  • 2. What is Tungsten Connector? Native protocol App COM_QUERY COM_INIT_DB COM_DROP_DB Connector ©Continuent 2013 2
  • 3. A Key Tungsten Component • Provide access to the master • Handle database failures • Can access slaves for reads ©Continuent 2013 3
  • 5. Deployment 1: app servers App Server App Server App Server App Server App Server + Connector + Connector + Connector + Connector + Connector ©Continuent 2013 5
  • 6. Deployment 2: database servers App Server App Server App Server App Server App Server App Server ... Software Load Balancer ©Continuent 2013 6
  • 7. Deployment 3: dedicated hosts App Server App Server App Server App Server App Server App Server ... Hardware Load Balancer ... ©Continuent 2013 7
  • 8. Deployment best practice Install with port 3306! tools/tpm con!gure <data service name> <options> --connector-listen-port=3306 ©Continuent 2013 8
  • 9. Closer view • Performance • Failure handling ©Continuent 2013 9
  • 10. Packet Streaming • Fast operations, Low overhead • Full transparency Protocol packet COM_QUERY select * from t App Connector Protocol packet OK ResultSet Rows:1 ©Continuent 2013 10
  • 11. Closer view • Performance • Failure handling ©Continuent 2013 11
  • 12. Connector-Manager link App Logic App Logic Tungsten Connector Tungsten Connector Monitoring and control Monitoring and control Manager Manager Manager Replicator Replicator Replicator Slave Master Slave ©Continuent 2013 12
  • 13. Node Failure “Pause” incoming connection requests + Planned switch: Unplanned Failover: wait for disconnect break connections + Transparent retry (autocommit tx only) ©Continuent 2013 13
  • 14. Demo? u1 u3 u2 u4 europe asia world ©Continuent 2013 14
  • 15. Installation • tools/tpm con!gure <data service name> <options> --dataservice-connectors=node1,node2,... • --connector-listen-port --connector-user --connector-password --connector-smartscale=true • tools/tpm help con!gure ©Continuent 2013 15
  • 16. Specifying Users • --connector-user=user1 • additional users in tungsten-connector/conf/user.map ©Continuent 2013 16
  • 17. user map <user> <password> <data service> [<preferred site>] tungsten_testing private world europe myuser p4$$ asia alice - othersvc No need to restart ©Continuent 2013 17
  • 18. Connection Protocol version #, ..., salt App Database, user, Salted password ©Continuent 2013 18
  • 19. A Man in the Middle Connector App ? ©Continuent 2013 19
  • 20. Clear text passwords • Workaround: @script /opt/continuent/share/gen_user_map.sh • output identical to regular user.map • Can be any script: SQL requests, encrypting, etc. • Accepts parameters ©Continuent 2013 20
  • 22. Application con!guration - PHP <?php $host = “u1”;  $port = 9999; $username = “tungsten_testing”; $password = “secret_private”; $dbname = “myapp"; $connection = mysqli_connect($host, $username, $password, $dbname, $port); ......... More application logic here ......... ?> ©Continuent 2013 22
  • 23. Application con!guration - Java • Hibernate hibernate.connection.url=jdbc:mysql://u1:9999/mydb • JBoss <connection-url>jdbc:mysql://u1:9999/database</ connection-url> • JDBC jdbc:mysql://u1:9999/dbname ©Continuent 2013 23
  • 24. Application con!guration - Ruby on Rails prod:   adapter: mysql2   encoding: utf8   database: my_db_name   username: tungsten_testing   password: private   host: u1   port: 9999 ©Continuent 2013 24
  • 25. Read/write splitting • Automatic • Application Controlled ©Continuent 2013 25
  • 26. Automatic R/W splitting • No application changes • Only outside transaction boundaries • 2 variants: • Smart Scale • @direct connections ©Continuent 2013 26
  • 27. Automatic R/W splitting - smartScale • AKA ‘session consistency’ QoS • Ability to see session’s writes ©Continuent 2013 27
  • 28. SmartScale Master Transaction DBMS History Log write Session x App Session y ... Slave replay Connector position Slave DBMS ©Continuent 2013 28
  • 29. SmartScale Master Transaction DBMS History Log read Session x App Connector Slave replay position Slave DBMS ©Continuent 2013 29
  • 30. SmartScale Master Transaction DBMS History Log read Session x App Connector Slave replay position Slave DBMS ©Continuent 2013 30
  • 31. SmartScale • Enabling: tpm configure <data service name> <other options> --connector-smartscale=true --connector-smartscale-sessionid= DATABASE | USER | CONNECTION | PROVIDED_IN_DBNAME ©Continuent 2013 31
  • 32. SmartScale • Choose you sessionId: • PROVIDED_IN_DBNAME (++) => set dbname to ”mydb?sessionId=12345” • CONNECTION (+) • USER (-) • DATABASE (--) ©Continuent 2013 32
  • 34. SmartScale Limitations: • single connector instance • select function_that_writes(); • ephemeral SQL objects ©Continuent 2013 34
  • 35. SmartScale Trade-o": • Can read outdated data from other sessions • Poor e!ciency in write intensive environments ©Continuent 2013 35
  • 36. Automatic R/W splitting - directReads • Blind R/W splitting • Fast • Similar limitations: • ephemeral SQL objects • select function_that_writes(); • Reads potentially outdated data ©Continuent 2013 36
  • 37. DirectReads • Enabling tpm configure <ds> <opts> --connector-rwsplitting=true • Other users in user.map @direct user2 @direct user3 • Can be backed by a c3p0 pool ©Continuent 2013 37
  • 38. Read/write splitting • Automatic • Application Controlled ©Continuent 2013 38
  • 39. Application-driven R/W splitting • More e#cient... • ...but potentially dangerous • 3 possibilities: • SQL comments • QoS in database name • @hostoption ©Continuent 2013 39
  • 40. Selective R/W Splitting • Must enable directReads tpm update ... --connector-rwsplitting=true --property=selective.rwsplitting=true • Embedded SQL comment: !!! mysql -u... -c /* TUNGSTEN_URL_PROPERTY=qos=RO_RELAXED */select @@hostname; ©Continuent 2013 40
  • 42. QoS at connection time • No connector con!guration change • connect to “mydb@qos=RO_RELAXED” ©Continuent 2013 42
  • 44. Host-based routing • /etc/hosts 127.0.0.1 master.localhost 127.0.0.2 slave.localhost • tpm configure <data service name> <other options> --connector-rw-addresses=master.localhost --connector-ro-addresses=slave.localhost ©Continuent 2013 44
  • 46. SOR (multi site) • Getting a local slave <user> <password> <data service> [<preferred site>] tungsten_testing private world europe ©Continuent 2013 46
  • 48. Performance • Pool for DirectReads tpm configure <ds> <opts> --connector-rwsplitting=true --property=directReadsUsePool=true • JDBC driver --property=jdbc.driver.options= cacheServerCon!guration=true&characterSetResults=UTF8 https://docs.continuent.com/wiki/display/ TEDOC/Improving+Connection+Speed ©Continuent 2013 48
  • 49. Getting connector information • “tungsten connection status” for last request mysql> tungsten connection status; +---------------------------------------------------------------+ | message | +---------------------------------------------------------------+ | internal(OPEN) DIRECT TO u1@default(master:ONLINE) STATUS(OK) | +---------------------------------------------------------------+ 1 row in set (0.01 sec) • “tungsten show processlist” for real client addresses mysql> tungsten show processlist; +------------+------+----------+-----------+----------+---------+------+-------+------+ | DataSource | Id | User | Host | db | Command | Time | State | Info | +------------+------+----------+-----------+----------+---------+------+-------+------+ | u1 | 1342 | tungsten | mac:64477 | tungsten | Sleep | 20 | | NULL | +------------+------+----------+-----------+----------+---------+------+-------+------+ 1 row in set (0.13 sec) ©Continuent 2013 49
  • 50. Troubleshooting • tungsten-connector/log/connector.log • Lots of connections in TIME_WAIT state • Too many open !les • OutOfMemory error • New connections hanging ©Continuent 2013 50
  • 51. Tungsten University Sessions • Manage multi-master or fan-in replication topologies - March 7th & 12th • Zero-downtime maintenance and schema operations - March 21st & 26th • Geographically distributed MySQL clusters - April 11th & 16th • Replicate between MySQL and Oracle - May 2nd & 7th ©Continuent 2013 51
  • 52. 560 S. Winchester Blvd., Suite 500 Our Blogs: San Jose, CA 95128 http://scale-out-blog.blogspot.com Tel +1 (866) 998-3642 http://datacharmer.org/blog Fax +1 (408) 668-1009 http://www.continuent.com/news/blogs e-mail: sales@continuent.com Continuent Web Page: http://www.continuent.com Tungsten Replicator 2.0: http://code.google.com/p/tungsten-replicator ©Continuent 2013