SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
v




           Cassandra
Say Goodbye to the Relation Database
        Twin Cities PHP User Group
               May 6, 2010
               Chris Barber
                CB1, INC.
         http://www.cb1inc.com/
About Me

●   Chris Barber
●   Open source hacker
●   Software consultant
●   JavaScript, C++, PHP
●   http://www.cb1inc.com/
●   http://twitter.com/cb1inc
●   http://twitter.com/cb1kenobi
●   http://slideshare.net/cb1kenobi

       Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
What is Cassandra?



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
A highly scalable, eventually
  consistent, distributed,
structured key-value store.


 Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
About Cassandra
●   Started by Facebook
●   Open Source
    ●   Apache Project
    ●   Apache License 2.0
●   Written in Java
●   Mutli-platform
●   Current Version 0.6.1
●   http://cassandra.apache.org/



        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Who's using Cassandra?



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Cassandra Internals



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Cassandra Overview
●   Like a big hash table of hash tables
●   Column Database (schemaless)
●   Highly scalable
    ●   Add nodes in minutes
●   Fault tolerant
●   Distributed
●   Tunable




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Dynamo + BigTable = Cassandra
●   Amazon Dynamo
    ●   Cluster management
    ●   Replication
    ●   Fault tolerance
●   Google BigTable
    ●   Sparse
    ●   Columnar data model
    ●   Storage architecture




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Pros & Cons
●   Pros                                              ●   Cons
    ●   Easy to scale                                      ●   No joins
    ●   No single point of failure                         ●   Index & sort keys only
    ●   High write-through                                 ●   Not good for large blobs
    ●   Handles lots of data                               ●   Rows must fit in
    ●   Durable                                                memory
    ●   No more SQL injection
                                                           ●   Built on Thrift




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
CAP Theorem
●   CAP Theorem
    ●   Consistency
    ●   Availability
    ●   Partitioning
●   You can only have 2
●   Cassandra is Available and Partitioning
    ●   Eventually consistent
          –   Can be defined on a per request basis




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Consistency
●   Specified for each operation
    ●   Zero
    ●   One
    ●   Quorum (N-1)
    ●   All
    ●   Any




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Replication Ring
●   Ring of servers
●   Talk to each other using "gossip"
●   Data distributed between nodes
●   Uses "tokens" to partition data
    ●   Must be unique per node




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Partitioning
●   RandomPartitioner
    ●   Inefficient range queries
    ●   Doesn't sort properly
●   OrderPreservingPartitioner
    ●   Can cause unevenly distributed data
    ●   Stores data sorted




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Replica Placement Strategy
●   Rack-unware
    ●   Default
●   Rack-aware
    ●   Place one replica in a different datacenter, and the
        others on different racks in the same one




        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Data Model
●   Keyspace
●   Column Family (standard or super)
●   Columns & Super Columns
●   Keys and column names
          Keyspace1: {
              users: {
                  "cb1kenobi": {
                      "FirstName": "chris",
                      "LastName": "barber"
                  }
              }
          }




      Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Installing & Deploying
          Cassandra



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Getting Cassandra
●   http://cassandra.apache.org/download/
     ●   http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-bin.tar.gz
     ●   http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-src.tar.gz
●   svn checkout https://svn.apache.org/repos/asf/cassandra/trunk cassandra

●
    git clone git://git.apache.org/cassandra.git




         Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Getting Cassandra
●   http://cassandra.apache.org/download/
     ●   http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-bin.tar.gz
     ●   http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-src.tar.gz
●   svn checkout https://svn.apache.org/repos/asf/cassandra/trunk cassandra

●
    git clone git://git.apache.org/cassandra.git




         Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Installing Cassandra
su
cd /usr/local
wget http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-src.tar.gz
tar xzf apache-cassandra-0.6.1-src.tar.gz
mkdir -p /var/log/cassandra
chown -R `whoami` /var/log/cassandra
mkdir -p /var/lib/cassandra
chown -R `whoami` /var/lib/cassandra
cd apache-cassandra-0.6.1-src
ant




       Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Configuration
