29
© Continuent 2010 Linas Virbalas Continuent, Inc.

Living the Easy Life with Rules-Based Autonomic Database Clusters

Embed Size (px)

Citation preview

Page 1: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Linas Virbalas Continuent, Inc.

Page 2: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  Introductions /  What is Tungsten? /  Architecture of a Rule–Based Management

Framework for Database Clusters /  Demo of Business Rules in Operation /  Business Rules in Source Code /  Questions and Comments

Page 3: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 4: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  Our Mission: Continuent is the data reliability company that keeps business in business

/  Our Solution: •  Continuent Tungsten (Master/Slave Database Replication)

/  Our Value: •  Enterprise class data management •  Open source cost •  Integrated solution

/  Our Technical Expertise •  Database replication •  Database cluster management •  Application connectivity •  Software-as-a-Service (SaaS)

Page 5: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 6: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

What Is Tungsten?

/  Tungsten implements master/slave clusters to: •  Protect data •  Maintain high availability •  Improve resource utilization •  Raise performance

/  Install and set up in a few minutes /  Integrated backup/restore and data integrity checks /  Efficient failover operations /  Distributed, rule-driven management /  No/minimal application changes /  Highly pluggable /  No specialized hardware requirements

Page 7: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

What’s Inside Tungsten?

/  Replication - Making copies •  Tungsten Replicator -- Database-neutral, platform independent

master/slave replication

/  Connectivity -- Finding databases •  Tungsten Connector -- Fast MySQL/PostgreSQL client to JDBC

proxying •  Tungsten SQL Router --JDBC wrapper for high-performance and

transparent failover, load-balancing, and partitioning (no proxy required)

/  Management -- Administering the database •  Tungsten Manager -- Distributed administration with autonomic,

rule-based configuration and no single point of failure •  Tungsten Monitor -- Track resource status and database liveness

Page 8: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Management Client

Management Client

Replicator

Monitor

Manager

Replicator

Monitor

Manager

Application Server

SQL Router/Connector Manager

Application Server

SQL Router/Connector Manager

Page 9: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Multiple Routes to Databases Java App Server Tungsten SQL Router

PHP Application

Tungsten Connector

libpq.a

Tungsten Cluster

PostgreSQL JDBC Driver

Page 10: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Tungsten on Open Source Databases

/  MySQL 5.0/5.1 •  Read and replicate from MySQL binlog •  Works with Oracle, MySQL and look-alikes (Percona, MariaDB)

/  PostgreSQL < 9 •  Warm Standby + WAL Shipping •  Good basic availability/fast failover •  Slaves open up for reads only after failover

/  PostgreSQL >= 9 •  Hot Standby + Streaming Replication •  Slaves opened up for reads = Tungsten scaling facilities work •  Add Streaming Replication = minimal delay in replicating data

/  Sometime in the future: Read PG logs directly!

Page 11: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  15 minute cluster installation /  Single commands to:

•  View cluster status •  Provision a new standby •  Confirm liveness of replication •  Switch servers safely for maintenance •  Failover a dead server to most current replica

/  Automatic discovery of new replicas /  Automatic failover when databases fail /  Simple procedures for provisioning /  Transparent application routing /  Easy scaling

Tungsten Added Value

Page 12: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 13: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Distributed Rule-Based Management

Manager (Coordinator)

Manager

Manager Admin Client

Admin Client

Admin Client

Page 14: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  Tungsten Manager processes connect to each other via Group Communications protocol

/  Group Communications provide essential features for running multi-node environments:

•  Membership detection •  Notification about joined/left/crashed members •  Reliable message broadcast (lost messages retransmitted) •  Ordered message broadcast (all members receive

messages in the same order)

/  Different transport protocols can be used •  IP Multicast – for open local networks •  Peer to Peer TCP – for firewalled local networks •  Centralized Gossip Server – for Cloud environments

Group Communications in Clustering

Page 15: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  Trivial Rule:

/  Example (pseudo code):

What is a Rule?

Page 16: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

What is a Rule Engine?

Page 17: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

How does the Rule Engine Work? Application with a Rule

Engine (Tungsten Manager)

Page 18: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

How does the Rule Engine get its Facts?

Tungsten Manager

Tungsten Monitor

Tungsten Replicator

Page 19: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  Only one Coordinator for a group (cluster) •  Only one Manager must act on important events like

failures •  Having more than one Coordinator would lead to race

conditions and eventually chaotic cluster behavior

/  Tungsten chooses Coordinator from the Group Communications

•  Coordinator is the oldest member of the group •  New members handshake with the Coordinator when

joining •  Upon Coordinator death, GC automatically promotes a

new one

Who is The Coordinator?

Page 20: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 21: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 22: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  Lower level rules react on events from •  Database servers •  Replicators •  Managers

/  Outcome: the state change of a concept “data source”

The Rules are “Layered”

/  Higher level rules react on •  Data source state changes

/  Outcome: actual operations to the cluster components (eg. promote slave to a master)

Page 23: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Scenario: Database Crashes /  Failover is handled by a controlled chain reaction of

rules rather than a single rule: 1.  "DETECT AND FENCE FAILED DATASERVER" rule

detects state transition of the master DB from ONLINE to STOPPED   It then 'fences' the failure by setting the data source of the stopped

DB server to FAILED

2.  "AUTOMATIC FAILOVER" rule fires, because DataSource(state == ResourceState.FAILED && role == "master”)

  It then calls a method in the ClusterManagementHelper to do the actual failover, after which it refreshes the data source states

i  If the data source was of a slave, it would stay in the FAILED state and no further action would take place

Page 24: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 25: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 26: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

/  Business Rules are a very powerful and flexible tool for automating otherwise complex tasks

/  They are especially useful in implementing automated DB clusters

/  A robust top layer connecting all the components underneath into a seamless experience

Conclusion

Page 27: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 28: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

Page 29: Living the Easy Life with Rules-Based Autonomic Database Clusters

© Continuent 2010

HQ and Americas 560 S. Winchester Blvd., Suite 500 San Jose, CA 95128 Tel (866) 998-3642 Fax (408) 668-1009

e-mail: [email protected], [email protected]

EMEA and APAC Lars Sonckin kaari 16 02600 Espoo, Finland Tel +358 50 517 9059 Fax +358 9 863 0060

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