Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Aaron Morton - Meetup Sept 25th 2014

Ale
October 02, 2014

Aaron Morton - Meetup Sept 25th 2014

Cassandra London Meetup Group

Ale

October 02, 2014
Tweet

More Decks by Ale

Other Decks in Technology

Transcript

  1. Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License

    CASSANDRA LONDON SEPT 2014 LESSER KNOWN FEATURES OF CASSANDRA 2.1 Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License Aaron Morton @aaronmorton Co-Founder & Principal Consultant
  2. About The Last Pickle. ! Work with clients to deliver

    and improve Apache Cassandra based solutions. Apache Cassandra Committer, DataStax MVP, Hector Maintainer, Apache Usergrid Committer. Based in New Zealand & USA.
  3. Change Logging to Logback (CASSANDRA-5883) <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${cassandra.logdir}/system.log</file> <rollingPolicy

    class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${cassandra.logdir}/system.log.%i.zip</ fileNamePattern> <minIndex>1</minIndex> <maxIndex>20</maxIndex> </rollingPolicy> </appender> ! <logger name=“org.apache.cassandra.Foo” level="ERROR"/>
  4. Change Logging to Logback (CASSANDRA-5883) TIP: Change compression so zless

    and zgrep work. ! ${cassandra.logdir}/system.log.%i.gz
  5. Change Logging to Logback (CASSANDRA-5883) $ ls -lah logs/ 963K

    system.log 129K system.log.1.gz 158K system.log.2.gz 158K system.log.3.gz 158K system.log.4.gz 158K system.log.5.gz 158K system.log.6.gz 158K system.log.7.gz 158K system.log.8.gz 157K system.log.9.gz
  6. New Default Paths (CASSANDRA-7136) // bin/cassandra.in.sh CASSANDRA_HOME="`dirname "$0"`/.." cassandra_storagedir=“$CASSANDRA_HOME/data" !

    // bin/cassandra -Dcassandra.logdir=$CASSANDRA_HOME/logs" -Dcassandra.storagedir=$cassandra_storagedir"
  7. New Default Paths (CASSANDRA-7136) No change for package installs. !

    Leave YAML settings blank for new defaults.
  8. New Default Paths (CASSANDRA-7136) $ ls -lh cassandra/v2.1/ -rw-r--r--@ CHANGES.txt

    -rw-r--r--@ LICENSE.txt -rw-r--r--@ NEWS.txt -rw-r--r--@ NOTICE.txt drwxr-xr-x@ bin drwxr-xr-x@ conf drwxr-xr-x data drwxr-xr-x@ lib drwxr-xr-x logs drwxr-xr-x@ pylib drwxr-xr-x@ tools
  9. New Default Paths (CASSANDRA-7136) $ ls -lah cassandra/ drwxr-xr-x@ apache-cassandra-1.0.12

    drwxr-xr-x@ apache-cassandra-1.1.12 drwxr-xr-x@ apache-cassandra-1.2.18 drwxr-xr-x@ apache-cassandra-2.0.10 drwxr-xr-x@ apache-cassandra-2.1.0-rc7 lrwxr-xr-x current -> v2.0/ lrwxr-xr-x v1.0 -> apache-cassandra-1.0.12 lrwxr-xr-x v1.1 -> apache-cassandra-1.1.12 lrwxr-xr-x v1.2 -> apache-cassandra-1.2.18/ lrwxr-xr-x v2.0 -> apache-cassandra-2.0.10 lrwxr-xr-x v2.1 -> apache-cassandra-2.1.0-rc7
  10. Add QueryHandler Interface (CASSANDRA-6659) Custom implementation to handle all CQL3

    queries. ! For example logging, slow query log, stubbing Cassandra.
  11. Add QueryHandler Interface (CASSANDRA-6659) public interface QueryHandler { ResultMessage process(String

    query, QueryState state,…); ! ResultMessage.Prepared prepare(String query, QueryState state); ! ParsedStatement.Prepared getPrepared(MD5Digest id); ! CQLStatement getPreparedForThrift(Integer id); ! ResultMessage processPrepared(CQLStatement statement, …); ! ResultMessage processBatch(BatchStatement statement, …);
  12. Pluggable o.a.c.metrics Reporters (CASSANDRA-4430) riemann: - period: 1 timeunit: 'SECONDS'

    hosts: - host: 'localhost' port: 5555 predicate: color: "white" useQualifiedName: true patterns: - "^org.apache.cassandra.metrics.ClientRequest.+" - "^org.apache.cassandra.metrics.DroppedMessage.+"
  13. Use JMX_PORT For The RMI Port (CASSANDRA-7087) ! // conf/cassandra-env.sh

    -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT
  14. Commit Log Failure Handling (CASSANDRA-6364) ! ERROR [PERIODIC-COMMIT-LOG-SYNCER] 2014-… CommitLog.java:350

    - Failed to persist commits to disk. Commit disk failure policy is stop; terminating thread ! java.io.IOException: Something broke. at org.apache.cassandra.db.commitlog.AbstractCommitLogService $1.run(AbstractCommitLogService.java:123) at java.lang.Thread.run(Thread.java:744)
  15. Add file_cache_size_in_mb setting (CASSANDRA-5661) ! # Total memory to use

    for sstable-reading buffers. # Defaults to # the smaller of 1/4 of heap or 512MB # file_cache_size_in_mb: 512
  16. Add file_cache_size_in_mb setting (CASSANDRA-5661) File Readers have a 64 KB

    buffer. Compressed File Readers have two 64 KB buffers.
  17. Improve 2.1 flush defaults (CASSANDRA-7551) ! # memtable_flush_writers defaults to

    the smaller of (number of # disks, number of cores), with a minimum of 2 and a maximum of 8. # # If your data directories are backed by SSD, you should increase # this to the number of cores. # memtable_flush_writers: 8
  18. New concurrent_compactors Defaults (CASSANDRA-7139) ! # concurrent_compactors defaults to the

    smaller of (number # of disks, number of cores), with a minimum of 2 and a # maximum of 8. # # If your data directories are backed by SSD, you should # increase this to the number of cores. # concurrent_compactors: 1
  19. Throw Error When Frame Too Large (CASSANDRA-5981) ! # native_transport_max_frame_size_in_mb:

    256 ! Improves Existing Behaviour, InvalidRequestException now thrown.
  20. Drop queries reading many Tombstones (CASSANDRA-6117) WARN [main] … !

    SliceQueryFilter.java:236 - Read 2 live and 4 tombstoned cells in system.schema_columnfamilies (see tombstone_warn_threshold). 2147483631 columns was requested, slices=[-], delInfo={deletedAt=-9223372036854775808, localDeletion=2147483647}
  21. Drop query that using Tombstones (CASSANDRA-6117) ! ERROR [SharedPool-Worker-7] …

    ! SliceQueryFilter.java:212 - Scanned over 100000 tombstones in system.schema_columns; query aborted (see tombstone_fail_threshold)
  22. Log a Warning for Large Batches (CASSANDRA-6487) ! WARN [Native-Transport-Requests:553]…

    ! BatchStatement.java (line 228) Batch of prepared statements for [Keyspace1.Standard1] is of size 6165, exceeding specified threshold of 5120 by 1045.
  23. Alias Support For SELECT Statement (CASSANDRA-5075) ! cqlsh:dev> select foo

    as total_foo from foo; ! total_foo ----------- bar baz ! (2 rows)
  24. An Official Way To Disable Compaction (CASSANDRA-5074) ! create table

    no_compaction_for_you ( foo text, bar text, primary key (foo, bar) ) with compaction = { 'enabled' : false, 'class' : 'SizeTieredCompactionStrategy' };
  25. Aggressive Tombstone Compactions (CASSANDRA-6563) ! CREATE TABLE foo ( foo

    text primary key, bar text ) WITH compaction = { 'class' : 'SizeTieredCompactionStrategy', 'unchecked_tombstone_compaction' : 'true' };
  26. Pass cqlsh Statements via Command Line CASSANDRA-7172 ! bin/cqlsh --execute="select

    distinct foo from dev.foo;" ! foo ------- three one five two four ! (5 rows)
  27. Include CQL in Error Messages (CASSANDRA-7111) ! cqlsh:dev> SELECT foo

    bar from foo; ! <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:11 no viable alternative at input 'bar'"> cqlsh:dev> !
  28. Set & Get Logging Levels via nodetool (CASSANDRA-7090) ! nodetool

    getlogginglevels Logger Name Log Level ROOT INFO com.thinkaurelius.thrift ERROR ! nodetool setlogginglevel org.apache.cassandra.db.Row DEBUG ! nodetool getlogginglevels Logger Name Log Level ROOT INFO com.thinkaurelius.thrift ERROR org.apache.cassandra.db.Row DEBUG
  29. Add listsnapshots To nodetool (CASSANDRA-5742) ! nodetool listsnapshots ! Snapshot

    Details: Snapshot name Keyspace name Column family True size Size on disk pre-migration Keyspace1 Standard1 508.03 MB 555.59 MB all-good Keyspace1 Standard1 549.01 MB 803.68 MB ! Total TrueDiskSpaceUsed: 1.03 GB
  30. Add Snapshot Space Used To cfstats (CASSANDRA-6231) ! Table: Standard1

    SSTable count: 4 Space used (live), bytes: 76875505 Space used (total), bytes: 76875505 Space used by snapshots (total), bytes: 1108391939
  31. Save Compaction History (CASSANDRA-5078) ! nodetool compactionhistory ! id keyspace

    columnfamily compacted_at bytes_in bytes_out 31...9d Keyspace1 Standard1 1410287780455 488451903 174360500 51...9d Keyspace1 Standard1 1410287834272 527847260 256812363
  32. Repairing Between Specific Replicas (CASSANDRA-6440) ! nodetool repair [(-dc <specific_dc>

    | --in-dc <specific_dc>)...] [(-hosts <specific_host> | --in-hosts <specific_host>)]
  33. Reset SSTable LCS Compaction Level (CASSANDRA-5271) ! sstablelevelreset --really-reset Keyspace1

    Standard1 ! ! Changing level from 1 to 0 on …/Keyspace1-Standard1-ka-35-Data.db ! Skipped .../Keyspace1-Standard1-ka-33-Data.db since it is already on level 0 ! Changing level from 1 to 0 on …/Keyspace1-Standard1-ka-32-Data.db ! Skipped .../Keyspace1-Standard1-ka-34-Data.db since it is already on level 0 !
  34. Unique Column Family Directories (CASSANDRA-5202) ls -lah data/data/Keyspace1/ ! drwxr-xr-x

    Counter1-89df6990386511e48bb41d4c6fbb569d drwxr-xr-x Counter3-89f20730386511e48bb41d4c6fbb569d drwxr-xr-x Standard1-89df4280386511e48bb41d4c6fbb569d
  35. Specify Cells To Cache Per Row (CASSANDRA-5357) create table row_cache

    ( foo text, bar text, primary key (foo, bar) ) with rows_per_partition_to_cache = 10;
  36. Use hibernate when join_ring is false (CASSANDRA-6961) Use when returning

    a node that as been down for longer than the Hint window.
  37. Add Manifest Describing Snapshot Files (CASSANDRA-6326) ! { "files": [

    "Keyspace1-Standard1-ka-1-Data.db", "Keyspace1-Standard1-ka-3-Data.db", "Keyspace1-Standard1-ka-2-Data.db", "Keyspace1-Standard1-ka-5-Data.db", "Keyspace1-Standard1-ka-4-Data.db" ] }
  38. Track min/max Clustered Values (CASSANDRA-5514) ! CREATE TABLE temperature (

    weatherstation_id text, event_time timestamp, temperature text, PRIMARY KEY (weatherstation_id,event_time) );
  39. Track min/max Clustered Values (CASSANDRA-5514) ! SELECT event_time, temperature FROM

    temperature WHERE weatherstation_id='1234ABCD' AND event_time >= '2013-04-03 07:01:00' AND event_time <= '2013-04-03 07:04:00';
  40. Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License

    Aaron Morton @aaronmorton ! Co-Founder & Principal Consultant www.thelastpickle.com ! Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License