●   Main config file
    ●   conf/storage-conf.xml
●   Keyspaces
●   Partitioner
●   AutoBootstrap
●   Authentication method
●   Buffer sizes
●   Timeouts


        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Automatically Start Cassanrda
useradd -G cassandra cassandra

<editor of choice> /etc/init.d/cassandra
# paste contents of next slide

chmod +x /etc/init.d/cassandra

# Ubuntu/Debian method:
update-rc.d -f cassandra defaults
# Red Hat/Fedora method: use chkconfig




     Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Automatically Start Cassandra
#!/bin/bash
export JAVA_HOME=/usr/bin/java
export CASSANDRA_HOME=/usr/local/apache-cassandra-0.6.1-src
export CASSANDRA_INCLUDE=$CASSANDRA_HOME/bin/cassandra.in.sh
export CASSANDRA_CONF=$CASSANDRA_HOME/conf/storage-conf.xml
export CASSANDRA_OWNR=cassandra
export PATH=$PATH:$CASSANDRA_HOME/bin
log_file=/var/log/cassandra/stdout
pid_file=/var/run/cassandra/pid_file

if [ ! -f $CASSANDRA_HOME/bin/cassandra -o ! -d $CASSANDRA_HOME ]
then
    echo "Cassandra startup: cannot start"
    exit 1
fi

mkdir -p /var/run/cassandra
chown cassandra:cassandra /var/run/cassandra

case "$1" in
    start)
        # Cassandra startup
        echo -n "Starting Cassandra: "
        su $CASSANDRA_OWNR -c "$CASSANDRA_HOME/bin/cassandra -p $pid_file" > $log_file 2>&1
        echo "OK"
        ;;
    stop)
        # Cassandra shutdown
        echo -n "Shutdown Cassandra: "
        su $CASSANDRA_OWNR -c "kill `cat $pid_file`"
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    status)
        ;;
    *)
        echo "Usage: `basename $0` start|stop|restart|reload"
        exit 1
esac

exit 0
  Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Running Cassandra
●   Manually start
    ●   bin/cassandra -f
●   Command line app
    ●   bin/cassandra-cli --host localhost --port 9160
●   Nodetool
    ●   bin/nodetool -h localhost info
         20146078924586773365182178806181105130
         Load             : 274.66 KB
         Generation No    : 1273183803
         Uptime (seconds) : 121
         Heap Memory (MB) : 51.84 / 1023.88

    ●   Many more commands: ring, cleanup, cfstats, etc

        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
PHP Clients



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
PHP Clients
●   Thrift
●   Pandra (LGPL)
●   PHP Cassa – pycassa port
●   Simple Cassie (New BSD License)
●   Prophet (PHP License)




      Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
PHP Thrift Client
●   Thrift files                                      ●   Thrift generated PHP
    ●   Thrift.php                                        files
    ●   protocol/TBinaryProtocol.php                       ●   thrift --gen php cassandra.thrift
    ●   protocol/TProtocol.php                                  –   cassandra_constants.php
    ●   transport/TBufferedTransport.php                        –   Cassandra.php
    ●   transport/TFramedTransport.php                          –   cassandra_types.php
    ●   transport/THttpClient.php                     ●   Use thrift_protocol
    ●   transport/TMemoryBuffer.php                       native PHP extension
    ●   transport/TNullTransport.php
    ●   transport/TPhpStream.php
    ●   transport/TSocket.php
    ●   transport/TSocketPool.php
    ●   transport/TTransport.php



        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
PHP Thrift Client Example
<?php
$GLOBALS['THRIFT_ROOT'] = './thrift';
require $GLOBALS['THRIFT_ROOT'] . '/Thrift.php';
require $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
require $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php';
require $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';
require $GLOBALS['THRIFT_ROOT'] . '/packages/cassandra/Cassandra.php';

$socket = new TSocket('127.0.0.1', 9160);
$transport = new TBufferedTransport($socket, 1024, 1024);
$protocol = new TbinaryProtocolAccelerated($transport);
$client = new CassandraClient($protocol);

$transport->open();

$columnPath = new cassandra_ColumnPath();
$columnPath->column_family = 'Standard1';
$columnPath->super_column = null;
$columnPath->column = 'firstname';

$client->insert('Keyspace1', 'mykey', $columnPath, 'Chris', time(),
    cassandra_ConsistencyLevel::ONE);

$name = $client->get('Keyspace1', 'mykey', $columnPath, cassandra_ConsistencyLevel::ONE);
var_dump($name);

$transport->close();



       Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Prophet PHP Extension
●   C++ PHP Extension
●   Built on top of Thrift C library
●   Very, very, very far from usable/working/complete
●   Goals
    ●   Speed!
    ●   Full API support
    ●   CRUD/ORM magic
    ●   Serialization helper
●   Developed for PHP 5.3, Linux, non-threaded (i.e.
    FastCGI)
●   http://github.com/cb1kenobi/prophet
        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Cassandra Roadmap



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Roadmap 0.7 & Beyond
●   SSTable compression
●   Live keyspace & column family changes
●   Vector clock support
●   Truncate support
●   Range delete
●   byte[] keys
●   Memory efficient compactions
●   Apache Avro
●   Multi-tenant support
                                                                 * Taken from other presentations

      Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Resources
●   Cassandra Wiki
    ●   http://wiki.apache.org/cassandra/
●   IRC
    ●   #cassandra on irc.freenode.net
●   Cassandra Users Mailing List
    ●   user-subscribe@cassandra.apache.org
●   Follow people on Twitter
    ●   @cassandra                     ●   @jericevans
    ●   @spyced                        ●   @riptano
    ●   @b6n

        Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Getting Help




                         CB1, INC
                 http://www.cb1inc.com/
                       Web Applications
                     Open Source Solutions



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
Thanks!

                      Questions?
                      http://www.cb1inc.com/
                     http://twitter.com/cb1inc
                http://slideshare.net/cb1kenobi
                 http://twitter.com/cb1kenobi



Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/

Más contenido relacionado

La actualidad más candente

Moxi - Memcached Proxy
Moxi - Memcached ProxyMoxi - Memcached Proxy
Moxi - Memcached ProxyNorthScale
 
Nats.io meetup october 2015 - Community Update
Nats.io meetup october 2015 - Community UpdateNats.io meetup october 2015 - Community Update
Nats.io meetup october 2015 - Community UpdateBrian Flannery
 
Gluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlvGluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlvSahina Bose
 
Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2SergeyChernyshev
 
Disperse xlator ramon_datalab
Disperse xlator ramon_datalabDisperse xlator ramon_datalab
Disperse xlator ramon_datalabGluster.org
 
Performance characterization in large distributed file system with gluster fs
Performance characterization in large distributed file system with gluster fsPerformance characterization in large distributed file system with gluster fs
Performance characterization in large distributed file system with gluster fsNeependra Khare
 
Dustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep DiveDustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep DiveGluster.org
 
Druid beginner performance tips
Druid beginner performance tipsDruid beginner performance tips
Druid beginner performance tipsvishnu rao
 
MongoDB SF Python
MongoDB SF PythonMongoDB SF Python
MongoDB SF PythonMike Dirolf
 
Software defined storage
Software defined storageSoftware defined storage
Software defined storageGluster.org
 
Leases and-caching final
Leases and-caching finalLeases and-caching final
Leases and-caching finalGluster.org
 
Configuring workload-based storage and topologies
Configuring workload-based storage and topologiesConfiguring workload-based storage and topologies
Configuring workload-based storage and topologiesMariaDB plc
 
DebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoFDebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoFOtto Kekäläinen
 
Gluster technical overview
Gluster technical overviewGluster technical overview
Gluster technical overviewGluster.org
 
Ceph Day Santa Clara: The Future of CephFS + Developing with Librados
Ceph Day Santa Clara: The Future of CephFS + Developing with LibradosCeph Day Santa Clara: The Future of CephFS + Developing with Librados
Ceph Day Santa Clara: The Future of CephFS + Developing with LibradosCeph Community
 
Debugging with-wireshark-niels-de-vos
Debugging with-wireshark-niels-de-vosDebugging with-wireshark-niels-de-vos
Debugging with-wireshark-niels-de-vosGluster.org
 
Gluster wireshark niels_de_vos
Gluster wireshark niels_de_vosGluster wireshark niels_de_vos
Gluster wireshark niels_de_vosGluster.org
 
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized StoreGlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized StoreAtin Mukherjee
 
20160401 guster-roadmap
20160401 guster-roadmap20160401 guster-roadmap
20160401 guster-roadmapGluster.org
 

La actualidad más candente (20)

Moxi - Memcached Proxy
Moxi - Memcached ProxyMoxi - Memcached Proxy
Moxi - Memcached Proxy
 
Nats.io meetup october 2015 - Community Update
Nats.io meetup october 2015 - Community UpdateNats.io meetup october 2015 - Community Update
Nats.io meetup october 2015 - Community Update
 
Gluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlvGluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlv
 
Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2
 
Disperse xlator ramon_datalab
Disperse xlator ramon_datalabDisperse xlator ramon_datalab
Disperse xlator ramon_datalab
 
Performance characterization in large distributed file system with gluster fs
Performance characterization in large distributed file system with gluster fsPerformance characterization in large distributed file system with gluster fs
Performance characterization in large distributed file system with gluster fs
 
Dustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep DiveDustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep Dive
 
Druid beginner performance tips
Druid beginner performance tipsDruid beginner performance tips
Druid beginner performance tips
 
MongoDB SF Python
MongoDB SF PythonMongoDB SF Python
MongoDB SF Python
 
Software defined storage
Software defined storageSoftware defined storage
Software defined storage
 
Leases and-caching final
Leases and-caching finalLeases and-caching final
Leases and-caching final
 
Configuring workload-based storage and topologies
Configuring workload-based storage and topologiesConfiguring workload-based storage and topologies
Configuring workload-based storage and topologies
 
DebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoFDebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoF
 
Gluster d2
Gluster d2Gluster d2
Gluster d2
 
Gluster technical overview
Gluster technical overviewGluster technical overview
Gluster technical overview
 
Ceph Day Santa Clara: The Future of CephFS + Developing with Librados
Ceph Day Santa Clara: The Future of CephFS + Developing with LibradosCeph Day Santa Clara: The Future of CephFS + Developing with Librados
Ceph Day Santa Clara: The Future of CephFS + Developing with Librados
 
Debugging with-wireshark-niels-de-vos
Debugging with-wireshark-niels-de-vosDebugging with-wireshark-niels-de-vos
Debugging with-wireshark-niels-de-vos
 
Gluster wireshark niels_de_vos
Gluster wireshark niels_de_vosGluster wireshark niels_de_vos
Gluster wireshark niels_de_vos
 
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized StoreGlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
 
20160401 guster-roadmap
20160401 guster-roadmap20160401 guster-roadmap
20160401 guster-roadmap
 

Similar a Cassandra - Say Goodbye to the Relational Database (5-6-2010)

Last Month in PHP - May 2016
Last Month in PHP - May 2016Last Month in PHP - May 2016
Last Month in PHP - May 2016Eric Poe
 
FastNetMon and Metrics
FastNetMon and MetricsFastNetMon and Metrics
FastNetMon and MetricsAltinity Ltd
 
Build real time stream processing applications using Apache Kafka
Build real time stream processing applications using Apache KafkaBuild real time stream processing applications using Apache Kafka
Build real time stream processing applications using Apache KafkaHotstar
 
OpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ CriteoOpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ CriteoNathaniel Braun
 
Tips & Tricks for Apache Kafka®
Tips & Tricks for Apache Kafka®Tips & Tricks for Apache Kafka®
Tips & Tricks for Apache Kafka®confluent
 
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUpStrimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUpJosé Román Martín Gil
 
Strategies for Context Data Persistence
Strategies for Context Data PersistenceStrategies for Context Data Persistence
Strategies for Context Data PersistenceFIWARE
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaRicardo Bravo
 
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...Timothy Spann
 
Clusternaut: Orchestrating  Percona XtraDB Cluster with Kubernetes
Clusternaut:  Orchestrating  Percona XtraDB Cluster with KubernetesClusternaut:  Orchestrating  Percona XtraDB Cluster with Kubernetes
Clusternaut: Orchestrating  Percona XtraDB Cluster with KubernetesRaghavendra Prabhu
 
OpenStack Cinder, Implementation Today and New Trends for Tomorrow
OpenStack Cinder, Implementation Today and New Trends for TomorrowOpenStack Cinder, Implementation Today and New Trends for Tomorrow
OpenStack Cinder, Implementation Today and New Trends for TomorrowEd Balduf
 
NetflixOSS meetup lightning talks and roadmap
NetflixOSS meetup lightning talks and roadmapNetflixOSS meetup lightning talks and roadmap
NetflixOSS meetup lightning talks and roadmapRuslan Meshenberg
 
Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)
Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)
Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)Pierre Mavro
 
Apache Kafka's Common Pitfalls & Intricacies: A Customer Support Perspective
Apache Kafka's Common Pitfalls & Intricacies: A Customer Support PerspectiveApache Kafka's Common Pitfalls & Intricacies: A Customer Support Perspective
Apache Kafka's Common Pitfalls & Intricacies: A Customer Support PerspectiveHostedbyConfluent
 
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kuberneteshbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
hbaseconasia2017: Building online HBase cluster of Zhihu based on KubernetesHBaseCon
 
FIWARE Wednesday Webinars - Strategies for Context Data Persistence
FIWARE Wednesday Webinars - Strategies for Context Data PersistenceFIWARE Wednesday Webinars - Strategies for Context Data Persistence
FIWARE Wednesday Webinars - Strategies for Context Data PersistenceFIWARE
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2aspyker
 
What is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress HostingWhat is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress HostingWPSFO Meetup Group
 
Learnings from the Field. Lessons from Working with Dozens of Small & Large D...
Learnings from the Field. Lessons from Working with Dozens of Small & Large D...Learnings from the Field. Lessons from Working with Dozens of Small & Large D...
Learnings from the Field. Lessons from Working with Dozens of Small & Large D...HostedbyConfluent
 

Similar a Cassandra - Say Goodbye to the Relational Database (5-6-2010) (20)

Last Month in PHP - May 2016
Last Month in PHP - May 2016Last Month in PHP - May 2016
Last Month in PHP - May 2016
 
FastNetMon and Metrics
FastNetMon and MetricsFastNetMon and Metrics
FastNetMon and Metrics
 
Build real time stream processing applications using Apache Kafka
Build real time stream processing applications using Apache KafkaBuild real time stream processing applications using Apache Kafka
Build real time stream processing applications using Apache Kafka
 
OpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ CriteoOpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ Criteo
 
Tips & Tricks for Apache Kafka®
Tips & Tricks for Apache Kafka®Tips & Tricks for Apache Kafka®
Tips & Tricks for Apache Kafka®
 
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUpStrimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
 
Strategies for Context Data Persistence
Strategies for Context Data PersistenceStrategies for Context Data Persistence
Strategies for Context Data Persistence
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
 
Clusternaut: Orchestrating  Percona XtraDB Cluster with Kubernetes
Clusternaut:  Orchestrating  Percona XtraDB Cluster with KubernetesClusternaut:  Orchestrating  Percona XtraDB Cluster with Kubernetes
Clusternaut: Orchestrating  Percona XtraDB Cluster with Kubernetes
 
OpenStack Cinder, Implementation Today and New Trends for Tomorrow
OpenStack Cinder, Implementation Today and New Trends for TomorrowOpenStack Cinder, Implementation Today and New Trends for Tomorrow
OpenStack Cinder, Implementation Today and New Trends for Tomorrow
 
NetflixOSS meetup lightning talks and roadmap
NetflixOSS meetup lightning talks and roadmapNetflixOSS meetup lightning talks and roadmap
NetflixOSS meetup lightning talks and roadmap
 
Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)
Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)
Traefik on Kubernetes at MySocialApp (CNCF Paris Meetup)
 
Apache Kafka's Common Pitfalls & Intricacies: A Customer Support Perspective
Apache Kafka's Common Pitfalls & Intricacies: A Customer Support PerspectiveApache Kafka's Common Pitfalls & Intricacies: A Customer Support Perspective
Apache Kafka's Common Pitfalls & Intricacies: A Customer Support Perspective
 
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kuberneteshbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
 
FIWARE Wednesday Webinars - Strategies for Context Data Persistence
FIWARE Wednesday Webinars - Strategies for Context Data PersistenceFIWARE Wednesday Webinars - Strategies for Context Data Persistence
FIWARE Wednesday Webinars - Strategies for Context Data Persistence
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2
 
What is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress HostingWhat is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress Hosting
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
Learnings from the Field. Lessons from Working with Dozens of Small & Large D...
Learnings from the Field. Lessons from Working with Dozens of Small & Large D...Learnings from the Field. Lessons from Working with Dozens of Small & Large D...
Learnings from the Field. Lessons from Working with Dozens of Small & Large D...
 

Más de Chris Barber

Remote IP Power Switches
Remote IP Power SwitchesRemote IP Power Switches
Remote IP Power SwitchesChris Barber
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsChris Barber
 
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013Chris Barber
 
Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012Chris Barber
 
Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)Chris Barber
 
Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)Chris Barber
 
Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)Chris Barber
 
Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)Chris Barber
 
High Availability With DRBD & Heartbeat
High Availability With DRBD & HeartbeatHigh Availability With DRBD & Heartbeat
High Availability With DRBD & HeartbeatChris Barber
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference RecapChris Barber
 
Memcached And MySQL
Memcached And MySQLMemcached And MySQL
Memcached And MySQLChris Barber
 

Más de Chris Barber (11)

Remote IP Power Switches
Remote IP Power SwitchesRemote IP Power Switches
Remote IP Power Switches
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ Addons
 
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
 
Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012
 
Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)
 
Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)
 
Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)
 
Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)
 
High Availability With DRBD & Heartbeat
High Availability With DRBD & HeartbeatHigh Availability With DRBD & Heartbeat
High Availability With DRBD & Heartbeat
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference Recap
 
Memcached And MySQL
Memcached And MySQLMemcached And MySQL
Memcached And MySQL
 

Último

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Último (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

Cassandra - Say Goodbye to the Relational Database (5-6-2010)

  • 1. v Cassandra Say Goodbye to the Relation Database Twin Cities PHP User Group May 6, 2010 Chris Barber CB1, INC. http://www.cb1inc.com/
  • 2. About Me ● Chris Barber ● Open source hacker ● Software consultant ● JavaScript, C++, PHP ● http://www.cb1inc.com/ ● http://twitter.com/cb1inc ● http://twitter.com/cb1kenobi ● http://slideshare.net/cb1kenobi Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 3. What is Cassandra? Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 4. A highly scalable, eventually consistent, distributed, structured key-value store. Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 5. About Cassandra ● Started by Facebook ● Open Source ● Apache Project ● Apache License 2.0 ● Written in Java ● Mutli-platform ● Current Version 0.6.1 ● http://cassandra.apache.org/ Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 6. Who's using Cassandra? Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 7. Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 8. Cassandra Internals Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 9. Cassandra Overview ● Like a big hash table of hash tables ● Column Database (schemaless) ● Highly scalable ● Add nodes in minutes ● Fault tolerant ● Distributed ● Tunable Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 10. Dynamo + BigTable = Cassandra ● Amazon Dynamo ● Cluster management ● Replication ● Fault tolerance ● Google BigTable ● Sparse ● Columnar data model ● Storage architecture Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 11. Pros & Cons ● Pros ● Cons ● Easy to scale ● No joins ● No single point of failure ● Index & sort keys only ● High write-through ● Not good for large blobs ● Handles lots of data ● Rows must fit in ● Durable memory ● No more SQL injection ● Built on Thrift Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 12. CAP Theorem ● CAP Theorem ● Consistency ● Availability ● Partitioning ● You can only have 2 ● Cassandra is Available and Partitioning ● Eventually consistent – Can be defined on a per request basis Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 13. Consistency ● Specified for each operation ● Zero ● One ● Quorum (N-1) ● All ● Any Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 14. Replication Ring ● Ring of servers ● Talk to each other using "gossip" ● Data distributed between nodes ● Uses "tokens" to partition data ● Must be unique per node Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 15. Partitioning ● RandomPartitioner ● Inefficient range queries ● Doesn't sort properly ● OrderPreservingPartitioner ● Can cause unevenly distributed data ● Stores data sorted Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 16. Replica Placement Strategy ● Rack-unware ● Default ● Rack-aware ● Place one replica in a different datacenter, and the others on different racks in the same one Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 17. Data Model ● Keyspace ● Column Family (standard or super) ● Columns & Super Columns ● Keys and column names Keyspace1: { users: { "cb1kenobi": { "FirstName": "chris", "LastName": "barber" } } } Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 18. Installing & Deploying Cassandra Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 19. Getting Cassandra ● http://cassandra.apache.org/download/ ● http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-bin.tar.gz ● http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-src.tar.gz ● svn checkout https://svn.apache.org/repos/asf/cassandra/trunk cassandra ● git clone git://git.apache.org/cassandra.git Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 20. Getting Cassandra ● http://cassandra.apache.org/download/ ● http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-bin.tar.gz ● http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-src.tar.gz ● svn checkout https://svn.apache.org/repos/asf/cassandra/trunk cassandra ● git clone git://git.apache.org/cassandra.git Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 21. Installing Cassandra su cd /usr/local wget http://www.apache.org/dist/cassandra/0.6.1/apache-cassandra-0.6.1-src.tar.gz tar xzf apache-cassandra-0.6.1-src.tar.gz mkdir -p /var/log/cassandra chown -R `whoami` /var/log/cassandra mkdir -p /var/lib/cassandra chown -R `whoami` /var/lib/cassandra cd apache-cassandra-0.6.1-src ant Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 22. Configuration ● Main config file ● conf/storage-conf.xml ● Keyspaces ● Partitioner ● AutoBootstrap ● Authentication method ● Buffer sizes ● Timeouts Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 23. Automatically Start Cassanrda useradd -G cassandra cassandra <editor of choice> /etc/init.d/cassandra # paste contents of next slide chmod +x /etc/init.d/cassandra # Ubuntu/Debian method: update-rc.d -f cassandra defaults # Red Hat/Fedora method: use chkconfig Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 24. Automatically Start Cassandra #!/bin/bash export JAVA_HOME=/usr/bin/java export CASSANDRA_HOME=/usr/local/apache-cassandra-0.6.1-src export CASSANDRA_INCLUDE=$CASSANDRA_HOME/bin/cassandra.in.sh export CASSANDRA_CONF=$CASSANDRA_HOME/conf/storage-conf.xml export CASSANDRA_OWNR=cassandra export PATH=$PATH:$CASSANDRA_HOME/bin log_file=/var/log/cassandra/stdout pid_file=/var/run/cassandra/pid_file if [ ! -f $CASSANDRA_HOME/bin/cassandra -o ! -d $CASSANDRA_HOME ] then echo "Cassandra startup: cannot start" exit 1 fi mkdir -p /var/run/cassandra chown cassandra:cassandra /var/run/cassandra case "$1" in start) # Cassandra startup echo -n "Starting Cassandra: " su $CASSANDRA_OWNR -c "$CASSANDRA_HOME/bin/cassandra -p $pid_file" > $log_file 2>&1 echo "OK" ;; stop) # Cassandra shutdown echo -n "Shutdown Cassandra: " su $CASSANDRA_OWNR -c "kill `cat $pid_file`" echo "OK" ;; reload|restart) $0 stop $0 start ;; status) ;; *) echo "Usage: `basename $0` start|stop|restart|reload" exit 1 esac exit 0 Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 25. Running Cassandra ● Manually start ● bin/cassandra -f ● Command line app ● bin/cassandra-cli --host localhost --port 9160 ● Nodetool ● bin/nodetool -h localhost info 20146078924586773365182178806181105130 Load : 274.66 KB Generation No : 1273183803 Uptime (seconds) : 121 Heap Memory (MB) : 51.84 / 1023.88 ● Many more commands: ring, cleanup, cfstats, etc Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 26. PHP Clients Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 27. PHP Clients ● Thrift ● Pandra (LGPL) ● PHP Cassa – pycassa port ● Simple Cassie (New BSD License) ● Prophet (PHP License) Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 28. PHP Thrift Client ● Thrift files ● Thrift generated PHP ● Thrift.php files ● protocol/TBinaryProtocol.php ● thrift --gen php cassandra.thrift ● protocol/TProtocol.php – cassandra_constants.php ● transport/TBufferedTransport.php – Cassandra.php ● transport/TFramedTransport.php – cassandra_types.php ● transport/THttpClient.php ● Use thrift_protocol ● transport/TMemoryBuffer.php native PHP extension ● transport/TNullTransport.php ● transport/TPhpStream.php ● transport/TSocket.php ● transport/TSocketPool.php ● transport/TTransport.php Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 29. PHP Thrift Client Example <?php $GLOBALS['THRIFT_ROOT'] = './thrift'; require $GLOBALS['THRIFT_ROOT'] . '/Thrift.php'; require $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php'; require $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php'; require $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php'; require $GLOBALS['THRIFT_ROOT'] . '/packages/cassandra/Cassandra.php'; $socket = new TSocket('127.0.0.1', 9160); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TbinaryProtocolAccelerated($transport); $client = new CassandraClient($protocol); $transport->open(); $columnPath = new cassandra_ColumnPath(); $columnPath->column_family = 'Standard1'; $columnPath->super_column = null; $columnPath->column = 'firstname'; $client->insert('Keyspace1', 'mykey', $columnPath, 'Chris', time(), cassandra_ConsistencyLevel::ONE); $name = $client->get('Keyspace1', 'mykey', $columnPath, cassandra_ConsistencyLevel::ONE); var_dump($name); $transport->close(); Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 30. Prophet PHP Extension ● C++ PHP Extension ● Built on top of Thrift C library ● Very, very, very far from usable/working/complete ● Goals ● Speed! ● Full API support ● CRUD/ORM magic ● Serialization helper ● Developed for PHP 5.3, Linux, non-threaded (i.e. FastCGI) ● http://github.com/cb1kenobi/prophet Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 31. Cassandra Roadmap Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 32. Roadmap 0.7 & Beyond ● SSTable compression ● Live keyspace & column family changes ● Vector clock support ● Truncate support ● Range delete ● byte[] keys ● Memory efficient compactions ● Apache Avro ● Multi-tenant support * Taken from other presentations Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 33. Resources ● Cassandra Wiki ● http://wiki.apache.org/cassandra/ ● IRC ● #cassandra on irc.freenode.net ● Cassandra Users Mailing List ● user-subscribe@cassandra.apache.org ● Follow people on Twitter ● @cassandra ● @jericevans ● @spyced ● @riptano ● @b6n Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 34. Getting Help CB1, INC http://www.cb1inc.com/ Web Applications Open Source Solutions Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/
  • 35. Thanks! Questions? http://www.cb1inc.com/ http://twitter.com/cb1inc http://slideshare.net/cb1kenobi http://twitter.com/cb1kenobi Minnesota PHP User Group | 5.6.2010 | Chris Barber | CB1, INC. | http://www.cb1inc.com/