<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1327521981890211928</id><updated>2026-06-15T15:51:17.873+05:30</updated><title type='text'>Getting started with cassandra</title><subtitle type='html'>Getting started with cassandra and hector api</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>58</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-984006856440355612</id><published>2014-06-06T12:31:00.003+05:30</published><updated>2014-06-06T12:32:57.167+05:30</updated><title type='text'>Cassandra CQL3 - Range Queries</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Range Queries
using CQL3 :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Once of the major
advantage of using Cassandra via thrift was using the hashmap like structure .
But with cql3 , it doesn’t appear to be available in a very straight forward
way .. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;But do not worry
, it is very simple . No Maps are not the perfect replacement , because it is
not possible to do range queries on a map right now &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;There is a better
way to do it .. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Let us create a
column family called testrange &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;
CREATE TABLE testrange (&lt;br /&gt;
&amp;nbsp; key TEXT,&lt;br /&gt;
&amp;nbsp; detail_key int,&lt;br /&gt;
&amp;nbsp; detal_value text,&lt;br /&gt;
&amp;nbsp; PRIMARY KEY (key, detail_key)&lt;br /&gt;
);&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;We are creating
the PK as key coupled with detail_key , this will force all the entries with
same key to be a single row and each different detail_key will be a column name
and we can do a =,&amp;lt;,&amp;gt; query on detail_key&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Lets try this now
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
describe columnfamily testrange;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;CREATE TABLE
testrange (&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; key text,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; detail_key int,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; detal_value text,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; PRIMARY KEY (key, detail_key)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;) WITH&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; bloom_filter_fp_chance=0.010000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; caching=&#39;KEYS_ONLY&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; comment=&#39;&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; dclocal_read_repair_chance=0.000000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; gc_grace_seconds=864000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; index_interval=128 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; read_repair_chance=0.100000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; replicate_on_write=&#39;true&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; populate_io_cache_on_flush=&#39;false&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; default_time_to_live=0 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; speculative_retry=&#39;99.0PERCENTILE&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; memtable_flush_period_in_ms=0 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; compaction={&#39;class&#39;:
&#39;SizeTieredCompactionStrategy&#39;} AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; compression={&#39;sstable_compression&#39;:
&#39;LZ4Compressor&#39;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Inserting a few
records&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
insert into testrange (key,detail_key,detal_value) VALUES (&#39;1&#39;,1,&#39;number one&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
insert into testrange (key,detail_key,detal_value) VALUES (&#39;1&#39;,2,&#39;number two&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
insert into testrange (key,detail_key,detal_value) VALUES (&#39;1&#39;,3,&#39;number
three&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
insert into testrange (key,detail_key,detal_value) VALUES (&#39;1&#39;,4,&#39;number
four&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
insert into testrange (key,detail_key,detal_value) VALUES (&#39;1&#39;,5,&#39;number
five&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testrange;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;key | detail_key | detal_value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;-----+------------+--------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
1 |&amp;nbsp;&amp;nbsp; number one&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
2 |&amp;nbsp;&amp;nbsp; number two&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
3 | number three&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
4 |&amp;nbsp; number four&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
5 |&amp;nbsp; number five&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;(5 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;So far , so good …
now lets execute the range queries .. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testrange where key = &#39;1&#39; and detail_key &amp;gt; 2 and detail_key
&amp;lt;=4;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;key | detail_key | detal_value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;-----+------------+--------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
3 | number three&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
4 |&amp;nbsp; number four&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;(2 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Cool , but how do
we confirm if we are using the same range query type query that was offered by Cassandra
thrift . &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Lets jump back to
the cli &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;[default@testkeyspace]
list testrange;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Using default
limit of 100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Using default
cell limit of 100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;-------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;RowKey: 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt; (name=1:,
value=, timestamp=1402037639440000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt;
(name=1:detal_value, value=6e756d626572206f6e65, timestamp=1402037639440000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt; (name=2:,
value=, timestamp=1402037649568000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt;
(name=2:detal_value, value=6e756d6265722074776f, timestamp=1402037649568000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt; (name=3:,
value=, timestamp=1402037659783000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt;
(name=3:detal_value, value=6e756d626572207468726565,
timestamp=1402037659783000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt; (name=4:,
value=, timestamp=1402037668866000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt;
(name=4:detal_value, value=6e756d62657220666f7572, timestamp=1402037668866000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt; (name=5:,
value=, timestamp=1402037677374000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;=&amp;gt;
(name=5:detal_value, value=6e756d6265722066697665, timestamp=1402037677374000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;1 Row Returned.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Elapsed time: 294
msec(s).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;[default@testkeyspace]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;So , we have only
one row and all out detail_key are columns .. which is almost similar to what
we used to do earlier with thrift. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/984006856440355612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2014/06/cassandra-cql3-range-queries.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/984006856440355612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/984006856440355612'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2014/06/cassandra-cql3-range-queries.html' title='Cassandra CQL3 - Range Queries'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-1267777503591871027</id><published>2014-06-06T12:30:00.000+05:30</published><updated>2014-06-06T12:30:25.301+05:30</updated><title type='text'>Apache Cassandra - Getting started with CQL 3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Getting started
with cql3 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; Lets step through some basics of cassandra
cql3 . I am going to assume you have already install cassandra and ready to get
into cqlsh&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;lt;cassandra_home&amp;gt;#
bin/cqlsh&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Connected to Test
Cluster at localhost:9160.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;[cqlsh 4.1.1 |
Cassandra 2.0.8 | CQL spec 3.1.1 | Thrift protocol 19.39.0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Use HELP for
help.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Now we are ready
to run some queries . &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Lets create a
keyspace to start with . Keyspace is the same as database if you are coming
from sql land&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh&amp;gt; CREATE
KEYSPACE testkeyspace WITH replication = {&#39;class&#39;: &#39;SimpleStrategy&#39;,
&#39;replication_factor&#39; : 1};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;now the keyspace
has been created..&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;lets use the
keyspace&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh&amp;gt; USE
testkeyspace;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;now we have a
keyspace with replication factor 1 . &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;if you want to
change your keyspace rf , you can alter at any point of time &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;ALTER KEYSPACE
testkeyspace WITH replication = {&#39;class&#39;: &#39;SimpleStrategy&#39;,
&#39;replication_factor&#39; : 2};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;this will require
you to have a two node cluster setup&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Dropping keyspace
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;DROP KEYSPACE
testkeyspace;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;yeah , simple so
far&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Now lets create a
simple table &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;CREATE TABLE
testtable(id text PRIMARY KEY, name text, avg varint, age int) WITH
comment=&#39;Test table&#39; AND read_repair_chance = 1.0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Running a basic
select query is very simple &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testtable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;(0 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Lets describe the
table quickly&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
describe columnfamily testtable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;CREATE TABLE
testtable (&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; id text,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; age int,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; avg varint,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; name text,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; PRIMARY KEY (id)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;) WITH&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; bloom_filter_fp_chance=0.010000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; caching=&#39;KEYS_ONLY&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; comment=&#39;Test table&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; dclocal_read_repair_chance=0.000000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; gc_grace_seconds=864000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; index_interval=128 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; read_repair_chance=1.000000 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; replicate_on_write=&#39;true&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; populate_io_cache_on_flush=&#39;false&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; default_time_to_live=0 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; speculative_retry=&#39;99.0PERCENTILE&#39; AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; memtable_flush_period_in_ms=0 AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; compaction={&#39;class&#39;:
&#39;SizeTieredCompactionStrategy&#39;} AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; compression={&#39;sstable_compression&#39;:
&#39;LZ4Compressor&#39;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;column family is
similar to a table in sql &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Now , let us
insert some data into the column family &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
insert into testtable (id,age,avg,name) values(&#39;1&#39;,23,10,&#39;Arunn&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;and select&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testtable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;id | age | avg | name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;----+-----+-----+-------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; 1 |&amp;nbsp; 23
|&amp;nbsp; 10 | Arunn&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;(1 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Altering a table
and adding fields is simple &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 13.5pt;&quot;&gt;ALTER TABLE testtable ADD gender varchar;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
ALTER TABLE testtable ADD gender varchar;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testtable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;id | age | avg | gender | name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;----+-----+-----+--------+-------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; 1 |&amp;nbsp; 23
|&amp;nbsp; 10 |&amp;nbsp;&amp;nbsp;
null | Arunn&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;(1 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Updates are very
simple too &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
update testtable set gender = &#39;MALE&#39; where id = &#39;1&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testtable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;id | age | avg | gender | name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;----+-----+-----+--------+-------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp; 1 |&amp;nbsp; 23
|&amp;nbsp; 10 |&amp;nbsp;&amp;nbsp;
MALE | Arunn&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;(1 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Now lets try a
simple delete and we are done with basic operations&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
delete from testtable where id = &#39;1&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testtable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;(0 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Now we know how
to create &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Keyspace&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Column
family / CF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Insert
data &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Alter CF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Update
row&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Delete
row&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Immediate
interesting thing is to try batch operations , this saves network round-trips&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;BEGIN BATCH&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;insert into
testtable (id,age,avg,gender,name) values(&#39;2&#39;,30,19, &#39;MALE&#39;,&#39;Abc&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;insert into
testtable (id,age,avg,gender,name) values(&#39;3&#39;,40,16, &#39;MALE&#39;,&#39;Def&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;update testtable
set name = &#39;Ghi&#39; where id = &#39;3&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;APPLY BATCH;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Counters are a
very important column type in Cassandra &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;Counters&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;The&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;counter&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;type is used to define&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;counter columns&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;. A counter column is a column whose value is a
64-bit signed integer and on which 2 operations are supported: incrementation
and decrementation Note the value of a counter cannot be set. A counter doesn’t
exist until first incremented/decremented, and the first
incrementation/decrementation is made as if the previous value was 0. Deletion
of counter columns is supported but have some limitations (see the&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;a href=&quot;http://wiki.apache.org/cassandra/Counters&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #111111; font-size: 10.5pt; mso-bidi-font-size: 11.0pt; text-decoration: none; text-underline: none;&quot;&gt;Cassandra Wiki&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;for more information).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;The use of the counter
type is limited in the following way:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It cannot be used for column that is part of the&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;PRIMARY KEY&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;of a table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;A table that contains a counter can only contain
     counters. In other words, either all the columns of a table outside the&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;PRIMARY KEY&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;have the counter type, or none of them have it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;Map column types are
interesting to store a collection of data . Cassandra also supports set and
list types &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
create table testmaptable (id text PRIMARY KEY , clus_columns
map&amp;lt;int,text&amp;gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testmaptable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;(0 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
insert into testmaptable (id,clus_columns) values (&#39;1&#39;,{1:&#39;number one&#39;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testmaptable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;id | clus_columns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;----+-------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp; 1 | {1: &#39;number one&#39;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;(1 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
update testmaptable set clus_columns = {2:&#39;number two&#39;} where id = &#39;1&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testmaptable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;id | clus_columns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;----+-------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp; 1 | {2: &#39;number two&#39;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;(1 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
update testmaptable set clus_columns = clus_columns + {1:&#39;number one&#39;} where id
= &#39;1&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;cqlsh:testkeyspace&amp;gt;
select * from testmaptable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;id | clus_columns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;----+------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp; 1 | {1: &#39;number one&#39;, 2: &#39;number two&#39;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;(1 rows)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;Lets take a look at how
it looks in the cassandra cli &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;lt;Cassandra_home&amp;gt;
bin/Cassandra-cli –host localhost&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;Use testkeyspace;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;[default@testkeyspace]
list testmaptable;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;Using default limit of
100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;Using default cell limit
of 100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;-------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;RowKey: 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;=&amp;gt; (name=, value=,
timestamp=1402035929908000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;=&amp;gt;
(name=clus_columns:00000001, value=6e756d626572206f6e65,
timestamp=1402036016296000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;=&amp;gt;
(name=clus_columns:00000002, value=6e756d6265722074776f, timestamp=1402035971589000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;1 Row Returned.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;Elapsed time: 429
msec(s).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/1267777503591871027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2014/06/apache-cassandra-getting-started-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1267777503591871027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1267777503591871027'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2014/06/apache-cassandra-getting-started-with.html' title='Apache Cassandra - Getting started with CQL 3'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-6569439738778430382</id><published>2012-10-01T16:30:00.002+05:30</published><updated>2012-10-01T16:31:38.777+05:30</updated><title type='text'>Installing Cassandra</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;h2 id=&quot;Introduction&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Introduction&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-5&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;This document aims to provide a few easy to follow steps to take the first-time user from installation, to running single node Cassandra, and overview to configure multinode cluster.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-6&quot;&gt;&lt;/span&gt;Cassandra is meant to run on a cluster of nodes, but will run equally well on a single machine. This is a handy way of getting familiar with the software while avoiding the complexities of a larger system.&lt;span class=&quot;anchor&quot; id=&quot;line-7&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-8&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h2 id=&quot;Step_0:_Prerequisites_and_connection_to_the_community&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 0: Prerequisites and connection to the community&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-9&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Cassandra requires the most stable version of Java 1.6 you can deploy. For Sun&#39;s jvm, this means at least u19; u21 is better. Cassandra also runs on the IBM jvm, and should run on jrockit as well.&lt;span class=&quot;anchor&quot; id=&quot;line-10&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-11&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;The best way to ensure you always have up to date information on the project, releases, stability, bugs, and features is to subscribe to the users mailing list (&lt;a class=&quot;mailto&quot; href=&quot;mailto:user-subscribe@cassandra.apache.org&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;subscription required&lt;/a&gt;) and participate in the #cassandra channel on&amp;nbsp;&lt;a class=&quot;http&quot; href=&quot;http://webchat.freenode.net/?channels=#cassandra&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;IRC&lt;/a&gt;.&lt;span class=&quot;anchor&quot; id=&quot;line-12&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-13&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;picking_a_version&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-14&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;download_a_kit&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-15&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-16&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h2 id=&quot;Step_1:_Download_Cassandra_Kit&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 1: Download Cassandra Kit&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-17&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-18&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Download links for the latest stable release can always be found on the&amp;nbsp;&lt;a class=&quot;http&quot; href=&quot;http://cassandra.apache.org/download&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;website&lt;/a&gt;.&lt;span class=&quot;anchor&quot; id=&quot;line-19&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Users of Debian or Debian-based derivatives can install the latest stable release in package form, see&amp;nbsp;&lt;a href=&quot;http://wiki.apache.org/cassandra/DebianPackaging&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;DebianPackaging&lt;/a&gt;&amp;nbsp;for details.&lt;span class=&quot;anchor&quot; id=&quot;line-20&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Users of RPM-based distributions can get packages from&amp;nbsp;&lt;a class=&quot;http&quot; href=&quot;http://www.datastax.com/blog/announcing-rpms-cassandra&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;Datastax&lt;/a&gt;.&lt;span class=&quot;anchor&quot; id=&quot;line-21&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;If you are interested in building Cassandra from source, please refer to&amp;nbsp;&lt;a href=&quot;http://wiki.apache.org/cassandra/HowToBuild&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;How to Build&lt;/a&gt;&amp;nbsp;page.&lt;span class=&quot;anchor&quot; id=&quot;line-22&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-23&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;For more details about misc builds, please refer to&amp;nbsp;&lt;a href=&quot;http://wiki.apache.org/cassandra/VersionsAndBuilds&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;Cassandra versions and builds&lt;/a&gt;&amp;nbsp;page.&lt;span class=&quot;anchor&quot; id=&quot;line-24&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-25&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;If you plan to run &quot;snapshot&quot; command on Cassandra, it will be better to install jna.jar also. Please refer to&amp;nbsp;&lt;a href=&quot;http://wiki.apache.org/cassandra/Operations#Backing_up_data&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;Backup Data&lt;/a&gt;&amp;nbsp;section.&lt;span class=&quot;anchor&quot; id=&quot;line-26&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-27&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;running_a_single_node&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-28&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-29&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h2 id=&quot;Step_2:_Edit_configuration_files&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 2: Edit configuration files&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-30&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-31&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Cassandra configuration files can be found in&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;conf&lt;/tt&gt;&amp;nbsp;directory under the top directory of binary and source distributions.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-32&quot;&gt;&lt;/span&gt;If you have installed cassandra from RPM packages, configuration files will be placed into&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;/etc/cassandra/conf&lt;/tt&gt;.&lt;span class=&quot;anchor&quot; id=&quot;line-33&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-34&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h3 id=&quot;Step_2.1:_Edit_cassandra.yaml&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 2.1: Edit cassandra.yaml&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-35&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;The distribution&#39;s sample configuration&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;conf/cassandra.yaml&lt;/tt&gt;&amp;nbsp;contains reasonable defaults for single node operation, but you will need to make sure that the paths exist for&lt;strong&gt;data_file_directories&lt;/strong&gt;,&amp;nbsp;&lt;strong&gt;commitlog_directory&lt;/strong&gt;, and&amp;nbsp;&lt;strong&gt;saved_caches_directory&lt;/strong&gt;.&lt;span class=&quot;anchor&quot; id=&quot;line-36&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-37&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Verify&amp;nbsp;&lt;strong&gt;storage_port&lt;/strong&gt;&amp;nbsp;and&amp;nbsp;&lt;strong&gt;rpc_port&lt;/strong&gt;&amp;nbsp;are not conflict with other service on your computer.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-38&quot;&gt;&lt;/span&gt;By default, Cassandra uses 7000 for storage_port, and 9160 for rpc_port. The&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;storage_port&lt;/tt&gt;&amp;nbsp;must be identical between Cassandra nodes in a cluster. Cassandra client applications will use&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;rpc_port&lt;/tt&gt;&amp;nbsp;to connect to Cassandra.&lt;span class=&quot;anchor&quot; id=&quot;line-39&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-40&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;It will be a good idea to change&amp;nbsp;&lt;strong&gt;cluster_name&lt;/strong&gt;&amp;nbsp;to avoid unnecessary conflict with existing clusters.&lt;span class=&quot;anchor&quot; id=&quot;line-41&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-42&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;strong&gt;initial_token&lt;/strong&gt;. You can leave it blank, but I recommend you to set it to 0 if you are configuring your first node.&lt;span class=&quot;anchor&quot; id=&quot;line-43&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-44&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h3 id=&quot;Step_2.2:_Edit_log4j-server.properties&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 2.2: Edit log4j-server.properties&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-45&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;conf/log4j.properties&lt;/tt&gt;&amp;nbsp;contains a path for the log file. Edit the line if you need.&lt;span class=&quot;anchor&quot; id=&quot;line-46&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-47&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-48&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-49&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 16px; padding: 5pt; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: black; color: white;&quot;&gt;# Edit the next line to point to your logs directory
log4j.appender.R.File=/var/log/cassandra/system.log&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-50&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-51&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h3 id=&quot;Step_2.3:_Edit_cassandra-env.sh&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 2.3: Edit cassandra-env.sh&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-52&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Cassandra has JMX (Java Management Extensions) interface, and the JMX_PORT is defined in&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;conf/cassandra-env.sh&lt;/tt&gt;.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-53&quot;&gt;&lt;/span&gt;Edit following line if you need.&lt;span class=&quot;anchor&quot; id=&quot;line-54&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-55&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-56&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-57&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-58&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 16px; padding: 5pt; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: black; color: white;&quot;&gt;# Specifies the default port over which Cassandra will be available for
# JMX connections.
JMX_PORT=&quot;7199&quot;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-59&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-60&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;By default, Cassandra will allocate memory based on physical memory your system has.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-61&quot;&gt;&lt;/span&gt;For example it will allocate 1GB heap on 2GB system, and 2GB heap on 8GB system.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-62&quot;&gt;&lt;/span&gt;If you want to specify Cassandra heap size, remove leading pound sign(#) on the following lines and specify memory size for them.&lt;span class=&quot;anchor&quot; id=&quot;line-63&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-64&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-65&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-66&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 16px; padding: 5pt; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: black; color: white;&quot;&gt;#MAX_HEAP_SIZE=&quot;4G&quot;
#HEAP_NEWSIZE=&quot;800M&quot;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-67&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;If you are not familiar with Java GC, 1/4 of MAX_HEAP_SIZE may be a good start point for HEAP_NEWSIZE.&lt;span class=&quot;anchor&quot; id=&quot;line-68&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-69&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Cassandra will need more than few GB heap for production use, but you can run it with smaller footprint for test drive. If you want to assign 128MB as max, edit the lines as following.&lt;span class=&quot;anchor&quot; id=&quot;line-70&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-71&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-72&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-73&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 16px; padding: 5pt; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: black; color: white;&quot;&gt;MAX_HEAP_SIZE=&quot;128M&quot;
HEAP_NEWSIZE=&quot;32M&quot;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-74&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;If you face&amp;nbsp;&lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/OutOfMemory&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;OutOfMemory&lt;/a&gt;&amp;nbsp;exceptions or massive GCs with this configuration, increase these values.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-75&quot;&gt;&lt;/span&gt;&lt;strong&gt;Don&#39;t start your production service with such tiny heap configuration!&lt;/strong&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-76&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-77&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Note for Mac Uses:&lt;span class=&quot;anchor&quot; id=&quot;line-78&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Some people running OS X have trouble getting Java 6 to work. If you&#39;ve kept up with Apple&#39;s updates, Java 6 should already be installed (it comes in Mac OS X 10.5 Update 1). Unfortunately, Apple does not default to using it. What you have to do is change your&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;JAVA_HOME&lt;/tt&gt;&amp;nbsp;environment setting to&lt;tt class=&quot;backtick&quot;&gt;/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home&lt;/tt&gt;&amp;nbsp;and add&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin&lt;/tt&gt;&amp;nbsp;to the beginning of your&lt;tt class=&quot;backtick&quot;&gt;PATH&lt;/tt&gt;.&lt;span class=&quot;anchor&quot; id=&quot;line-79&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-80&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h2 id=&quot;Step_3:_Start_up_Cassandra&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 3: Start up Cassandra&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-81&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;And now for the moment of truth, start up Cassandra by invoking&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;bin/cassandra&amp;nbsp;-f&lt;/tt&gt;&amp;nbsp;from the command line&lt;sup&gt;&lt;a href=&quot;http://wiki.apache.org/cassandra/GettingStarted#fnref-cac370d9c0a5bbfcc8ba5b7e5a5e742501e0181d&quot; id=&quot;fndef-cac370d9c0a5bbfcc8ba5b7e5a5e742501e0181d-0&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. The service should start in the foreground and log gratuitously to standard-out. Assuming you don&#39;t see messages with scary words like &quot;error&quot;, or &quot;fatal&quot;, or anything that looks like a Java stack trace, then chances are you&#39;ve succeeded.&lt;span class=&quot;anchor&quot; id=&quot;line-82&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-83&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Press &quot;Control-C&quot; to stop Cassandra.&lt;span class=&quot;anchor&quot; id=&quot;line-84&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-85&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;If you start up Cassandra without &quot;-f&quot; option, it will run in background, so you need to kill the process to stop.&lt;span class=&quot;anchor&quot; id=&quot;line-86&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-87&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;/div&gt;
&lt;h2 id=&quot;Step_4:_Using_cassandra-cli&quot; style=&quot;font-family: sans-serif;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;
Step 4: Using cassandra-cli&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-88&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-89&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;bin/cassandra-cli&lt;/tt&gt;&amp;nbsp;is a interactive command line interface for Cassandra. You can define schema, store and fetch data with the tool.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-90&quot;&gt;&lt;/span&gt;Run following command to connect to your Cassandra instance.&lt;span class=&quot;anchor&quot; id=&quot;line-91&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-92&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-93&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-94&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-95&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-96&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 16px; padding: 5pt; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: black; color: white;&quot;&gt;bin/cassandra-cli -h host -p rpc_port

example:
% bin/cassandra-cli -h 127.0.0.1 -p 9160&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-97&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-98&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Then you will see following cassandra-cli prompt.&lt;span class=&quot;anchor&quot; id=&quot;line-99&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-100&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-101&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-102&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-103&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-104&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-105&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-106&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-107&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-108&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 16px; padding: 5pt; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: black; color: white;&quot;&gt;Connected to: &quot;Test Cluster&quot; on 127.0.0.1/9160
Welcome to Cassandra CLI version 1.0.7

Type &#39;help;&#39; or &#39;?&#39; for help.
Type &#39;quit;&#39; or &#39;exit;&#39; to quit.

[default@unknown] &lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/6569439738778430382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/10/installing-cassandra.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/6569439738778430382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/6569439738778430382'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/10/installing-cassandra.html' title='Installing Cassandra'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-1696240262141305328</id><published>2012-09-18T07:48:00.001+05:30</published><updated>2012-09-18T07:49:07.952+05:30</updated><title type='text'>Apache Cassandra - Load Balancing the cluster</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;h3 id=&quot;Load_balancing&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Load balancing&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-115&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;When adding new nodes to the cluster, the data does not automatically get shared across new nodes equally and share load proportionately. This will make the cluster completely unbalanced.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;In order to make the data get shared equally we need to shift the token range some by using the nodetool move command.&lt;span class=&quot;anchor&quot; id=&quot;line-117&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Token ranges must be calculated in a way that will make sharing of data almost equal in each of the node.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Here&#39;s a python program which can be used to calculate new tokens for the nodes.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-119&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;def tokens(nodes):&lt;span class=&quot;anchor&quot; id=&quot;line-120&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;for x in xrange(nodes):&lt;span class=&quot;anchor&quot; id=&quot;line-121&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;print 2 ** 127 / nodes * x&lt;span class=&quot;anchor&quot; id=&quot;line-122&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-123&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Run this py program for each node and try the nodetool ring command . This will tell you the load on each of the node connected to the cluster. Run the program on each node again if needed until you see the nodetool ring display the load to be shared equally between each node.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;In versions of Cassandra 0.7.* and lower, there&#39;s also&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;loadbalance&lt;/tt&gt;: essentially a convenience over decommission + bootstrap, only instead of telling the target node where to move on the ring it will choose its location based on the same heuristic as Token selection on bootstrap. You should not use this as it doesn&#39;t rebalance the entire ring.&lt;span class=&quot;anchor&quot; id=&quot;line-124&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-125&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;The status of move and balancing operations can be monitored using&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;nodetool&lt;/tt&gt;&amp;nbsp;with the&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;netstat&lt;/tt&gt;&amp;nbsp;argument. (Cassandra 0.6.* and lower use the&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;streams&lt;/tt&gt;&amp;nbsp;argument).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/1696240262141305328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/09/apache-cassandra-load-balancing-cluster.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1696240262141305328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1696240262141305328'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/09/apache-cassandra-load-balancing-cluster.html' title='Apache Cassandra - Load Balancing the cluster'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-412967077541429353</id><published>2012-09-18T07:43:00.001+05:30</published><updated>2012-09-18T07:49:37.913+05:30</updated><title type='text'>Apache Cassandra - Moving a node to a different token range </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;h3 id=&quot;Moving_nodes&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Moving nodes&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-110&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line867&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;move&lt;/tt&gt;: move the target node to a given Token. Moving is both a convenience over and more efficient than decommission + bootstrap. After moving a node,&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;cleanup&lt;/tt&gt;&amp;nbsp;should be run to remove any unnecessary data.&lt;span class=&quot;anchor&quot; id=&quot;line-111&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-112&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;As with bootstrap, see&amp;nbsp;Streaming&amp;nbsp;for how to monitor progress.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Streaming :&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/div&gt;&lt;h3 id=&quot;Transfer&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Transfer&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-6&quot; style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;The following steps occur for Stream Transfers.&lt;span class=&quot;anchor&quot; id=&quot;line-7&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Source has a list of ranges it must transfer to another node.&lt;span class=&quot;anchor&quot; id=&quot;line-8&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Source copies the data in those ranges to sstable files in preparation for streaming. This is called anti-compaction (because compaction merges multiple sstable files into one, and this does the opposite).&lt;span class=&quot;anchor&quot; id=&quot;line-9&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Source builds a list of Pending&lt;tt class=&quot;backtick&quot;&gt;&lt;/tt&gt;File&#39;s which contains information on each sstable to be transfered.&lt;span class=&quot;anchor&quot; id=&quot;line-10&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Source starts streaming the first file from the list, followed by the log &quot;Waiting for transfer to $some_node to complete&quot;. The header for the stream contains information on the streamed file for the Destination to interpret what to do with the incoming stream.&lt;span class=&quot;anchor&quot; id=&quot;line-11&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Destination receives the file writes it to disk and sends a File&lt;tt class=&quot;backtick&quot;&gt;&lt;/tt&gt;Status.&lt;span class=&quot;anchor&quot; id=&quot;line-12&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;On successful transfer the Source streams the next file until its done, on error it re-streams the same file.&lt;span class=&quot;anchor&quot; id=&quot;line-13&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-14&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line867&quot;&gt;&lt;/div&gt;&lt;h3 id=&quot;Request&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Request&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-15&quot; style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Destination compiles a list of ranges it needs from another node.&lt;span class=&quot;anchor&quot; id=&quot;line-16&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Destination sends a Stream&lt;tt class=&quot;backtick&quot;&gt;&lt;/tt&gt;Request&lt;tt class=&quot;backtick&quot;&gt;&lt;/tt&gt;Message to the Source node with the list of ranges.&lt;span class=&quot;anchor&quot; id=&quot;line-17&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Source prepares the SSTables for those ranges and creates the Pending&lt;tt class=&quot;backtick&quot;&gt;&lt;/tt&gt;File&#39;s.&lt;span class=&quot;anchor&quot; id=&quot;line-18&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Source starts streaming the first file in the list. The header for the first stream contains info of the current stream and a list of the remaining Pending&lt;tt class=&quot;backtick&quot;&gt;&lt;/tt&gt;File&#39;s that fall in the requested ranges.&lt;span class=&quot;anchor&quot; id=&quot;line-19&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Destination receives the stream and writes it to disk, followed by the log message &quot;Streaming added org.apache.cassandra.io.sstable.SSTableReader(path=&#39;/var/lib/cassandra/data/Keyspace1/Standard1-e-1-Data.db&#39;)&quot;.&lt;span class=&quot;anchor&quot; id=&quot;line-20&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Destination then takes the lead and requests the remaining files one at a time. If an error occurs it re-requests the same file, if not continues with the next file until done.&lt;span class=&quot;anchor&quot; id=&quot;line-21&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Source streams each of the requested files. The files are already anti-compacted, so it just streams them to the Destination.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/412967077541429353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/09/apache-cassandra-moving-node-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/412967077541429353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/412967077541429353'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/09/apache-cassandra-moving-node-to.html' title='Apache Cassandra - Moving a node to a different token range '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-4027633812473818523</id><published>2012-09-18T07:41:00.001+05:30</published><updated>2012-09-18T07:50:07.816+05:30</updated><title type='text'>Apache Cassandra - How to remove nodes from a live cluster</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;If you have decided to remove a node from a live cluster you can follow one of the two options based on which one suits you better.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Nodetool is available in the cassandra home directory&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;{CASSANDRA_HOME}/bin/nodetool decommission&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;{CASSANDRA_HOME}/bin/nodetool removetoken&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;h3 id=&quot;Removing_nodes_entirely&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Removing nodes entirely&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-105&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;b style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;* Decommission :&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;b style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;You can take a node out of the cluster with&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;decommission&lt;/tt&gt;&amp;nbsp;to a live node. This will assign the ranges the old node was responsible for to other nodes, and replicate the appropriate data there. If&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;decommission&lt;/tt&gt;&amp;nbsp;is used, the data will stream from the decommissioned node.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-107&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;No data is removed automatically from the node being decommissioned, so if you want to put the node back into service at a different token on the ring, it should be removed manually.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;b style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;* Remove Token :&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;b style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;You can execute nodetool removetoken on any available machine to remove a dead one. This will assign the token range the old node was applicable to other nodes.&amp;nbsp;If&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;removetoken&lt;/tt&gt;&amp;nbsp;is used, the data will stream from the remaining replicas.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/4027633812473818523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/09/apache-cassandra-how-to-remove-nodes.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/4027633812473818523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/4027633812473818523'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/09/apache-cassandra-how-to-remove-nodes.html' title='Apache Cassandra - How to remove nodes from a live cluster'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-3408002671577361322</id><published>2012-08-07T16:20:00.004+05:30</published><updated>2012-08-07T16:22:08.476+05:30</updated><title type='text'>Cassandra Hector - Fetch all rows</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;background-color: #444444; color: white;&quot;&gt;How to do a &quot;select * from my_table&quot; in cassandra using hector library ?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #444444;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
Did some googling around , and this seems to be working ...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #444444;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: #444444; color: white;&quot;&gt;public class Dumper {
    private final Cluster cluster;
    private final Keyspace keyspace;

    public Dumper() {
        this.cluster = HFactory.getOrCreateCluster(&quot;Name&quot;, &quot;hostname&quot;);
        this.keyspace = HFactory.createKeyspace(&quot;Keyspace&quot;, cluster, new QuorumAllConsistencyLevelPolicy());
    }

    public void run() {
        int row_count = 100;

        RangeSlicesQuery&amp;lt;UUID, String, Long&amp;gt; rangeSlicesQuery = HFactory
            .createRangeSlicesQuery(keyspace, UUIDSerializer.get(), StringSerializer.get(), LongSerializer.get())
            .setColumnFamily(&quot;Column Family&quot;)
            .setRange(null, null, false, 10)
            .setRowCount(row_count);

        UUID last_key = null;

        while (true) {
            rangeSlicesQuery.setKeys(last_key, null);
            System.out.println(&quot; &amp;gt; &quot; + last_key);

            QueryResult&amp;lt;OrderedRows&amp;lt;UUID, String, Long&amp;gt;&amp;gt; result = rangeSlicesQuery.execute();
            OrderedRows&amp;lt;UUID, String, Long&amp;gt; rows = result.get();
            Iterator&amp;lt;Row&amp;lt;UUID, String, Long&amp;gt;&amp;gt; rowsIterator = rows.iterator();

            // we&#39;ll skip this first one, since it is the same as the last one from previous time we executed
            if (last_key != null &amp;amp;&amp;amp; rowsIterator != null) rowsIterator.next();   

            while (rowsIterator.hasNext()) {
              Row&amp;lt;UUID, String, Long&amp;gt; row = rowsIterator.next();
              last_key = row.getKey();

              if (row.getColumnSlice().getColumns().isEmpty()) {
                continue;
              }


              System.out.println(row);
            }

            if (rows.getCount() &amp;lt; row_count)
                break;
        }
    }

    public static void main(String[] args) {
        new Dumper().run();
    }
}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: #444444; color: white;&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: #444444; color: white;&quot;&gt;
&lt;div style=&quot;border: 0px; clear: both; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; margin-bottom: 1em; padding: 0px; vertical-align: baseline; white-space: normal; word-wrap: break-word;&quot;&gt;This will page through the column family in pages of 100 rows. It will only fetch 10 columns for each row (you will want to page very long rows too).&lt;/div&gt;&lt;div style=&quot;border: 0px; clear: both; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; margin-bottom: 1em; padding: 0px; vertical-align: baseline; white-space: normal; word-wrap: break-word;&quot;&gt;This is for a column family with uuids for row keys, strings for column names and longs for values. Hopefully it should be obvious how to change this.&lt;/div&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/3408002671577361322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/08/cassandra-hector-fetch-all-rows.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/3408002671577361322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/3408002671577361322'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/08/cassandra-hector-fetch-all-rows.html' title='Cassandra Hector - Fetch all rows'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-1839618778625716281</id><published>2012-08-07T16:16:00.004+05:30</published><updated>2012-08-07T16:40:06.039+05:30</updated><title type='text'>Cassandra Replication Factor - What is it ?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;h3 id=&quot;Replication&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Replication&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-48&quot; style=&quot;color: white; font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;A Cassandra cluster always divides up the key space into ranges delimited by Tokens as described above, but additional replica placement is customizable via IReplicaPlacementStrategy in the configuration file. The standard strategies are&lt;span class=&quot;anchor&quot; id=&quot;line-49&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-50&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;li&gt;&lt;div class=&quot;line891&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;RackUnawareStrategy: replicas are always placed on the next (in increasing Token order) N-1 nodes along the ring&lt;span class=&quot;anchor&quot; id=&quot;line-51&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line891&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;RackAwareStrategy: replica 2 is placed in the first node along the ring the belongs in&amp;nbsp;&lt;strong&gt;another&lt;/strong&gt;&amp;nbsp;data center than the first; the remaining N-2 replicas, if any, are placed on the first nodes along the ring in the&amp;nbsp;&lt;strong&gt;same&lt;/strong&gt;&amp;nbsp;rack as the first&lt;span class=&quot;anchor&quot; id=&quot;line-52&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-53&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Note that with RackAwareStrategy, succeeding nodes along the ring should alternate data centers to avoid hot spots. For instance, if you have nodes A, B, C, and D in increasing Token order, and instead of alternating you place A and B in DC1, and C and D in DC2, then nodes C and A will have disproportionately more data on them because they will be the replica destination for every Token range in the other data center.&lt;span class=&quot;anchor&quot; id=&quot;line-54&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-55&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;The corollary to this is, if you want to start with a single DC and add another later, when you add the second DC you should add as many nodes as you have in the first rather than adding a node or two at a time gradually.&lt;span class=&quot;anchor&quot; id=&quot;line-56&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-57&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Replication factor is not really intended to be changed in a live cluster either, but increasing it is conceptually simple: update the replication_factor from the CLI (see below), then run repair against each node in your cluster so that all the new replicas that are supposed to have the data, actually do.&lt;span class=&quot;anchor&quot; id=&quot;line-58&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-59&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Until repair is finished, you have 3 options:&lt;span class=&quot;anchor&quot; id=&quot;line-60&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-61&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;read at&amp;nbsp;&lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/ConsistencyLevel&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;ConsistencyLevel&lt;/a&gt;.QUORUM or ALL (depending on your existing replication factor) to make sure that a replica that actually has the data is consulted&lt;span class=&quot;anchor&quot; id=&quot;line-62&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-top: 0.25em;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;continue reading at lower CL, accepting that some requests will fail (usually only the first for a given query, if&amp;nbsp;&lt;a href=&quot;http://wiki.apache.org/cassandra/ReadRepair&quot; style=&quot;border: 0px; text-decoration: none;&quot;&gt;ReadRepair&lt;/a&gt;&amp;nbsp;is enabled)&lt;span class=&quot;anchor&quot; id=&quot;line-63&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;take downtime while repair runs&lt;span class=&quot;anchor&quot; id=&quot;line-64&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-65&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;The same options apply to changing replication strategy.&lt;span class=&quot;anchor&quot; id=&quot;line-66&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-67&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Reducing replication factor is easily done and only requires running cleanup afterwards to remove extra replicas.&lt;span class=&quot;anchor&quot; id=&quot;line-68&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-69&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;To update the replication factor on a live cluster, forget about cassandra.yaml. Rather you want to use&amp;nbsp;&lt;strong&gt;cassandra-cli&lt;/strong&gt;:&lt;span class=&quot;anchor&quot; id=&quot;line-70&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-71&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;update keyspace Keyspace1 with strategy_options = {replication_factor:3};&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/1839618778625716281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/08/cassandra-replication-factor-what-is-it.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1839618778625716281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1839618778625716281'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/08/cassandra-replication-factor-what-is-it.html' title='Cassandra Replication Factor - What is it ?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-7125168380723922775</id><published>2012-08-07T16:14:00.001+05:30</published><updated>2012-08-07T16:37:46.654+05:30</updated><title type='text'>Cassandra replication</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;h1 style=&quot;background-color: white; color: #003e7a; font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: normal; margin: 0px 0px 6px;&quot;&gt;&lt;/h1&gt;&lt;h1 style=&quot;font-size: 18px; font-weight: normal; margin: 0px 0px 6px;&quot;&gt;About Replication in Cassandra&lt;a class=&quot;headerlink&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/replication#about-replication-in-cassandra&quot; style=&quot;color: rgb(204, 204, 204) !important; margin: 0px 0px 0px 6px; text-decoration: none; visibility: visible;&quot; title=&quot;Permalink to this headline&quot;&gt;¶&lt;/a&gt;&lt;/h1&gt;&lt;div style=&quot;font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Replication is the process of storing copies of data on multiple nodes to ensure reliability and fault tolerance.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Cassandra stores copies, called replicas, of each row based on the row key. You set the number of replicas when you create a keyspace using the&amp;nbsp;&lt;em&gt;replica placement strategy&lt;/em&gt;. In addition to setting the number of replicas, this strategy sets the distribution of the replicas across the nodes in the cluster depending on the cluster’s topology.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;The total number of replicas across the cluster is referred to as the&amp;nbsp;&lt;em&gt;replication factor&lt;/em&gt;. A replication factor of 1 means that there is only one copy of each row on one node. A replication factor of 2 means two copies of each row, where each copy is on a different node. All replicas are equally important; there is no&amp;nbsp;&lt;em&gt;primary&lt;/em&gt;&amp;nbsp;or&lt;em&gt;master&lt;/em&gt;&amp;nbsp;replica. As a general rule, the replication factor should not exceed the number of nodes in the cluster. However, you can increase the replication factor and then add the desired number of nodes afterwards. When replication factor exceeds the number of nodes, writes are rejected, but reads are served as long as the desired&amp;nbsp;consistency level&amp;nbsp;can be met.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;To determine the physical location of nodes and their proximity to each other, the replication strategy also relies on the cluster-configured&amp;nbsp;&lt;em&gt;snitch&lt;/em&gt;, which is described below.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black; font-size: 13px; line-height: 20px;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;color: #0290cb; font-size: 18px; line-height: normal; margin: 0px 0px 15px;&quot;&gt;Replication Strategy&lt;a class=&quot;headerlink&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/replication#replication-strategy&quot; style=&quot;color: rgb(204, 204, 204) !important; margin: 0px 0px 0px 6px; text-decoration: none; visibility: visible;&quot; title=&quot;Permalink to this headline&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;The available strategies are:&lt;br /&gt;
&lt;ul class=&quot;simple&quot; style=&quot;line-height: normal;&quot;&gt;&lt;li style=&quot;line-height: 20px;&quot;&gt;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/replication#simplestrategy&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;SimpleStrategy&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 20px;&quot;&gt;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/replication#networktopologystrategy&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;NetworkTopologyStrategy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;section&quot; id=&quot;simplestrategy&quot; style=&quot;border-bottom-width: 0px; line-height: normal; margin: 0px 0px 20px; padding: 0px;&quot;&gt;&lt;span id=&quot;id2&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #9a9999; font-size: 18px; font-weight: normal; margin: 0px;&quot;&gt;SimpleStrategy&lt;a class=&quot;headerlink&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/replication#simplestrategy&quot; style=&quot;color: rgb(204, 204, 204) !important; margin: 0px 0px 0px 6px; text-decoration: none; visibility: hidden;&quot; title=&quot;Permalink to this headline&quot;&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div style=&quot;line-height: 20px;&quot;&gt;Use SimpleStrategy for simple single data center clusters. This strategy is the default replica placement strategy when creating a keyspace using the Cassandra CLI. See&amp;nbsp;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/dml/using_cli#create-keyspace-cli&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;Creating a Keyspace&lt;/a&gt;. When using the Cassandra Query Language interface, you must explicitly specify a strategy. See&amp;nbsp;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/references/cql/CREATE_KEYSPACE#cql-create-keyspace&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;CREATE KEYSPACE&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;line-height: 20px;&quot;&gt;SimpleStrategy places the first replica on a node determined by the&amp;nbsp;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/partitioning#partitioning&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;partitioner&lt;/a&gt;. Additional replicas are placed on the next nodes clockwise in the ring without considering rack or data center location.&lt;/div&gt;&lt;div style=&quot;line-height: 20px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;line-height: 20px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;line-height: 20px;&quot;&gt;&lt;/div&gt;&lt;h3 style=&quot;color: #9a9999; font-size: 18px; font-weight: normal; line-height: normal; margin: 0px;&quot;&gt;NetworkTopologyStrategy&lt;a class=&quot;headerlink&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/replication#networktopologystrategy&quot; style=&quot;color: rgb(204, 204, 204) !important; margin: 0px 0px 0px 6px; text-decoration: none; visibility: hidden;&quot; title=&quot;Permalink to this headline&quot;&gt;&lt;/a&gt;&lt;/h3&gt;Use&amp;nbsp;&lt;tt class=&quot;docutils literal&quot;&gt;NetworkTopologyStrategy&lt;/tt&gt;&amp;nbsp;when you have (or plan to have) your cluster deployed across multiple data centers. This strategy specify how many replicas you want in each data center.&lt;br /&gt;
When deciding how many replicas to configure in each data center, the two primary considerations are (1) being able to satisfy reads locally, without incurring cross-datacenter latency, and (2) failure scenarios. The two most common ways to configure multiple data center clusters are:&lt;br /&gt;
&lt;ul class=&quot;simple&quot; style=&quot;line-height: normal;&quot;&gt;&lt;li style=&quot;line-height: 20px;&quot;&gt;&lt;strong&gt;Two replicas in each data center&lt;/strong&gt;. This configuration tolerates the failure of a single node per replication group and still allows local reads at a&amp;nbsp;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/dml/data_consistency#tunable-consistency&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;consistency level&lt;/a&gt;&amp;nbsp;of&amp;nbsp;&lt;tt class=&quot;docutils literal&quot;&gt;ONE&lt;/tt&gt;.&lt;/li&gt;
&lt;li style=&quot;line-height: 20px;&quot;&gt;&lt;strong&gt;Three replicas in each data center&lt;/strong&gt;. This configuration tolerates the failure of a one node per replication group at a strong&amp;nbsp;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/dml/data_consistency#tunable-consistency&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;consistency level&lt;/a&gt;&amp;nbsp;of&amp;nbsp;&lt;tt class=&quot;docutils literal&quot;&gt;LOCAL_QUORUM&lt;/tt&gt;&amp;nbsp;or tolerates multiple node failures per data center using consistency level&amp;nbsp;&lt;tt class=&quot;docutils literal&quot;&gt;ONE&lt;/tt&gt;.&lt;/li&gt;
&lt;/ul&gt;Asymmetrical replication groupings are also possible. For example, you can have three replicas per data center to serve real-time application requests and use a single replica for running analytics.&lt;br /&gt;
The&amp;nbsp;&lt;tt class=&quot;docutils literal&quot;&gt;NetworkTopologyStrategy&lt;/tt&gt;&amp;nbsp;determines replica placement independently within each data center as follows:&lt;br /&gt;
&lt;ul class=&quot;simple&quot; style=&quot;line-height: normal;&quot;&gt;&lt;li style=&quot;line-height: 20px;&quot;&gt;The first replica is placed according to the&amp;nbsp;&lt;a class=&quot;reference internal&quot; href=&quot;http://www.datastax.com/docs/1.0/cluster_architecture/partitioning#partitioning&quot; style=&quot;color: #003e7a; text-decoration: none;&quot;&gt;partitioner&lt;/a&gt;&amp;nbsp;(same as with&amp;nbsp;&lt;tt class=&quot;docutils literal&quot;&gt;SimpleStrategy&lt;/tt&gt;).&lt;/li&gt;
&lt;li style=&quot;line-height: 20px;&quot;&gt;Additional replicas are placed by walking the ring clockwise until a node in a different rack is found. If no such node exists, additional replicas are placed in different nodes in the same rack.&lt;/li&gt;
&lt;/ul&gt;&lt;tt class=&quot;docutils literal&quot;&gt;NetworkTopologyStrategy&lt;/tt&gt;&amp;nbsp;attempts to place replicas on distinct racks because nodes in the same rack (or similar physical grouping) can fail at the same time due to power, cooling, or network issues.&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/7125168380723922775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/08/cassandra-replication.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7125168380723922775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7125168380723922775'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2012/08/cassandra-replication.html' title='Cassandra replication'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-5661012451965694640</id><published>2011-07-11T15:31:00.004+05:30</published><updated>2011-07-11T15:32:11.219+05:30</updated><title type='text'>Whats new in cassandra 0.8</title><content type='html'>&lt;h2&gt;What’s New in Cassandra 0.8, Part 2: Counters&lt;/h2&gt;&lt;div class=&quot;blogmeta&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogbody&quot;&gt;One of the features making its debut in Cassandra 0.8.0 is distributed  counters.  They allow you to … count things. (Or sum things; the counter  increment need not be 1, or even positive). But a lot of stuff, very  quickly,  which makes them invaluable for real-time analytical tasks. &lt;br /&gt;
&lt;h3&gt;Why Counters?&lt;/h3&gt;Prior to 0.8, Cassandra had no simple and efficient way to count. By&lt;br /&gt;
“counting,” we mean here to provide an atomic increment operation in a  single column value, as opposed to counting the number of columns in a  row, or rows in a column family, both of which were already supported.&lt;br /&gt;
If you had to count or sum things, available solutions previously included:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;inserting a different column for each increment with a batch process to merge those&lt;/li&gt;
&lt;li&gt;use an external synchronization like Zookeeper (preferably through the&lt;br /&gt;
use of the &lt;a href=&quot;http://code.google.com/p/cages&quot;&gt;Cages library&lt;/a&gt; for simplicity)&lt;/li&gt;
&lt;li&gt;use another database such as redis to handle those counts&lt;/li&gt;
&lt;/ul&gt;Those solutions all had one or more of the following problems:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;unfriendly to develop against&lt;/li&gt;
&lt;li&gt;poor performance&lt;/li&gt;
&lt;li&gt;not scalable (in particular, none scales to multiple datacenter usage)&lt;/li&gt;
&lt;li&gt;requires additional software&lt;/li&gt;
&lt;/ul&gt;The new counters feature solves this lack of simple and efficient counting&lt;br /&gt;
facility without any of the above problems. &lt;br /&gt;
&lt;h3&gt;Using Counters&lt;/h3&gt;A counter is a specific kind of column whose user-visible value is a 64-bit signed&lt;br /&gt;
integer, though this is more complex internally. When a new value is written&lt;br /&gt;
to a given counter column, this new value is added to whatever was the&lt;br /&gt;
previous value of the counter. &lt;br /&gt;
To create a column family holding counters, you simply indicate to Cassandra&lt;br /&gt;
that the &lt;tt&gt;default_validation_class&lt;/tt&gt; on that column family is&lt;br /&gt;
&lt;tt&gt;CounterColumnType&lt;/tt&gt;. For instance, using the CLI, you can create such&lt;br /&gt;
a column family using: &lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
[default@unknown] create keyspace test;&lt;br /&gt;
54900c80-9378-11e0-0000-242d50cf1f9d&lt;br /&gt;
Waiting for schema agreement...&lt;br /&gt;
... schemas agree across the cluster&lt;br /&gt;
[default@unknown] use test;&lt;br /&gt;
Authenticated to keyspace: test&lt;/code&gt;&lt;br /&gt;
&lt;code&gt; &lt;/code&gt;&lt;code&gt;[default@test] create column family counters with  default_validation_class=CounterColumnType and  key_validation_class=UTF8Type and comparator=UTF8Type;&lt;br /&gt;
6c7db090-9378-11e0-0000-242d50cf1f9d&lt;br /&gt;
Waiting for schema agreement...&lt;br /&gt;
... schemas agree across the cluster&lt;br /&gt;
&lt;/code&gt; &lt;br /&gt;
Super column families holding counters are also supported the usual way,&lt;br /&gt;
by specifying &lt;tt&gt;column_type=Super&lt;/tt&gt;. &lt;br /&gt;
Using counters is then straightforward: &lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
[default@test] incr counters[row][c1];&lt;br /&gt;
Value incremented.&lt;br /&gt;
[default@test] incr counters[row][c2] by 3;&lt;br /&gt;
Value incremented.&lt;br /&gt;
[default@test] get counters[row];&lt;br /&gt;
=&amp;gt; (counter=c1, value=1)&lt;br /&gt;
=&amp;gt; (counter=c2, value=3)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt; Returned 2 results.&lt;br /&gt;
[default@test] decr counters[row][c2] by 4;&lt;br /&gt;
Value decremented.&lt;br /&gt;
[default@test] incr counters[row][c1] by -2;&lt;br /&gt;
Value incremented.&lt;br /&gt;
[default@test] get counters[row];&lt;br /&gt;
=&amp;gt; (counter=c1, value=-1)&lt;br /&gt;
=&amp;gt; (counter=c2, value=-1)&lt;br /&gt;
Returned 2 results.&lt;br /&gt;
&lt;/code&gt;&lt;code&gt;[default@test] del counters[row][c1];&lt;br /&gt;
column removed.&lt;br /&gt;
[default@test] get counters[row];&lt;br /&gt;
=&amp;gt; (counter=c2, value=-1)&lt;br /&gt;
Returned 1 results.&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
Note that the CLI provides a &lt;tt&gt;decr&lt;/tt&gt; (decrement) operation, but this&lt;br /&gt;
is simply syntactic sugar for incrementing by a negative number. The&lt;br /&gt;
usual consistency level trade-offs apply to counter operations. &lt;br /&gt;
&lt;h3&gt;Using CQL&lt;/h3&gt;Let us start by noting that the support for counters in &lt;a href=&quot;http://www.datastax.com/dev/blog/what%E2%80%99s-new-in-cassandra-0-8-part-1-cql-the-cassandra-query-language&quot;&gt;CQL&lt;/a&gt; is not part of&lt;br /&gt;
0.8.0 (the official release at the time of this writing) but has been added&lt;br /&gt;
for the 0.8.1 release.&lt;br /&gt;
Considering the &lt;tt&gt;counters&lt;/tt&gt; column family created above:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
cqlsh&amp;gt; UPDATE counters SET c1 = c1 + 3, c2 = c2 - 4 WHERE key = row2;&lt;br /&gt;
cqlsh&amp;gt; select * from counters where key=row2;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; KEY | c1 | c2 |&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;row2 | &amp;nbsp;3 | -4 |&lt;br /&gt;
&lt;/code&gt; &lt;br /&gt;
&lt;h3&gt;Operational Considerations&lt;/h3&gt;&lt;h4&gt;Performance&lt;/h4&gt;Counters have been designed to allow for very fast writes. However, increment&lt;br /&gt;
does involve a read on one of the replica as part of replication. As a consequence,&lt;br /&gt;
counter increments are expected to be slightly slower than regular writes. Note&lt;br /&gt;
however that:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;For each write, only one of the replica has to perform a read, even with many replicas.&lt;/li&gt;
&lt;li&gt;At &lt;a href=&quot;http://www.datastax.com/docs/0.8/consistency/index&quot;&gt;ConsistencyLevel&lt;/a&gt;.ONE, this read is not part of the latency the client will&lt;br /&gt;
observe, but is still part of the write itself. It follows that the&lt;br /&gt;
latency of increments at CL.ONE is very good, but care should be taken to&lt;br /&gt;
not overload the cluster by writing faster than it can handle.&lt;br /&gt;
(In JMX, you can monitor the pending tasks on the &lt;tt&gt;REPLICATE_ON_WRITE&lt;/tt&gt; stage.)&lt;/li&gt;
&lt;/ul&gt;Counter reads use the same code path than regular reads and thus offer comparable performance. &lt;br /&gt;
&lt;h4&gt;Dealing with data loss&lt;/h4&gt;With regular column families, if an &lt;a href=&quot;http://wiki.apache.org/cassandra/MemtableSSTable&quot;&gt;SSTable&lt;/a&gt; on disk is lost or corrupted (because&lt;br /&gt;
of disk failure, for instance), a standard way to deal with it is to remove&lt;br /&gt;
the problematic file and run repair to have the missing informations pulled from&lt;br /&gt;
the other replicas. &lt;br /&gt;
This is unfortunately not as simple with counters. Currently, the only&lt;br /&gt;
safe way to handle the loss of an sstable for a counter column family&lt;br /&gt;
is to remove all data for that column family, restart the node with&lt;br /&gt;
&lt;tt&gt;-Dcassandra.renew_counter_id=true&lt;/tt&gt; (or remove the NodeIdInfo&lt;br /&gt;
system sstables on versions earlier than 0.8.2) and run repair once&lt;br /&gt;
the node is up. &lt;br /&gt;
(The reason you must remove all the counter sstables, even undamaged&lt;br /&gt;
ones, is that each node maintains a sub-count of the counter to which&lt;br /&gt;
it adds new increments and for which other nodes trust it to have the&lt;br /&gt;
most up-to-date value. Wiping the data on A ensures the replicas have&lt;br /&gt;
recognized that A is missing its sub-count and will re-replicate to it&lt;br /&gt;
on repair.) &lt;br /&gt;
&lt;h4&gt;Other considerations&lt;/h4&gt;Internally, counters use server side timestamps order to deal with&lt;br /&gt;
deletions. This does mean that you will need to keep the Cassandra servers in&lt;br /&gt;
sync. Of course, using &lt;a href=&quot;http://www.ntp.org/&quot;&gt;&lt;tt&gt;ntpd&lt;/tt&gt;&lt;/a&gt; on an server deployment is good practice anyway, so this should not be an&lt;br /&gt;
important constraint. &lt;br /&gt;
&lt;h4&gt;Current limitations, known problems and the future&lt;/h4&gt;Besides the operational considerations above, Counters have a number of&lt;br /&gt;
limitations in their current form that you should be aware of:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;If a write times out in Cassandra,&lt;br /&gt;
the client cannot know if the write was persisted or not. This is not a&lt;br /&gt;
problem for regular columns, where the recommended way to cope with such&lt;br /&gt;
exception is to replay the write, since writes are idempotent. For counters however, replaying the write&lt;br /&gt;
in those situations may result in an over-count. On the other hand, not&lt;br /&gt;
replaying it may mean the write never gets recorded.&lt;br /&gt;
&lt;a href=&quot;https://issues.apache.org/jira/browse/CASSANDRA-2783&quot;&gt;CASSANDRA-2783&lt;/a&gt; is open to add an optional replay ID to counter writes.     &lt;/li&gt;
&lt;li&gt;Support for counter removal is exposed by the API, but is limited. If&lt;br /&gt;
you perform in a short sequence a counter increment, followed by a delete and then by&lt;br /&gt;
another increment, there is no guarantee that the end value will only be&lt;br /&gt;
the value of the second increment (the deletion could be fully  ignored). The only safe use of deletion is for permanent removal,&lt;br /&gt;
where no new increment follows the deletion.&lt;/li&gt;
&lt;li&gt;There is no support for &lt;a href=&quot;http://www.datastax.com/dev/blog/whats-new-cassandra-07-expiring-columns&quot;&gt;time to live (TTL)&lt;/a&gt; on counter columns as there is&lt;br /&gt;
for regular columns (see &lt;a href=&quot;https://issues.apache.org/jira/browse/CASSANDRA-1952&quot;&gt;CASSANDRA-1952&lt;/a&gt;&lt;br /&gt;
for more information on why).&lt;/li&gt;
&lt;li&gt;There is no support for secondary indexes on counter columns.&lt;/li&gt;
&lt;li&gt;At the time of this writing, you cannot have a counter column inside a column&lt;br /&gt;
family of regular columns (and vice versa). The only way to use&lt;br /&gt;
counters is to create a column family with&lt;br /&gt;
&lt;tt&gt;default_validation_class=CounterColumnType&lt;/tt&gt;, in which case all&lt;br /&gt;
columns are counters&lt;br /&gt;
(&lt;a href=&quot;https://issues.apache.org/jira//browse/CASSANDRA-2614&quot;&gt;CASSANDRA-2614&lt;/a&gt;&lt;br /&gt;
is open to lift this limitation).&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/5661012451965694640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/07/whats-new-in-cassandra-08.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/5661012451965694640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/5661012451965694640'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/07/whats-new-in-cassandra-08.html' title='Whats new in cassandra 0.8'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-7079925639101258383</id><published>2011-07-11T15:31:00.003+05:30</published><updated>2011-07-11T15:31:43.457+05:30</updated><title type='text'>Cassandra CQL</title><content type='html'>&lt;div class=&quot;blogpost section&quot;&gt;&lt;h2&gt;What’s New in Cassandra 0.8, Part 1: CQL, the Cassandra Query Language&lt;/h2&gt;&lt;div class=&quot;blogmeta&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogbody&quot;&gt;&lt;br /&gt;
&lt;h3&gt;Why CQL?&lt;/h3&gt;Pedantic readings of &lt;a href=&quot;http://blog.sym-link.com/2009/10/30/nosql_whats_in_a_name.html&quot;&gt;the NoSQL label&lt;/a&gt; aside, Cassandra has never been against SQL per se. SQL is the original data &lt;a href=&quot;http://en.wikipedia.org/wiki/Domain-specific_language&quot;&gt;DSL&lt;/a&gt;, and quite good at what it does.&lt;br /&gt;
Cassandra originally went with a &lt;a href=&quot;http://thrift.apache.org/&quot;&gt;Thrift&lt;/a&gt; RPC-based API as a way to provide a common denominator that &lt;a href=&quot;http://wiki.apache.org/cassandra/ClientOptions&quot;&gt;more idiomatic clients&lt;/a&gt;  could build upon independently.  However, this worked poorly in  practice: raw Thrift is too low-level to use productively, and keeping  pace with new API methods to support (for example) &lt;a href=&quot;http://www.datastax.com/dev/blog/whats-new-cassandra-07-secondary-indexes&quot;&gt;indexes in 0.7&lt;/a&gt; or &lt;a href=&quot;http://wiki.apache.org/cassandra/Counters&quot;&gt;distributed counters in 0.8&lt;/a&gt; is too much for many maintainers to keep pace with. &lt;br /&gt;
CQL, the Cassandra Query Language, addresses this by pushing all  implementation details to the server; all the client has to know for any  operation is how to interpret “resultset” objects.  So adding a feature  like counters just requires &lt;a href=&quot;https://issues.apache.org/jira/browse/CASSANDRA-2473&quot;&gt;teaching the CQL parser to understand “column + N” notation&lt;/a&gt;; &lt;i&gt;no client-side changes are necessary&lt;/i&gt;.&lt;br /&gt;
CQL drivers are also hosted in-tree, to avoid the &lt;a href=&quot;http://stackoverflow.com/questions/6157760/rails-orm-for-cassandra&quot;&gt;problems caused in the past&lt;/a&gt; by client proliferation.&lt;br /&gt;
At the same time, CQL is heavily based on SQL–close to a subset of  SQL, in fact, which is a big win for newcomers: everyone knows what  “SELECT * FROM users” means. CQL is the first step to making the  learning curve on the client side &lt;a href=&quot;http://www.screenr.com/5G6&quot;&gt;as gentle as it is operationally&lt;/a&gt;.&lt;br /&gt;
(The place where CQL isn’t a strict subset of SQL–besides TABLE vs COLUMNFAMILY tokens, which &lt;a href=&quot;https://issues.apache.org/jira/browse/CASSANDRA-2743&quot;&gt;may change soon&lt;/a&gt;–is in support for Cassandra’s &lt;a href=&quot;http://www.datastax.com/docs/0.8/data_model/supercolumns&quot;&gt;wide rows&lt;/a&gt; and &lt;a href=&quot;https://issues.apache.org/jira/browse/CASSANDRA-2474&quot;&gt;heirarchical data&lt;/a&gt; like supercolumns.)&lt;br /&gt;
&lt;h3&gt;A taste of CQL&lt;/h3&gt;Here we’ll use the cqlsh tool to create a “users” columnfamily, add some users and an index, and do some simple queries. (See &lt;a href=&quot;http://www.datastax.com/docs/0.8/api/using_cql&quot;&gt;our documentation&lt;/a&gt; for details on installing cqlsh.)  Compare to the same example using the &lt;a href=&quot;http://www.datastax.com/dev/blog/whats-new-cassandra-07-secondary-indexes&quot;&gt;old cli interface&lt;/a&gt; if you’re so inclined.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
cqlsh&amp;gt; CREATE KEYSPACE test with strategy_class = &#39;SimpleStrategy&#39; and strategy_options:replication_factor=1;&lt;br /&gt;
cqlsh&amp;gt; USE test;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt; cqlsh&amp;gt; CREATE COLUMNFAMILY users (&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;key varchar PRIMARY KEY,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;full_name varchar,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;birth_date int,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;state varchar&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;);&lt;br /&gt;
cqlsh&amp;gt; CREATE INDEX ON users (birth_date);&lt;br /&gt;
cqlsh&amp;gt; CREATE INDEX ON users (state);&lt;br /&gt;
cqlsh&amp;gt; INSERT INTO users (key, full_name, birth_date, state) VALUES (&#39;bsanderson&#39;, &#39;Brandon Sanderson&#39;, 1975, &#39;UT&#39;);&lt;br /&gt;
cqlsh&amp;gt; INSERT INTO users (key, full_name, birth_date, state) VALUES (&#39;prothfuss&#39;, &#39;Patrick Rothfuss&#39;, 1973, &#39;WI&#39;);&lt;br /&gt;
cqlsh&amp;gt; INSERT INTO users (key, full_name, birth_date, state) VALUES (&#39;htayler&#39;, &#39;Howard Tayler&#39;, 1968, &#39;UT&#39;);&lt;br /&gt;
cqlsh&amp;gt; SELECT key, state FROM users;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;key | state |&lt;br /&gt;
&amp;nbsp;bsanderson |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UT |&lt;br /&gt;
&amp;nbsp;&amp;nbsp;prothfuss |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WI |&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;htayler |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UT |&lt;br /&gt;
&lt;/code&gt;&lt;code&gt;cqlsh&amp;gt; SELECT * FROM users WHERE state=&#39;UT&#39; AND birth_date &amp;gt; 1970;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;KEY&amp;nbsp;|&amp;nbsp;birth_date&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;full_name&amp;nbsp;|&amp;nbsp;state&amp;nbsp;|&lt;br /&gt;
&amp;nbsp;bsanderson&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1975&amp;nbsp;|&amp;nbsp;Brandon&amp;nbsp;Sanderson&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UT&amp;nbsp;|&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;h3&gt;Current status and the road ahead&lt;/h3&gt;cqlsh (included with the Python driver) is already useful for testing  queries against your data and managing your schema.  The above example  works as written in 0.8.0; ALTER COLUMNFAMILY, &lt;a href=&quot;http://www.datastax.com/dev/blog/whats-new-cassandra-07-expiring-columns&quot;&gt;TTL&lt;/a&gt; support, and counter support are already done for 0.8.1. &lt;br /&gt;
Supercolumn support is the main missing feature and will probably  come in 0.8.2 (minor releases are done roughly monthly). Removing Thrift  as a requirement is a longer-term goal.&lt;br /&gt;
CQL does not change the underlying &lt;a href=&quot;http://www.datastax.com/docs/0.8/data_model/index&quot;&gt;Cassandra data model&lt;/a&gt;; in particular, there is no support for JOINs.  (For doing analytical queries with SQL against Cassandra, see &lt;a href=&quot;http://www.datastax.com/products/brisk&quot;&gt;Brisk&lt;/a&gt;.)&lt;br /&gt;
The Python and Node.js CQL drivers are ready for wider use; JDBC and  Twisted are almost done, and PHP and Ruby are being worked on.&lt;br /&gt;
In short, CQL is ready for client authors to get involved.  Most  application developers should stick with the old Thrift RPC-based  clients until 0.8.1*.  If you want to give CQL a try, see &lt;a href=&quot;http://www.datastax.com/docs/0.8/api/using_cql&quot;&gt;the installation instructions&lt;/a&gt;, and for developers, the drivers tree was recently moved &lt;a href=&quot;https://svn.apache.org/repos/asf/cassandra/drivers/&quot;&gt;here&lt;/a&gt;.  &lt;br /&gt;
*One such client, Hector, &lt;a href=&quot;https://github.com/rantav/hector/wiki/Using-CQL&quot;&gt;already has CQL query support&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/7079925639101258383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/07/cassandra-cql.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7079925639101258383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7079925639101258383'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/07/cassandra-cql.html' title='Cassandra CQL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-7179146071381196973</id><published>2011-06-28T17:11:00.000+05:30</published><updated>2011-06-28T17:11:21.259+05:30</updated><title type='text'>Cassandra RandomPartitioner Vs OrderPreservingPartitioner</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;When building a Cassandra cluster, the “key” question (sorry, that’s weak) is whether to use the RandomPartitioner (RP), or the OrderPreservingPartitioner (OPP). These control how your data is distributed over your nodes. Once you have chosen your partitioner, you cannot change without wiping your data, so think carefully!&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;For Cassandra newbies, like me and my team of HBasers wanting to try a quick port of our project (more on why in another post) nailing the exact issues is quite daunting. So here is a quick summary.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;What OPP gives you&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Using OPP provides you with two obvious advantages over RP:&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;1. You can perform range slices. That is you can scan over ranges of your rows as though you were moving a cursor through a traditional index. For example, if you are using user ids as your keys, you could scan over the rows for users whose names begin with J e.g. jake, james, jamie etc&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;2. You can store real time full text indexes inside Cassandra, which are built using the aforementioned feature e.g. see&amp;nbsp;&lt;a href=&quot;http://blog.sematext.com/2010/02/09/lucandra-a-cassandra-based-lucene-backend/&quot; style=&quot;color: #004477; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;&quot;&gt;Lucandra&lt;/a&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;3. If you screw up, you can scan over your data to recover/delete orphaned keys&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;***UPDATE*** Since v6 you *can* now scan your keys when using RP, although obviously not in any particular order. Typically you request a page of rows starting with the empty/”&quot; key, and then use the apparently random end key from the page as the start key when you request another page. At the time of writing, this method only seems to work with KeyRange not TokenRing. If you are using Java to access Cassandra read the change log for v0.804 of&amp;nbsp;&lt;a href=&quot;http://code.google.com/p/pelops/&quot; style=&quot;color: #004477; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;&quot;&gt;Pelops&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Given that Web applications typically need/benefit from the above, the question is why would you *not* use OPP. The answer is a nuanced one about load balancing.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;The problem with OPP&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;With both RP and OPP, by default Cassandra will tend to evenly distribute individual keys and their corresponding rows over the nodes in the cluster. The default algorithm is nice and simple: every time you add a new node, it will assign a range of keys to that node such that it takes responsibility for half the keys stored on the node that currently stores the most keys (more on options for overriding the default behaviour later).&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;The nuance is, that this simple default algorithm will tend to lead to good load balancing when RP is used, but not necessarily when OPP is used.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;The reason is that although the algorithm succeeds in assigning key ranges such that as your cluster scales nodes receive roughly similar numbers of keys, with OPP on any given node those keys are unlikely to be drawn equally from the different column families present within your database…&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;If the distribution of keys used by individual column families is different, their sets of keys will not fall evenly across the ranges assigned to nodes. Thus nodes will end up storing preponderances of keys (and the associated data) corresponding to one column family or another. If as is likely column families store differing quantities of data with their keys, or store data accessed according to differing usage patterns, then some nodes will end up with disproportionately more data than others, or serving more “hot” data than others. &amp;lt;yikes!&amp;gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;By contrast, when using RP the distribution of the keys occuring within individual column families does not matter. This is because an MD5 hash of keys is used as the “real” key by the system for the purposes of locating the key and data on nodes (the MD5 hashes randomly map any input key to a point in the 0..2**127 range). The result is that the keys from each individual column family are spread evenly across the ranges/nodes, meaning that data and access corresponding to those column families is evenly distributed across the cluster.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;If you must have OPP&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;You may quite reasonably feel that you must have the range scan features that come with OPP, for example because you want to use&amp;nbsp;&lt;a href=&quot;http://github.com/tjake/Lucandra&quot; style=&quot;color: #004477; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;&quot;&gt;Lucandra&lt;/a&gt;. The question then becomes how you can you ameliorate the aforementioned problems with load balancing.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;The best you can do, is to identify the data upon which you do not need to perform range scans. This data can then be randomly distributed across your cluster using a simple idiom where the key is actually written as &amp;lt;MD5(ROWKEY)&amp;gt;.&amp;lt;ROWKEY&amp;gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;But be clear, the items whose keys must be undecorated (because you wish to perform range scans over them), may still not map evenly onto the key ranges held by the nodes. The only recourse you have then, is to consider manually specifying the key ranges assigned to nodes. This is typically done when you bootstrap a new node, but you can also rebalance an existing cluster by simply decomissioning nodes, deleting their data, and then bootstrapping them back in. To do this safely, you obviously have to do this one at a time, but then I’m sure I didn’t have to tell you that…&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;You can see where this is going now right? You’ve just made a whole load of work for yourself, and anyway, even if you have the time, if you have lots of different column families with widely differing key distributions then getting load balancing right is going to be a nightmare.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;This is the basic reason that fully seasoned Cassandra heads, in my experience, seem to prefer RD *unless* a mono use setup is proposed, for example where a cluster is used simply to store a full-text index with Lucandra.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;If you have a database with a seriously heterogeneous set of column families, and need range scans, you might now be thinking you should actually be using HBase, which is designed for this. That would not be a bad choice (!), but there are good reasons for hanging with Cassandra if you can, which I will cover in a future post. Read on…&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;If you must use RP (very likely)&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;So having delved a little more deeply into the implications of OPP, you decide you really should go with RP. But, what to do with those indexes you need?&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Well, first of all there is a really simple if brutal solution: simply store your index inside a single column family row as a series of columns. Since Cassandra can in principle cope with millions of columns, this is perfectly possible. Although it is true each index won’t be distributed across your whole cluster, the load will at the least be distributed across the nodes holding the replicas. If you use a typical replication factor (RF) of 3 the load associated with each index will be shared by 3 nodes etc.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;In the vast majority of cases, this will be enough, and it will be sufficient that the rest of your data is properly balanced across your cluster.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;But, I hear you saying, this is too brutal. Your index is too massive to fit on 3 nodes, is extremely hot and this just won’t work. You moved to Cassandra because you want your load distributed across your entire cluster. Period.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;This is a perfectly reasonably point of view.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;The only solution in this case is to build an index system over the top of the simple hashmap provided. We are taking this approach, and it will be elaborated with some sample code in a later post.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Basic indexing strategy for RP&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;For those that need to know the basic strategy now, here it is: you need to start off with the simple approach where you store your entire index using columns under a single key. As the number of columns grows past some threshold you define, the columns should be split such that half the entries are migrated to a new key/row. Thus the index is split across the cluster evenly.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Each range can be stored under a key named in a predictable way, for example &amp;lt;INDEX&amp;gt;.&amp;lt;SPLIT NO.&amp;gt; The start and end index entries stored in each split should themselves be stored in a dedicated column family that is used to record index meta information using the same key name, ensuring that the meta information is also distributed.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;You can then progressively test the existence of splits simply by attempting to open the key for the meta that would be used to describe the split. If you can retrieve the meta information, you know that the split also exists. It won’t be necessary to cache this information to make the process reasonably performant – Cassandra already caches data in memory, and also uses Bloom filters to determine whether or not a requested row exists (Bloom filters enable a Cassandra node to rapidly determine whether it holds a key without traversing its list of keys).&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;There you have it, an index offering range scans fully distributed over your cluster!&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Full text search sanity check&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Implementing a full text index will of course involve more work than a simple left-side/ISAM style index, although the principles are the same. Given the existence of Lucandra though, I would suggest that before proceeding to create your full text index using the described approach, you first examine another possibility: running your full text searches off a dedicated cluster.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;If you are running in the cloud, for example on EC2 or Rackspace Cloud, you can start your dedicated full text search cluster at low cost on small instances that can be scaled up if necessary later. Otherwise, consider virtualization or configuring Cassandra to run two clusters in parallel on the same nodes (more on this possibility in a later post).&lt;/div&gt;&lt;div style=&quot;line-height: 1.5; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;The beauty of open source is that many problems have already been solved for you, and Lucandra is too good an opportunity to miss is you need full text search on Cassandra.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/7179146071381196973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-randompartitioner-vs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7179146071381196973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7179146071381196973'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-randompartitioner-vs.html' title='Cassandra RandomPartitioner Vs OrderPreservingPartitioner'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-8671851308299734793</id><published>2011-06-28T16:57:00.000+05:30</published><updated>2011-06-28T16:58:02.511+05:30</updated><title type='text'>Cassandra Hector Api - Querying by timestamp</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;You can do this with SliceQuery provided by the hector api&lt;br /&gt;
&lt;br /&gt;
Lets take up a example where you want the results to be fetched based on time of posting .&lt;br /&gt;
&lt;br /&gt;
Then here are the simple steps you need to take .&lt;br /&gt;
&lt;br /&gt;
Create the column family with type Long . we can use the System.currentTimeInMillis() as the column name .&lt;br /&gt;
&lt;br /&gt;
create column family MyCF with column_type = &#39;Standard&#39; and comparator = &#39;LongType&#39;;&lt;br /&gt;
&lt;br /&gt;
You can use the SliceQuery to get the records within a particular time rang , or most recent , oldest sorted ascending or descending withing range and you can also limit the number of returned results .&lt;br /&gt;
&lt;br /&gt;
Here is the code to do the querying&lt;br /&gt;
&lt;br /&gt;
Lets try out the example with a SuperColumn as a Long&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;SuperSliceQuery&amp;lt;String, Long, String, String&amp;gt; query = HFactory.createSuperSliceQuery(keyspace, ss,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                    &lt;/span&gt;LongSerializer.get(), ss, ss);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here the SuperColumnSerializer is LongSerializer.get()&lt;br /&gt;
similarly for a Column as Long , you need to make the Column Name Serializer as LoginSerializer.get()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;query.setColumnFamily(MY_CF);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;query.setKey(myRowKey);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;if(sortOrder == 0) &amp;nbsp; &lt;/span&gt;// Specifying a startPoint and endPoint with reversing = false and limit as number of result to be returned&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; query.setRange(startTimePoint,endTimePoint, false, limit);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;else if(sortOrder == 1) &amp;nbsp; &amp;nbsp;&lt;/span&gt;// Specifying a startPoint and endPoint with reversing = true and limit as number of result to be returned, note since we want the results to be descending we specify end to start , it should be the other way round for reverseOrder as you can see below&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; query.setRange(endTimePoint,startTimePoint, true, limit);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;// &amp;nbsp; &amp;nbsp;query.setRange(long startTime,long endTime, boolean reverseOrder, int limit);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
Similarly we can do this for Standard type ColumnFamily using SliceQuery instead of SuperSliceQuery&lt;br /&gt;
&lt;br /&gt;
Hope this was useful . Please leave your comments , if this was useful for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/8671851308299734793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-api-querying-by.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/8671851308299734793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/8671851308299734793'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-api-querying-by.html' title='Cassandra Hector Api - Querying by timestamp'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-8917977656102326743</id><published>2011-06-28T16:43:00.000+05:30</published><updated>2011-06-28T17:18:31.199+05:30</updated><title type='text'>exception connecting to localhost/9160. reason: connection refused</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;Connection refused to cassandra cli mode .&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;goto the root directory of cassandra :&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;bin/cassandra -- host {host-ip} --port {9160}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;if you are having trouble with this , check your {cassandra-root-directory}/conf/cassandra.yaml&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;the thrift ip or rpc_address is the address used as the host-ip for connecting to cli .&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;make it your local IP and if you are having trouble connecting using the port 9160 , try changing the rpc_port to 8070 and now try connecting to cassandra-cli mode using the command&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;bin/cassandra --host {local-IP} --port 8070&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;This worked for me, hope it works for you too .&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange; line-height: 19px;&quot;&gt;&lt;b&gt;Provide your commments if you find this useful&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/8917977656102326743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/exception-connecting-to-localhost9160.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/8917977656102326743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/8917977656102326743'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/exception-connecting-to-localhost9160.html' title='exception connecting to localhost/9160. reason: connection refused'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-4899241644308145308</id><published>2011-06-28T14:28:00.002+05:30</published><updated>2011-06-28T14:29:20.323+05:30</updated><title type='text'>Cassandra Hector - All Host Pools Marked Down</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;pre&gt;2011-02-22 18:59:09,894 [main] ERROR (CassandraService.java:2023) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,894 [main] ERROR (CassandraService.java:2023) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,895 [main] ERROR (CassandraService.java:2023) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,895 [main] ERROR (CassandraService.java:2023) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,895 [main] ERROR (CassandraService.java:2023) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,895 [main] ERROR (CassandraService.java:2023) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,895 [main] ERROR (CassandraService.java:2099) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,895 [main] ERROR (CassandraService.java:2099) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,896 [main] ERROR (CassandraService.java:582) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,896 [main] ERROR (CassandraService.java:582) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,896 [main] ERROR (CassandraService.java:2099) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.
2011-02-22 18:59:09,896 [main] ERROR (CassandraService.java:2099) -
me.prettyprint.hector.api.exceptions.HectorException: All host pools
marked down. Retry burden pushed out to client.&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;pre&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;This means no connections to the cluster were established. Can you
verify connectability from the third host to the cluster? Might there
be a firewall adjustment or similar required?&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/4899241644308145308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-all-host-pools-marked.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/4899241644308145308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/4899241644308145308'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-all-host-pools-marked.html' title='Cassandra Hector - All Host Pools Marked Down'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-7047586387728024486</id><published>2011-06-28T14:28:00.000+05:30</published><updated>2011-06-28T14:28:12.904+05:30</updated><title type='text'>Cassandra Hector throwing error even after Cassandra is up again</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;h2 class=&quot;title&quot;&gt;Hector state when a cassandra node goes down&lt;/h2&gt;&lt;pre&gt;Hi,

I am using hector -0.7.0-26 in my application persisting data over the
network to Cassandra cluster of 3 nodes.
Everything works well until i manually bring down one of the cassandra
nodes. i need to bring down a cassandra node as part of doing negative
testing on my application. After the node goes down, i see hector
exceptions on the client side and it seems that hector is trying to
connect to the downed host.
Below is the exception trace and this is repeatedly seen in the logs.
My question is, when hector sees that the node is down, doesn&#39;t hector
close the connections to the node and stop trying again until it
detects the node to be up again?
What should be done at the client side (while using Hector) to ensure
that hector cleans up the connections to a dead node and stops trying
to reuse it.

[pool-1-thread-1] ERROR (HThriftClient.java:88) - Unable to open
transport to asp.corp.apple.com(17.108.122.70):9162
org.apache.thrift.transport.TTransportException:
java.net.ConnectException: Connection refused
 at org.apache.thrift.transport.TSocket.open(TSocket.java:185)
 at
org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:
81)
 at
me.prettyprint.cassandra.connection.HThriftClient.open(HThriftClient.java:
84)
 at me.prettyprint.cassandra.connection.CassandraHostRetryService
$RetryRunner.verifyConnection(CassandraHostRetryService.java:114)
 at me.prettyprint.cassandra.connection.CassandraHostRetryService
$RetryRunner.run(CassandraHostRetryService.java:94)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
441)
 at java.util.concurrent.FutureTask
$Sync.innerRunAndReset(FutureTask.java:317)
 at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
 at java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
 at java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
 at java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
 at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.ConnectException: Connection refused
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
195)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
 at java.net.Socket.connect(Socket.java:529)
 at org.apache.thrift.transport.TSocket.open(TSocket.java:180)
 ... 13 more

&lt;pre&gt;Actually this is working as anticipated. The following line from the
stack trace:

me.prettyprint.cassandra.connection.HThriftClient.open(HThriftClient.java:

indicates this is the host retry service (running in a background
thread) attempting to connect to the downed host every 10 seconds (by
default). What was just fixed in master and tip of 0.7.0 was an issue
with incorrect handling of UnavailableException on a consistency level
failure. This will be released at some point today (marked as
0.7.0-28).

On looking at the above trace again, that error could probably be more
clear about what is going on. I&#39;ll clean that up today as well.&lt;/pre&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/7047586387728024486/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-throwing-error-even.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7047586387728024486'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7047586387728024486'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-throwing-error-even.html' title='Cassandra Hector throwing error even after Cassandra is up again'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-7462340452845659528</id><published>2011-06-28T14:06:00.000+05:30</published><updated>2011-06-28T14:06:15.803+05:30</updated><title type='text'>Cassandra Hector Failover</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Hector Dev&#39;s have added a very simple load balancing feature, as well as improved failover behavior to&amp;nbsp;&lt;a href=&quot;http://github.com/rantav/hector&quot;&gt;Hector&lt;/a&gt;. Hector is a Java Cassandra client, to read more about it please see my previous post&amp;nbsp;&lt;a href=&quot;http://prettyprint.me/2010/02/23/hector-a-java-cassandra-client/comment-page-1/&quot;&gt;Hector – a Java Cassandra client&lt;/a&gt;.&lt;br /&gt;
In &lt;a href=&quot;http://github.com/downloads/rantav/hector/hector-0.5.0-6.jar&quot;&gt;version 0.5.0-6&lt;/a&gt; I added poor-man’s load balancing as well as improved failover behavior.&lt;br /&gt;
The interface &lt;a href=&quot;http://github.com/rantav/hector/blob/master/src/main/java/me/prettyprint/cassandra/service/CassandraClientPool.java&quot;&gt;CassandraClientPool&lt;/a&gt; used to have this method for obtaining clients:&lt;br /&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;java&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: green; font-style: italic; font-weight: bold;&quot;&gt;/**
 * Borrows a client from the pool defined by url:port
 * @param url
 * @param port
 * @return
 */&lt;/span&gt;
CassandraClient borrowClient&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; url, &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; port&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;throws&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;IllegalStateException&lt;/span&gt;, PoolExhaustedException, &lt;span style=&quot;color: #003399;&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;Now with the added LB and failover it has:&lt;br /&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;java&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: green; font-style: italic; font-weight: bold;&quot;&gt;/**
 * Borrow a load-balanced client, a random client from the array of given client addresses.
 *
 * This method is typically used to allow load balancing b/w the list of given client URLs. The
 * method will return a random client from the array of the given url:port pairs.
 * The method will try connecting each host in the list and will only stop when there&#39;s one
 * successful connection, so in that sense it&#39;s also useful for failover.
 *
 * @param clientUrls An array of &quot;url:port&quot; cassandra client addresses.
 *
 * @return A randomly chosen client from the array of clientUrls.
 * @throws Exception
 */&lt;/span&gt;
CassandraClient borrowClient&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt; clientUrls&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;throws&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;And usage looks like that:&lt;br /&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;java&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// Get a connection to any of the hosts cas1, ca2 or cas3&lt;/span&gt;
CassandraClient client &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; pool.&lt;span style=&quot;color: #006633;&quot;&gt;borrowClient&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;cas1:9160&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;&quot;cas2:9160&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;&quot;cas3:9160&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;So, when calling borrowClient(String[]) the method randomly chooses  any of the clients in the array and connects to it. That’s what I call  poor man’s load balancing, just plain dumb random, not real load  balancing. By all means, true load balancing which takes into account  performance measurements such as response time and throughput  is&amp;nbsp;infinitely&amp;nbsp;better than the plain random selection I’m employing here  and in my opinion should be left out for your ops folks to deal with and  not to the program, however, if you only need a very simplistic  approach of random selection, then this method may suite your needs.&lt;br /&gt;
A nice side effect of using this method is &lt;strong&gt;improved failover&lt;/strong&gt;.  In previous versions hector implemented failover, but in order to find  out about the ring structure it had to connect to at least one host in  the ring first and query it to learn about the rest. The result was that  if a new connection is made and it’s so&amp;nbsp;unfortunate&amp;nbsp;that this new  connections is made to unavailable host, then this new client cannot  connect to the host to learn about other live hosts so it fails right  away. With this new method which sends an array of hosts the client  keeps connecting to hosts in the list in random order until it finds one  that’s up. In the example above the client may choose to connect to  cas2 first; if cas2 is down it’ll try to connect to (say) cas3 and if  cas3 is also down it’ll try to connect to cas1; only if all three hosts  are down will it give up and return an error. Failing to connect to  hosts is considered an error, but a recoverable error, so it’s  transparent to the client of hector but is reported to JMX and has its  own special counter (RecoverableLoadBalancedConnectErrors).&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/7462340452845659528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-failover.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7462340452845659528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7462340452845659528'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-failover.html' title='Cassandra Hector Failover'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-1692645097527967213</id><published>2011-06-28T14:04:00.001+05:30</published><updated>2011-06-28T14:04:16.514+05:30</updated><title type='text'>Cassandra Data Model Pitfalls</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
For me, the main thing is a decision whether to use the OrderedPartitioner or RandomPartitioner.&lt;br /&gt;
If you use the RandomPartitioner, range scans are not possible. This  means that you must know the exact key for any activity, INCLUDING  CLEANING UP OLD DATA.&lt;br /&gt;
So if you&#39;ve got a lot of churn, unless you have some magic way of  knowing exactly which keys you&#39;ve inserted stuff for, using the random  partitioner you can easily &quot;lose&quot; stuff, which causes a disc space leak  and will eventually consume all storage.&lt;br /&gt;
On the other hand, you can ask the ordered partitioner &quot;what keys do I  have in Column Family X between A and B&quot; ? - and it&#39;ll tell you. You  can then clean them up.&lt;br /&gt;
However, there is a downside as well. As Cassandra doesn&#39;t do  automatic load balancing, if you use the ordered partitioner, in all  likelihood all your data will end up in just one or two nodes and none  in the others, which means you&#39;ll waste resources.&lt;br /&gt;
I don&#39;t have any easy answer for this, except you can get &quot;best of  both worlds&quot; in some cases by putting a short hash value (of something  you can enumerate easily from other data sources) on the beginning of  your keys - for example a 16-bit hex hash of the user ID - which will  give you 4 hex digits, followed by whatever the key is you really wanted  to use.&lt;br /&gt;
Then if you had a list of recently-deleted users, you can just hash  their IDs and range scan to clean up anything related to them.&lt;br /&gt;
&lt;del&gt;The next tricky bit is secondary indexes - Cassandra doesn&#39;t  have any - so if you need to look up X by Y, you need to insert the data  under both keys, or have a pointer. Likewise, these pointers may need  to be cleaned up when the thing they point to doesn&#39;t exist, but there&#39;s  no easy way of querying stuff on this basis, so your app needs to Just  Remember. &lt;/del&gt;&lt;br /&gt;
And application bugs may leave orphaned keys that you&#39;ve forgotten  about, and you&#39;ll have no way of easily detecting them, unless you write  some garbage collector which periodically scans every single key in the  db (this is going to take a while - but you can do it in chunks) to  check for ones which aren&#39;t needed any more.&lt;br /&gt;
None of this is based on real usage, just what I&#39;ve figured out during research. We don&#39;t use Cassandra in production.&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/1692645097527967213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-data-model-pitfalls.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1692645097527967213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/1692645097527967213'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-data-model-pitfalls.html' title='Cassandra Data Model Pitfalls'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-6546877783418543742</id><published>2011-06-28T14:02:00.000+05:30</published><updated>2011-06-28T14:02:41.093+05:30</updated><title type='text'>Cassandra Load Balancing</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;h1 id=&quot;Modifying_Schema_on_a_Live_Cluster&quot;&gt;Modifying Schema on a Live Cluster&lt;/h1&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-2&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;This page discusses features available in 0.7. &lt;span class=&quot;anchor&quot; id=&quot;line-3&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-4&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Under_the_Hood&quot;&gt;Under the Hood&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-5&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;A new system table called &lt;tt class=&quot;backtick&quot;&gt;definitions&lt;/tt&gt; keeps track of two things: keyspace definitions (&lt;tt class=&quot;backtick&quot;&gt;SCHEMA_CF&lt;/tt&gt;) and keyspace changes (&lt;tt class=&quot;backtick&quot;&gt;MIGRATIONS_CF&lt;/tt&gt;).  TimeUUIDs are used throughout to match migrations up with schema and vice-versa. &lt;span class=&quot;anchor&quot; id=&quot;line-6&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-7&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Keyspace_Definitions_.28SCHEMA_CF.29&quot;&gt;Keyspace Definitions (SCHEMA_CF)&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-8&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;The current  set of keyspace definitions are stored in a single row, one keyspace per  column with a TimeUUID as the row key (also serves as version  identifier), keyspace name as column name, and definition serialization  as the column value.  There exists a special row, keyed by &lt;tt class=&quot;backtick&quot;&gt;&quot;Last&amp;nbsp;Migration&quot;&lt;/tt&gt;  that contains a single column indicating the current schema version  UUID.  This makes it easy to look up the version and then retrieve it. &lt;span class=&quot;anchor&quot; id=&quot;line-9&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-10&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Migrations_.28MIGRATIONS_CF.29&quot;&gt;Migrations (MIGRATIONS_CF)&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-11&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;MIGRATIONS_CF&lt;/tt&gt; tracks the individual modifications (add, drop, rename) that are made to the schema.  It consists of a single row keyed by &lt;tt class=&quot;backtick&quot;&gt;&quot;Migrations&amp;nbsp;Key&quot;&lt;/tt&gt;  with one column per migration.  Each column has the migration version  UUID as its name, with the serialized migration as its value. &lt;span class=&quot;anchor&quot; id=&quot;line-12&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-13&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;img alt=&quot;migrations.gif&quot; class=&quot;attachment&quot; src=&quot;http://wiki.apache.org/cassandra/LiveSchemaUpdates?action=AttachFile&amp;amp;do=get&amp;amp;target=migrations.gif&quot; title=&quot;migrations.gif&quot; /&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-14&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-15&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Operations&quot;&gt;Operations&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-16&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Client_Operation&quot;&gt;Client Operation&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-17&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Add column family or keyspace &lt;span class=&quot;anchor&quot; id=&quot;line-18&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Drop column family or keyspace &lt;span class=&quot;anchor&quot; id=&quot;line-19&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Rename column family or keyspace &lt;span class=&quot;anchor&quot; id=&quot;line-20&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-21&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line862&quot;&gt;These are all executed via the &lt;a href=&quot;http://wiki.apache.org/cassandra/API&quot;&gt;Thrift API&lt;/a&gt;.  It is expected that you have &lt;tt class=&quot;backtick&quot;&gt;ALL&lt;/tt&gt;  access if you are using security.  For rename and drop operations the  client will block until all associated files are renamed or deleted. &lt;span class=&quot;anchor&quot; id=&quot;line-22&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-23&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Server_Migration_Process&quot;&gt;Server Migration Process&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-24&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;Applying a migration consists of the following steps: &lt;span class=&quot;anchor&quot; id=&quot;line-25&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-26&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Generate the migration, which includes a new version UUID. &lt;span class=&quot;anchor&quot; id=&quot;line-27&quot;&gt;&lt;/span&gt;&lt;ol type=&quot;a&quot;&gt;&lt;li&gt;&lt;div class=&quot;line891&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;DROP&lt;/tt&gt;s only: snapshot the data that is going away. &lt;span class=&quot;anchor&quot; id=&quot;line-28&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;Update &lt;tt class=&quot;backtick&quot;&gt;SCHEMA_CF&lt;/tt&gt; with a new schema row. &lt;span class=&quot;anchor&quot; id=&quot;line-29&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;Update &lt;tt class=&quot;backtick&quot;&gt;MIGRATION_CF&lt;/tt&gt; by appending a migration column. &lt;span class=&quot;anchor&quot; id=&quot;line-30&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;Update the &lt;tt class=&quot;backtick&quot;&gt;&quot;Last&amp;nbsp;Migration&quot;&lt;/tt&gt; row in &lt;tt class=&quot;backtick&quot;&gt;SCHEMA_CF&lt;/tt&gt;. &lt;span class=&quot;anchor&quot; id=&quot;line-31&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Flush the definitions table. &lt;span class=&quot;anchor&quot; id=&quot;line-32&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Update runtime data structures (create directories, do deletions, etc.) &lt;span class=&quot;anchor&quot; id=&quot;line-33&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-34&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Handling_Failure&quot;&gt;Handling Failure&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-35&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;A node can  fail during any step of the update process.  Here is an examination of  what will happen if a node fails after each part of the update process  (see Server Migration Process above). &lt;span class=&quot;anchor&quot; id=&quot;line-36&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-37&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Nothing has been applied. Update fails outright. &lt;span class=&quot;anchor&quot; id=&quot;line-38&quot;&gt;&lt;/span&gt;&lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Same. You will have an extra snapshot though. &lt;span class=&quot;anchor&quot; id=&quot;line-39&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;Extra data exists in SCHEMA_CF but will be ignored because &quot;Last Migration&quot; was not updated. &lt;span class=&quot;anchor&quot; id=&quot;line-40&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Extra data exists in SCHEMA_CF and MIGRATION_CF but will be ignored because &quot;Last Migration&quot; was not updated. &lt;span class=&quot;anchor&quot; id=&quot;line-41&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line891&quot;&gt;&lt;strong&gt;Broken&lt;/strong&gt;:  commit log will not be replayed until *after* schemas are loaded on  restart.  This means that the &quot;Last Migration&quot; will be read, but will  not be able to be loaded and applied. &lt;span class=&quot;anchor&quot; id=&quot;line-42&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Startup will happen normally. &lt;span class=&quot;anchor&quot; id=&quot;line-43&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Startup will happen normally. &lt;span class=&quot;anchor&quot; id=&quot;line-44&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-45&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line862&quot;&gt;If  a node crashes during a migration, chances are you will have to do some  manual cleanup.  For example, if a node cashes after steps 4 or 5 of a &lt;tt class=&quot;backtick&quot;&gt;DROP&lt;/tt&gt;  migration, you will need to manually delete the data files.  (Not  deleting them does no harm unless you &#39;recreate&#39; the same CF via &lt;tt class=&quot;backtick&quot;&gt;ADD&lt;/tt&gt; later on. Then you have an instant database.) &lt;span class=&quot;anchor&quot; id=&quot;line-46&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-47&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Starting_Up&quot;&gt;Starting Up&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-48&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;When a node starts up, it checks &lt;tt class=&quot;backtick&quot;&gt;SCHEMA_CF&lt;/tt&gt;  to find out the latest schema version it has.  If it finds nothing (as  would happen with a new cluster), it loads nothing and logs a warning.   Otherwise, it uses the uuid it just read in to load the correct row from  &lt;tt class=&quot;backtick&quot;&gt;SCHEMA_CF&lt;/tt&gt;.  That row is deserialized into one  or more keyspace definitions which are then loaded in a manner similar  to the load-from-xml approach used in the past. &lt;span class=&quot;anchor&quot; id=&quot;line-49&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-50&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;At  the same time, the node incorporates its schema version UUID into the  gossip digests it sends to other nodes.  It may be the case that this  node does not have the latest schema definitions (as a result of network  partition, bootstrapping a new node, or any other reason you can think  of).  When a version mismatch is detected the definition promulgation  mechanism described next is invoked. &lt;span class=&quot;anchor&quot; id=&quot;line-51&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-52&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Definition_Promulgation&quot;&gt;Definition Promulgation&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-53&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Definition promulgation consists of two phases: &lt;em&gt;announce&lt;/em&gt; and &lt;em&gt;push&lt;/em&gt;. &lt;em&gt;announce&lt;/em&gt;  is a way for node A to declare to node B &quot;this is the schema version I  have&quot;.  If the versions are equal, the message is ignored.  If A is  newer, B responds with an &lt;em&gt;announce&lt;/em&gt; to A (this functions as a request for updates).  If A is older, B responds with a &lt;em&gt;push&lt;/em&gt; containing all the migrations from B that A doesn&#39;t have. &lt;span class=&quot;anchor&quot; id=&quot;line-54&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-55&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;When a schema update originates from the client (Thrift), gossip promulgation is bypassed and this &lt;em&gt;announce-announce-push&lt;/em&gt; approach is used to push migrations to other nodes. &lt;span class=&quot;anchor&quot; id=&quot;line-56&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-57&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;New_Cluster_.28Fresh_0.7.29&quot;&gt;New Cluster (Fresh 0.7)&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-58&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;For new  clusters, things will work best if you start with one node and apply  migrations using Thrift until you get the schema you want.  Then bring  new nodes online and they will pull migrations from the first node (or  each other in a large cluster). &lt;span class=&quot;anchor&quot; id=&quot;line-59&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-60&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;Alternatively, you could then shut down the first node and manually copy its &lt;tt class=&quot;backtick&quot;&gt;SCHEMA_CF&lt;/tt&gt; and &lt;tt class=&quot;backtick&quot;&gt;MIGRATIONS_CF&lt;/tt&gt; to each new node in the cluster. &lt;span class=&quot;anchor&quot; id=&quot;line-61&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-62&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;The simplest method of applying these schema changes is with &lt;tt class=&quot;backtick&quot;&gt;bin/cassandra-cli&lt;/tt&gt;. You can either do this interactively, or place the commands in a file and apply them in batch mode (type &lt;tt class=&quot;backtick&quot;&gt;help&lt;/tt&gt; and &lt;tt class=&quot;backtick&quot;&gt;help&amp;nbsp;&amp;lt;command&amp;gt;&lt;/tt&gt; to see the available commands). For example: &lt;span class=&quot;anchor&quot; id=&quot;line-63&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-64&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-65&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-66&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-67&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-68&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-69&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-70&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-71&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-72&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-73&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-74&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-75&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-76&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;$ cat schema.txt
/* Create a new keyspace */
create keyspace Keyspace1 with replication_factor = 3 and placement_strategy = &#39;org.apache.cassandra.locator.RackUnawareStrategy&#39;;

/* Switch to the new keyspace */
use Keyspace1;

/* Create new column families */
create column family Standard1 with column_type = &#39;Standard&#39; and comparator = &#39;BytesType&#39;;
create column family Standard2 with column_type = &#39;Standard&#39; and comparator = &#39;UTF8Type&#39; and rows_cached = 10000;
$ bin/cassandra-cli --host localhost --batch &amp;lt; schema.txt&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-77&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Existing_Cluster_.28Upgrade_from_0.6.29&quot;&gt;Existing Cluster (Upgrade from 0.6)&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-78&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;To provide some backwards compatibility, we&#39;ve provided a JMX method in the &lt;tt class=&quot;backtick&quot;&gt;StorageServiceMBean&lt;/tt&gt;  that can be used to manually load schema definitions from  storage-conf.xml.  This is a one-shot operation though, and will only  work on a system that contains no existing migrations.  If you are  upgrading a cluster, you will probably only have to do this for one node  (a seed).  Gossip will take care of promulgating the changes to the  rest of the nodes as they come online. &lt;span class=&quot;anchor&quot; id=&quot;line-79&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-80&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;For those who dont know how to do it (like me): &lt;span class=&quot;anchor&quot; id=&quot;line-81&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-82&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-83&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-84&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-85&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;ps aux | grep cassandra # get pid of cassandra
jconsole PID&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-86&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;MBeans -&amp;gt; org.apache.cassandra.db -&amp;gt; &lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/StorageService&quot;&gt;StorageService&lt;/a&gt; -&amp;gt; Operations -&amp;gt; loadSchemaFromYAML &lt;span class=&quot;anchor&quot; id=&quot;line-87&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-88&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Lastly, there is a system tool that can poke the same JMX method without having to remember its location: &lt;span class=&quot;anchor&quot; id=&quot;line-89&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-90&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-91&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-92&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;bin/schematool HOST PORT import&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-93&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-94&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Concurrency&quot;&gt;Concurrency&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-95&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;It is  entirely possible and expected that a node will receive migration pushes  from multiple nodes.  Because of this, all migrations are applied on a  single-threaded stage and versions are checked throughout to make sure  that no migration is applied twice, and no migration is applied out of  sync. &lt;span class=&quot;anchor&quot; id=&quot;line-96&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-97&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Each  migration knows the version UUID of the migration that immediately  precedes it.  If a node is asked to apply a migration and its current  version UUID does not match the last version UUID of the migration, the  migration is discarded. &lt;span class=&quot;anchor&quot; id=&quot;line-98&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-99&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;One  weakness of this model is that it is vulnerable if a new update starts  before another update is promulgated to all live nodes--only one  migration can be active within a cluster at any time.  One way to get  around this is to choose one node and only initiate migrations through  it.&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;&lt;/div&gt;&lt;h2 id=&quot;Ring_management&quot;&gt;Ring management&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-15&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Each  Cassandra server [node] is assigned a unique Token that determines what  keys it is the first replica for.  If you sort all nodes&#39; Tokens, the  Range of keys each is responsible for is (PreviousToken, MyToken], that  is, from the previous token (exclusive) to the node&#39;s token (inclusive).   The machine with the lowest Token gets both all keys less than that  token, and all keys greater than the largest Token; this is called a  &quot;wrapping Range.&quot; &lt;span class=&quot;anchor&quot; id=&quot;line-16&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-17&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;(Note that there is nothing special about being the &quot;primary&quot; replica, in the sense of being a point of failure.) &lt;span class=&quot;anchor&quot; id=&quot;line-18&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-19&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;When  the RandomPartitioner is used, Tokens are integers from 0 to 2**127.   Keys are converted to this range by MD5 hashing for comparison with  Tokens.  (Thus, keys are always convertible to Tokens, but the reverse  is not always true.) &lt;span class=&quot;anchor&quot; id=&quot;line-20&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-21&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Token_selection&quot;&gt;Token selection&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-22&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Using a  strong hash function means RandomPartitioner keys will, on average, be  evenly spread across the Token space, but you can still have imbalances  if your Tokens do not divide up the range evenly, so you should specify  InitialToken to your first nodes as &lt;tt class=&quot;backtick&quot;&gt;i&amp;nbsp;*&amp;nbsp;(2**127&amp;nbsp;/&amp;nbsp;N)&lt;/tt&gt; for i = 0 .. N-1. In Cassandra 0.7, you should specify &lt;tt class=&quot;backtick&quot;&gt;initial_token&lt;/tt&gt; in &lt;tt class=&quot;backtick&quot;&gt;cassandra.yaml&lt;/tt&gt;. &lt;span class=&quot;anchor&quot; id=&quot;line-23&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-24&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;With  NetworkTopologyStrategy, you should calculate the tokens the nodes in  each DC independently. Tokens still needed to be unique, so you can add 1  to the tokens in the 2nd DC, add 2 in the 3rd, and so on.  Thus, for a  4-node cluster in 2 datacenters, you would have &lt;span class=&quot;anchor&quot; id=&quot;line-25&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-26&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-27&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-28&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-29&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-30&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-31&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-32&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-33&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;DC1
node 1 = 0
node 2 = 85070591730234615865843651857942052864

DC2
node 3 = 1
node 4 = 85070591730234615865843651857942052865&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-34&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-35&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-36&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;If you happen to have the same number of nodes in each data center, you can also alternate data centers when assigning tokens: &lt;span class=&quot;anchor&quot; id=&quot;line-37&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-38&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-39&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-40&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-41&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-42&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;[DC1] node 1 = 0
[DC2] node 2 = 42535295865117307932921825928971026432
[DC1] node 3 = 85070591730234615865843651857942052864
[DC2] node 4 = 127605887595351923798765477786913079296&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-43&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-44&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;With  order preserving partitioners, your key distribution will be  application-dependent.  You should still take your best guess at  specifying initial tokens (guided by sampling actual data, if possible),  but you will be more dependent on active load balancing (see below)  and/or adding new nodes to hot spots. &lt;span class=&quot;anchor&quot; id=&quot;line-45&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-46&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Once data is placed on the cluster, the partitioner may not be changed without wiping and starting over. &lt;span class=&quot;anchor&quot; id=&quot;line-47&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-48&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Replication&quot;&gt;Replication&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-49&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;A Cassandra  cluster always divides up the key space into ranges delimited by Tokens  as described above, but additional replica placement is customizable via  IReplicaPlacementStrategy in the configuration file.  The standard  strategies are &lt;span class=&quot;anchor&quot; id=&quot;line-50&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-51&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class=&quot;line891&quot;&gt;RackUnawareStrategy: replicas are always placed on the next (in increasing Token order) N-1 nodes along the ring &lt;span class=&quot;anchor&quot; id=&quot;line-52&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line891&quot;&gt;RackAwareStrategy: replica 2 is placed in the first node along the ring the belongs in &lt;strong&gt;another&lt;/strong&gt; data center than the first; the remaining N-2 replicas, if any, are placed on the first nodes along the ring in the &lt;strong&gt;same&lt;/strong&gt; rack as the first &lt;span class=&quot;anchor&quot; id=&quot;line-53&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-54&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line862&quot;&gt;Note  that with RackAwareStrategy, succeeding nodes along the ring should  alternate data centers to avoid hot spots.  For instance, if you have  nodes A, B, C, and D in increasing Token order, and instead of  alternating you place A and B in DC1, and C and D in DC2, then nodes C  and A will have disproportionately more data on them because they will  be the replica destination for every Token range in the other data  center. &lt;span class=&quot;anchor&quot; id=&quot;line-55&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-56&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;The  corollary to this is, if you want to start with a single DC and add  another later, when you add the second DC you should add as many nodes  as you have in the first rather than adding a node or two at a time  gradually. &lt;span class=&quot;anchor&quot; id=&quot;line-57&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-58&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot;&gt;Replication  factor is not really intended to be changed in a live cluster either,  but increasing it is conceptually simple: update the replication_factor  from the CLI (see below), then run repair against each node in your  cluster so that all the new replicas that are supposed to have the data,  actually do. &lt;span class=&quot;anchor&quot; id=&quot;line-59&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-60&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Until repair is finished, you have 3 options: &lt;span class=&quot;anchor&quot; id=&quot;line-61&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-62&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;read at &lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/ConsistencyLevel&quot;&gt;ConsistencyLevel&lt;/a&gt;.QUORUM  or ALL (depending on your existing replication factor) to make sure  that a replica that actually has the data is consulted &lt;span class=&quot;anchor&quot; id=&quot;line-63&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;continue reading at lower CL, accepting that some requests will fail (usually only the first for a given query, if &lt;a href=&quot;http://wiki.apache.org/cassandra/ReadRepair&quot;&gt;ReadRepair&lt;/a&gt; is enabled) &lt;span class=&quot;anchor&quot; id=&quot;line-64&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;take downtime while repair runs &lt;span class=&quot;anchor&quot; id=&quot;line-65&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-66&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot;&gt;The same options apply to changing replication strategy. &lt;span class=&quot;anchor&quot; id=&quot;line-67&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-68&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Reducing replication factor is easily done and only requires running cleanup afterwards to remove extra replicas. &lt;span class=&quot;anchor&quot; id=&quot;line-69&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-70&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;To update the replication factor on a live cluster, forget about cassandra.yaml. Rather you want to use &lt;strong&gt;cassandra-cli&lt;/strong&gt;: &lt;span class=&quot;anchor&quot; id=&quot;line-71&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-72&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;update keyspace Keyspace1 with replication_factor = 3; &lt;span class=&quot;anchor&quot; id=&quot;line-73&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-74&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Network_topology&quot;&gt;Network topology&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-75&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Besides  datacenters, you can also tell Cassandra which nodes are in the same  rack within a datacenter.  Cassandra will use this to route both reads  and data movement for Range changes to the nearest replicas.  This is  configured by a user-pluggable EndpointSnitch class in the configuration  file. &lt;span class=&quot;anchor&quot; id=&quot;line-76&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-77&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;EndpointSnitch  is related to, but distinct from, replication strategy itself:  RackAwareStrategy needs a properly configured Snitch to place replicas  correctly, but even absent a Strategy that cares about datacenters, the  rest of Cassandra will still be location-sensitive. &lt;span class=&quot;anchor&quot; id=&quot;line-78&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-79&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;There is an example of a custom Snitch implementation in &lt;a class=&quot;http&quot; href=&quot;http://svn.apache.org/repos/asf/cassandra/tags/cassandra-0.6.1/contrib/property_snitch/&quot;&gt;http://svn.apache.org/repos/asf/cassandra/tags/cassandra-0.6.1/contrib/property_snitch/&lt;/a&gt;. &lt;span class=&quot;anchor&quot; id=&quot;line-80&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-81&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Range_changes&quot;&gt;Range changes&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-82&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Bootstrap&quot;&gt;Bootstrap&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-83&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;Adding new nodes is called &quot;bootstrapping.&quot; &lt;span class=&quot;anchor&quot; id=&quot;line-84&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-85&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;To bootstrap a node, turn AutoBootstrap on in the configuration file, and start it. &lt;span class=&quot;anchor&quot; id=&quot;line-86&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-87&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;If  you explicitly specify an InitialToken in the configuration, the new  node will bootstrap to that position on the ring.  Otherwise, it will  pick a Token that will give it half the keys from the node with the most  disk space used, that does not already have another node bootstrapping  into its Range. &lt;span class=&quot;anchor&quot; id=&quot;line-88&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-89&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Important things to note: &lt;span class=&quot;anchor&quot; id=&quot;line-90&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-91&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;You  should wait long enough for all the nodes in your cluster to become  aware of the bootstrapping node via gossip before starting another  bootstrap.  The new node will log &quot;Bootstrapping&quot; when this is safe, 2  minutes after starting.  (90s to make sure it has accurate load  information, and 30s waiting for other nodes to start sending it inserts  happening in its to-be-assumed part of the token ring.) &lt;span class=&quot;anchor&quot; id=&quot;line-92&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Relating  to point 1, one can only bootstrap N nodes at a time with automatic  token picking, where N is the size of the existing cluster. If you need  to more than double the size of your cluster, you have to wait for the  first N nodes to finish until your cluster is size 2N before  bootstrapping more nodes. So if your current cluster is 5 nodes and you  want add 7 nodes, bootstrap 5 and let those finish before bootstrapping  the last two. &lt;span class=&quot;anchor&quot; id=&quot;line-93&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;As  a safety measure, Cassandra does not automatically remove data from  nodes that &quot;lose&quot; part of their Token Range to a newly added node.  Run &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;cleanup&lt;/tt&gt;  on the source node(s) (neighboring nodes that shared the same subrange)  when you are satisfied the new node is up and working. If you do not do  this the old data will still be counted against the load on that node  and future bootstrap attempts at choosing a location will be thrown off.  &lt;span class=&quot;anchor&quot; id=&quot;line-94&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;When  bootstrapping a new node, existing nodes have to divide the key space  before beginning replication.  This can take awhile, so be patient. &lt;span class=&quot;anchor&quot; id=&quot;line-95&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;During bootstrap, a node will drop the Thrift port and will not be accessible from &lt;tt class=&quot;backtick&quot;&gt;nodetool&lt;/tt&gt;. &lt;span class=&quot;anchor&quot; id=&quot;line-96&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;Bootstrap can take many hours when a lot of data is involved.  See &lt;a href=&quot;http://wiki.apache.org/cassandra/Streaming&quot;&gt;Streaming&lt;/a&gt; for how to monitor progress. &lt;span class=&quot;anchor&quot; id=&quot;line-97&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-98&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line862&quot;&gt;Cassandra  is smart enough to transfer data from the nearest source node(s), if  your EndpointSnitch is configured correctly.  So, the new node doesn&#39;t  need to be in the same datacenter as the primary replica for the Range  it is bootstrapping into, as long as another replica is in the  datacenter with the new one. &lt;span class=&quot;anchor&quot; id=&quot;line-99&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-100&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;Bootstrap progress can be monitored using &lt;tt class=&quot;backtick&quot;&gt;nodetool&lt;/tt&gt; with the &lt;tt class=&quot;backtick&quot;&gt;netstats&lt;/tt&gt; argument (0.7 and later) or &lt;tt class=&quot;backtick&quot;&gt;streams&lt;/tt&gt; (Cassandra 0.6). &lt;span class=&quot;anchor&quot; id=&quot;line-101&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-102&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;During bootstrap &lt;tt class=&quot;backtick&quot;&gt;nodetool&lt;/tt&gt;  may report that the new node is not receiving nor sending any streams,  this is because the sending node will copy out locally the data they  will send to the receiving one, which can be seen in the sending node  through the the &quot;&lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/AntiCompacting&quot;&gt;AntiCompacting&lt;/a&gt;... &lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/AntiCompacted&quot;&gt;AntiCompacted&lt;/a&gt;&quot; log messages. &lt;span class=&quot;anchor&quot; id=&quot;line-103&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-104&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Moving_or_Removing_nodes&quot;&gt;Moving or Removing nodes&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-105&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Removing_nodes_entirely&quot;&gt;Removing nodes entirely&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-106&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;You can take a node out of the cluster with &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;decommission&lt;/tt&gt; to a live node, or &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;removetoken&lt;/tt&gt;  (to any other machine) to remove a dead one.  This will assign the  ranges the old node was responsible for to other nodes, and replicate  the appropriate data there. If &lt;tt class=&quot;backtick&quot;&gt;decommission&lt;/tt&gt; is used, the data will stream from the decommissioned node. If &lt;tt class=&quot;backtick&quot;&gt;removetoken&lt;/tt&gt; is used, the data will stream from the remaining replicas. &lt;span class=&quot;anchor&quot; id=&quot;line-107&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-108&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;No  data is removed automatically from the node being decommissioned, so if  you want to put the node back into service at a different token on the  ring, it should be removed manually. &lt;span class=&quot;anchor&quot; id=&quot;line-109&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-110&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Moving_nodes&quot;&gt;Moving nodes&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-111&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;move&lt;/tt&gt;: move the target node to a given Token. Moving is essentially a convenience over decommission + bootstrap. &lt;span class=&quot;anchor&quot; id=&quot;line-112&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-113&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;As with bootstrap, see &lt;a href=&quot;http://wiki.apache.org/cassandra/Streaming&quot;&gt;Streaming&lt;/a&gt; for how to monitor progress. &lt;span class=&quot;anchor&quot; id=&quot;line-114&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-115&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Load_balancing&quot;&gt;Load balancing&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-116&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;If you add  nodes to your cluster your ring will be unbalanced and only way to get  perfect balance is to compute new tokens for every node and assign them  to each node manually by using nodetool move command. &lt;span class=&quot;anchor&quot; id=&quot;line-117&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-118&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;Here&#39;s  a python program which can be used to calculate new tokens for the  nodes. There&#39;s more info on the subject at Ben Black&#39;s presentation at  Cassandra Summit 2010. &lt;a class=&quot;http&quot; href=&quot;http://www.datastax.com/blog/slides-and-videos-cassandra-summit-2010&quot;&gt;http://www.datastax.com/blog/slides-and-videos-cassandra-summit-2010&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-119&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-120&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;def tokens(nodes): &lt;span class=&quot;anchor&quot; id=&quot;line-121&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;for x in xrange(nodes): &lt;span class=&quot;anchor&quot; id=&quot;line-122&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;print 2 ** 127 / nodes * x &lt;span class=&quot;anchor&quot; id=&quot;line-123&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-124&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line862&quot;&gt;In versions of Cassandra 0.7.* and lower, there&#39;s also &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;loadbalance&lt;/tt&gt;:  essentially a convenience over decommission + bootstrap, only instead  of telling the target node where to move on the ring it will choose its  location based on the same heuristic as Token selection on bootstrap.  You should not use this as it doesn&#39;t rebalance the entire ring. &lt;span class=&quot;anchor&quot; id=&quot;line-125&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-126&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;The status of move and balancing operations can be monitored using &lt;tt class=&quot;backtick&quot;&gt;nodetool&lt;/tt&gt; with the &lt;tt class=&quot;backtick&quot;&gt;netstat&lt;/tt&gt; argument.  (Cassandra 0.6.* and lower use the &lt;tt class=&quot;backtick&quot;&gt;streams&lt;/tt&gt; argument). &lt;span class=&quot;anchor&quot; id=&quot;line-127&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-128&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Consistency&quot;&gt;Consistency&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-129&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Cassandra allows clients to specify the desired consistency level on reads and writes.  (See &lt;a href=&quot;http://wiki.apache.org/cassandra/API&quot;&gt;API&lt;/a&gt;.)   If R + W &amp;gt; N, where R, W, and N are respectively the read replica  count, the write replica count, and the replication factor, all client  reads will see the most recent write.  Otherwise, readers &lt;strong&gt;may&lt;/strong&gt; see older versions, for periods of typically a few ms; this is called &quot;eventual consistency.&quot;  See &lt;a class=&quot;http&quot; href=&quot;http://www.allthingsdistributed.com/2008/12/eventually_consistent.html&quot;&gt;http://www.allthingsdistributed.com/2008/12/eventually_consistent.html&lt;/a&gt; and &lt;a class=&quot;http&quot; href=&quot;http://queue.acm.org/detail.cfm?id=1466448&quot;&gt;http://queue.acm.org/detail.cfm?id=1466448&lt;/a&gt; for more. &lt;span class=&quot;anchor&quot; id=&quot;line-130&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-131&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;See below about consistent backups. &lt;span class=&quot;anchor&quot; id=&quot;line-132&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-133&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Repairing_missing_or_inconsistent_data&quot;&gt;Repairing missing or inconsistent data&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-134&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;Cassandra repairs data in two ways: &lt;span class=&quot;anchor&quot; id=&quot;line-135&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-136&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Read  Repair: every time a read is performed, Cassandra compares the versions  at each replica (in the background, if a low consistency was requested  by the reader to minimize latency), and the newest version is sent to  any out-of-date replicas. &lt;span class=&quot;anchor&quot; id=&quot;line-137&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;Anti-Entropy: when &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;repair&lt;/tt&gt;  is run, Cassandra computes a Merkle tree for each range of data on that  node, and compares it with the versions on other replicas, to catch any  out of sync data that hasn&#39;t been read recently.  This is intended to  be run infrequently (e.g., weekly) since computing the Merkle tree is  relatively expensive in disk i/o and CPU, since it scans ALL the data on  the machine (but it is is very network efficient). &lt;span class=&quot;anchor&quot; id=&quot;line-138&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-139&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line862&quot;&gt;Running &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;repair&lt;/tt&gt;:  Like all nodetool operations in 0.7, repair is blocking: it will wait  for the repair to finish and then exit.  This may take a long time on  large data sets. &lt;span class=&quot;anchor&quot; id=&quot;line-140&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-141&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;It  is safe to run repair against multiple machines at the same time, but  to minimize the impact on your application workload it is recommended to  wait for it to complete on one node before invoking it against the  next. &lt;span class=&quot;anchor&quot; id=&quot;line-142&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-143&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Frequency_of_nodetool_repair&quot;&gt;Frequency of nodetool repair&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-144&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Unless your application performs no deletes, it is vital that production clusters run &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;repair&lt;/tt&gt; periodically on all nodes in the cluster. The hard requirement for repair frequency is the value used for GCGraceSeconds (see &lt;a href=&quot;http://wiki.apache.org/cassandra/DistributedDeletes&quot;&gt;DistributedDeletes&lt;/a&gt;).  Running nodetool repair often enough to guarantee that all nodes have  performed a repair in a given period GCGraceSeconds long, ensures that  deletes are not &quot;forgotten&quot; in the cluster. &lt;span class=&quot;anchor&quot; id=&quot;line-145&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-146&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Consider  how to schedule your repairs. A repair causes additional disk and CPU  activity on the nodes participating in the repair, and it will typically  be a good idea to spread repairs out over time so as to minimize the  chances of repairs running concurrently on many nodes. &lt;span class=&quot;anchor&quot; id=&quot;line-147&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-148&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h4 id=&quot;Dealing_with_the_consequences_of_nodetool_repair_not_running_within_GCGraceSeconds&quot;&gt;Dealing with the consequences of nodetool repair not running within GCGraceSeconds&lt;/h4&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-149&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;If &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;repair&lt;/tt&gt; has not been run often enough to the point that GCGraceSeconds has passed, you risk forgotten deletes (see &lt;a href=&quot;http://wiki.apache.org/cassandra/DistributedDeletes&quot;&gt;DistributedDeletes&lt;/a&gt;).  In addition to data popping up that has been deleted, you may see  inconsistencies in data return from different nodes that will not  self-heal by read-repair or further &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;repair&lt;/tt&gt;. Some further details on this latter effect is documented in &lt;a class=&quot;https&quot; href=&quot;https://issues.apache.org/jira/browse/CASSANDRA-1316&quot;&gt;CASSANDRA-1316&lt;/a&gt;. &lt;span class=&quot;anchor&quot; id=&quot;line-150&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-151&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;There are at least three ways to deal with this scenario. &lt;span class=&quot;anchor&quot; id=&quot;line-152&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-153&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Treat the node in question as failed, and replace it as described further below. &lt;span class=&quot;anchor&quot; id=&quot;line-154&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;To  minimize the amount of forgotten deletes, first increase GCGraceSeconds  across the cluster (rolling restart required), perform a full repair on  all nodes, and then change GCRaceSeconds back again. This has the  advantage of ensuring tombstones spread as much as possible, minimizing  the amount of data that may &quot;pop back up&quot; (forgotten delete). &lt;span class=&quot;anchor&quot; id=&quot;line-155&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;Yet  another option, that will result in more forgotten deletes than the  previous suggestion but is easier to do, is to ensure &#39;nodetool repair&#39;  has been run on all nodes, and then perform a compaction to expire  toombstones. Following this, read-repair and regular &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;repair&lt;/tt&gt; should cause the cluster to converge. &lt;span class=&quot;anchor&quot; id=&quot;line-156&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-157&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Handling_failure&quot;&gt;Handling failure&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-158&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;If a node  goes down and comes back up, the ordinary repair mechanisms will be  adequate to deal with any inconsistent data.  Remember though that if a  node misses updates and is not repaired for longer than your configured  GCGraceSeconds (default: 10 days), it could have missed remove  operations permanently.  Unless your application performs no removes,  you should wipe its data directory, re-bootstrap it, and removetoken its  old entry in the ring (see below). &lt;span class=&quot;anchor&quot; id=&quot;line-159&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-160&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;If a node goes down entirely, then you have two options: &lt;span class=&quot;anchor&quot; id=&quot;line-161&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-162&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;(Recommended approach) Bring up the replacement node with a new IP address, Set initial token to &lt;tt class=&quot;backtick&quot;&gt;(failure&amp;nbsp;node&#39;s&amp;nbsp;token)&amp;nbsp;-&amp;nbsp;1&lt;/tt&gt;  and AutoBootstrap set to true in cassandra.yaml (storage-conf.xml for  0.6 or earlier). This will place the replacement node in front of the  failure node. Then the bootstrap process begins. While this process  runs, the node will not receive reads until finished. Once this process  is finished on the replacement node, run &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;removetoken&lt;/tt&gt; once, supplying the token of the dead node, and &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;cleanup&lt;/tt&gt; on each node. You can obtain the dead node&#39;s token by running &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;ring&lt;/tt&gt;  on any live node, unless there was some kind of outage, and the others  came up but not the down one -- in that case, you can retrieve the token  from the live nodes&#39; system tables. &lt;span class=&quot;anchor&quot; id=&quot;line-163&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-164&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;gap&quot;&gt;&lt;div class=&quot;line862&quot;&gt;(Alternative approach) Bring up a replacement node with the same IP and token as the old, and run &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;repair&lt;/tt&gt;.  Until the repair process is complete, clients reading only from this  node may get no data back.  Using a higher ConsistencyLevel on reads  will avoid this. &lt;span class=&quot;anchor&quot; id=&quot;line-165&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-166&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line862&quot;&gt;The reason why you run &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;cleanup&lt;/tt&gt; on all live nodes is to remove old Hinted Handoff writes stored for the dead node. &lt;span class=&quot;anchor&quot; id=&quot;line-167&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-168&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Backing_up_data&quot;&gt;Backing up data&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-169&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Cassandra can snapshot data while online using &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;snapshot&lt;/tt&gt;.   You can then back up those snapshots using any desired system,  although leaving them where they are is probably the option that makes  the most sense on large clusters. &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;snapshot&lt;/tt&gt; triggers a node-wide flush, so all data written before the execution of the snapshot command is contained within the snapshot. &lt;span class=&quot;anchor&quot; id=&quot;line-170&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-171&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;With  some combinations of operating system/jvm you may receive an error  related to the inability to create a process during the snapshotting,  such as this on Linux &lt;span class=&quot;anchor&quot; id=&quot;line-172&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-173&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-174&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-175&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Exception in thread &quot;main&quot; java.io.IOException: Cannot run program &quot;ln&quot;: java.io.IOException: error=12, Cannot allocate memory&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-176&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;This  is caused by the operating system trying to allocate the child &quot;ln&quot;  process a memory space as large as the parent process (the cassandra  server), even though &lt;strong&gt;it&#39;s not going to use it&lt;/strong&gt;. So if  you have a machine with 8GB of RAM and no swap, and you gave 6GB to the  cassandra server, it will fail during this because the operating system  wants 12 GB of virtual memory before allowing you to create the process.  &lt;span class=&quot;anchor&quot; id=&quot;line-177&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-178&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;This error can be worked around by either : &lt;span class=&quot;anchor&quot; id=&quot;line-179&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-180&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;dropping the jna.jar file into Cassandra&#39;s lib folder (requires at least Cassandra 0.6.6) &lt;span class=&quot;anchor&quot; id=&quot;line-181&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-182&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot;&gt;OR &lt;span class=&quot;anchor&quot; id=&quot;line-183&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-184&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;creating a swap file, snapshotting, removing swap file &lt;span class=&quot;anchor&quot; id=&quot;line-185&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-186&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot;&gt;OR &lt;span class=&quot;anchor&quot; id=&quot;line-187&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-188&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;turning on &quot;memory overcommit&quot; &lt;span class=&quot;anchor&quot; id=&quot;line-189&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-190&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot;&gt;To restore a snapshot: &lt;span class=&quot;anchor&quot; id=&quot;line-191&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-192&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;shut down the node &lt;span class=&quot;anchor&quot; id=&quot;line-193&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;clear out the old commitlog and sstables &lt;span class=&quot;anchor&quot; id=&quot;line-194&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;move the sstables from the snapshot location to the live data directory. &lt;span class=&quot;anchor&quot; id=&quot;line-195&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-196&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Consistent_backups&quot;&gt;Consistent backups&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-197&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;You can get  an eventually consistent backup by snapshotting all node; no individual  node&#39;s backup is guaranteed to be consistent but if you restore from  that snapshot then clients will get eventually consistent behavior as  usual. &lt;span class=&quot;anchor&quot; id=&quot;line-198&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-199&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;There  is no such thing as a consistent view of the data in the strict sense,  except in the trivial case of writes with consistency level = ALL. &lt;span class=&quot;anchor&quot; id=&quot;line-200&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-201&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h3 id=&quot;Import_.2BAC8_export&quot;&gt;Import / export&lt;/h3&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-202&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;As an alternative to taking snapshots it&#39;s possible to export SSTables to JSON format using the &lt;tt class=&quot;backtick&quot;&gt;bin/sstable2json&lt;/tt&gt; command: &lt;span class=&quot;anchor&quot; id=&quot;line-203&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-204&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-205&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-206&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Usage: sstable2json [-f outfile] &amp;lt;sstable&amp;gt; [-k key [-k key [...]]]&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-207&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;bin/sstable2json&lt;/tt&gt;  accepts as a required argument, the full path to an SSTable data file,  (files ending in -Data.db), and an optional argument for an output file  (by default, output is written to stdout). You can also pass the names  of specific keys using the &lt;tt class=&quot;backtick&quot;&gt;-k&lt;/tt&gt; argument to limit what is exported. &lt;span class=&quot;anchor&quot; id=&quot;line-208&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-209&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;Note: If you are not running the exporter on in-place SSTables, there are a couple of things to keep in mind. &lt;span class=&quot;anchor&quot; id=&quot;line-210&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-211&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;The corresponding configuration must be present (same as it would be to run a node). &lt;span class=&quot;anchor&quot; id=&quot;line-212&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;SSTables are expected to be in a directory named for the keyspace (same as they would be on a production node). &lt;span class=&quot;anchor&quot; id=&quot;line-213&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-214&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;line862&quot;&gt;JSON exported SSTables can be &quot;imported&quot; to create new SSTables using &lt;tt class=&quot;backtick&quot;&gt;bin/json2sstable&lt;/tt&gt;: &lt;span class=&quot;anchor&quot; id=&quot;line-215&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-216&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-217&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-218&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Usage: json2sstable -K keyspace -c column_family &amp;lt;json&amp;gt; &amp;lt;sstable&amp;gt;&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-219&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt;&lt;tt class=&quot;backtick&quot;&gt;bin/json2sstable&lt;/tt&gt;  takes arguments for keyspace and column family names, and full paths  for the JSON input file and the destination SSTable file name. &lt;span class=&quot;anchor&quot; id=&quot;line-220&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-221&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;You can also import pre-serialized rows of data using the &lt;a href=&quot;http://wiki.apache.org/cassandra/BinaryMemtable&quot;&gt;BinaryMemtable&lt;/a&gt;  interface.  This is useful for importing via Hadoop or another source  where you want to do some preprocessing of the data to import. &lt;span class=&quot;anchor&quot; id=&quot;line-222&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-223&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;NOTE:  Starting with version 0.7, json2sstable and sstable2json must be run in  such a way that the schema can be loaded from system tables.  This  means that cassandra.yaml must be found in the classpath and refer to  valid storage directories. &lt;span class=&quot;anchor&quot; id=&quot;line-224&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-225&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Monitoring&quot;&gt;Monitoring&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-226&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line862&quot;&gt;Running &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;cfstats&lt;/tt&gt;  can provide an overview of each Column Family, and important metrics to  graph your cluster. Cassandra also exposes internal metrics as JMX  data. This is a common standard in the JVM world; OpenNMS, Nagios, and  Munin at least offer some level of JMX support. For a non-stupid JMX  plugin for Munin check out &lt;a class=&quot;https&quot; href=&quot;https://github.com/tcurdt/jmx2munin&quot;&gt;https://github.com/tcurdt/jmx2munin&lt;/a&gt;  &lt;span class=&quot;anchor&quot; id=&quot;line-227&quot;&gt;&lt;/span&gt;The specifics of the JMX Interface are documented at &lt;a href=&quot;http://wiki.apache.org/cassandra/JmxInterface&quot;&gt;JmxInterface&lt;/a&gt;.  &lt;span class=&quot;anchor&quot; id=&quot;line-228&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-229&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;Some folks prefer having to deal with non-jmx clients, there is a JMX-to-REST bridge available at &lt;a class=&quot;http&quot; href=&quot;http://code.google.com/p/polarrose-jmx-rest-bridge/&quot;&gt;http://code.google.com/p/polarrose-jmx-rest-bridge/&lt;/a&gt; Bridging to SNMP is a bit more work but can be done with &lt;a class=&quot;https&quot; href=&quot;https://github.com/tcurdt/jmx2snmp&quot;&gt;https://github.com/tcurdt/jmx2snmp&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-230&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-231&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;Important metrics to watch on a per-Column Family basis would be: &lt;strong&gt;Read Count, Read Latency, Write Count and Write Latency&lt;/strong&gt;. &lt;strong&gt;Pending Tasks&lt;/strong&gt; tell you if things are backing up. These metrics can also be exposed using any JMX client such as &lt;tt class=&quot;backtick&quot;&gt;jconsole&lt;/tt&gt;.  (See also &lt;a class=&quot;http&quot; href=&quot;http://simplygenius.com/2010/08/jconsole-via-socks-ssh-tunnel.html&quot;&gt;http://simplygenius.com/2010/08/jconsole-via-socks-ssh-tunnel.html&lt;/a&gt; for how to proxy JConsole to firewalled machines.) &lt;span class=&quot;anchor&quot; id=&quot;line-232&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-233&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;You can also use jconsole, and the MBeans tab to look at &lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/PendingTasks&quot;&gt;PendingTasks&lt;/a&gt;  for thread pools. If you see one particular thread backing up, this can  give you an indication of a problem. One example would be  ROW-MUTATION-STAGE indicating that write requests are arriving faster  than they can be handled. A more subtle example is the FLUSH stages: if  these start backing up, cassandra is accepting writes into memory fast  enough, but the sort-and-write-to-disk stages are falling behind. &lt;span class=&quot;anchor&quot; id=&quot;line-234&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-235&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line874&quot;&gt;If you are seeing a lot of tasks being built up, your hardware or configuration tuning is probably the bottleneck. &lt;span class=&quot;anchor&quot; id=&quot;line-236&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-237&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;Running &lt;tt class=&quot;backtick&quot;&gt;nodetool&amp;nbsp;tpstats&lt;/tt&gt; will dump all of those threads to console if you don&#39;t want to use jconsole. Example: &lt;span class=&quot;anchor&quot; id=&quot;line-238&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-239&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-240&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-241&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-242&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-243&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-244&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-245&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-246&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-247&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-248&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-249&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-250&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-251&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-252&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-253&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-254&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-255&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-256&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-257&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-258&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-259&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-260&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Pool Name                    Active   Pending      Completed
FILEUTILS-DELETE-POOL             0         0            119
MESSAGING-SERVICE-POOL            3         4       81594002
STREAM-STAGE                      0         0              3
RESPONSE-STAGE                    0         0       48353537
ROW-READ-STAGE                    0         0          13754
LB-OPERATIONS                     0         0              0
COMMITLOG                         1         0       78080398
GMFD                              0         0        1091592
MESSAGE-DESERIALIZER-POOL         0         0      126022919
LB-TARGET                         0         0              0
CONSISTENCY-MANAGER               0         0           2899
ROW-MUTATION-STAGE                1         2       81719765
MESSAGE-STREAMING-POOL            0         0            129
LOAD-BALANCER-STAGE               0         0              0
FLUSH-SORTER-POOL                 0         0            218
MEMTABLE-POST-FLUSHER             0         0            218
COMPACTION-POOL                   0         0            464
FLUSH-WRITER-POOL                 0         0            218
HINTED-HANDOFF-POOL               0         0            154&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-261&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line867&quot;&gt; &lt;/div&gt;&lt;h2 id=&quot;Monitoring_with_MX4J&quot;&gt;Monitoring with MX4J&lt;/h2&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-262&quot;&gt;&lt;/span&gt;&lt;div class=&quot;line874&quot;&gt;mx4j  provides an HTML and HTTP interface to JMX. Starting from version 0.7.0  cassandra lets you hook up mx4j very easily. To enable mx4j on a  Cassandra node: &lt;span class=&quot;anchor&quot; id=&quot;line-263&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-264&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;Download mx4j-tools.jar from &lt;a class=&quot;http&quot; href=&quot;http://mx4j.sourceforge.net/&quot;&gt;http://mx4j.sourceforge.net/&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-265&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Add mx4j-tools.jar to the classpath (e.g. under lib/) &lt;span class=&quot;anchor&quot; id=&quot;line-266&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Start cassandra &lt;span class=&quot;anchor&quot; id=&quot;line-267&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot;&gt;In the log you should see a message such as &lt;a class=&quot;nonexistent&quot; href=&quot;http://wiki.apache.org/cassandra/HttpAtapter&quot;&gt;HttpAtapter&lt;/a&gt; started on port 8081 &lt;span class=&quot;anchor&quot; id=&quot;line-268&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;To  choose a different port (8081 is the default) or a different listen  address (0.0.0.0 is not the default) edit conf/cassandra-env.sh and  uncomment #MX4J_ADDRESS=&quot;-Dmx4jaddress=0.0.0.0&quot; and  #MX4J_PORT=&quot;-Dmx4jport=8081&quot; &lt;span class=&quot;anchor&quot; id=&quot;line-269&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-270&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line862&quot;&gt;Now browse to &lt;a class=&quot;http&quot; href=&quot;http://cassandra:8081/&quot;&gt;http://cassandra:8081/&lt;/a&gt; and use the HTML interface. &lt;span class=&quot;anchor&quot; id=&quot;line-271&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-272&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;If you want XML then add &amp;amp;template=identity to the end of any URL, e.g. &lt;a class=&quot;http&quot; href=&quot;http://cassandra:8081/?&amp;amp;template=identity&quot;&gt;http://cassandra:8081/?&amp;amp;template=identity&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-273&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-274&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line862&quot;&gt;For more details see &lt;a class=&quot;https&quot; href=&quot;https://issues.apache.org/jira/browse/CASSANDRA-1068&quot;&gt;https://issues.apache.org/jira/browse/CASSANDRA-1068&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/6546877783418543742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-load-balancing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/6546877783418543742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/6546877783418543742'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-load-balancing.html' title='Cassandra Load Balancing'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-8033815208267149110</id><published>2011-06-27T21:04:00.000+05:30</published><updated>2011-06-28T14:00:55.140+05:30</updated><title type='text'>Cassandra error after installation in windows</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;Followed the steps to install the apache-cassandra latest build. Upon first startup (./cassandra -f), I get this:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/apache/cassandra/thrift/CassandraDaemon Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.thrift.CassandraDaemon at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: org.apache.cassandra.thrift.CassandraDaemon. Program will exit.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;I exported the JAVA_HOME path, etc. What am I doing wrong? I should note that I am on an Ubuntu Lucid machine.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #cc0000; border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: yellow;&quot;&gt;The first thing you should do is setup&amp;nbsp;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;&quot;&gt;CASSANDRA_HOME&lt;/code&gt;&amp;nbsp;path to the Cassandra root directory. Try running cassandra&amp;nbsp;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;&quot;&gt;cassandra -f&lt;/code&gt;&amp;nbsp;and everything will run smooth. (Cassandra actually checks CASSANDRA_HOME environment variable to find the lib folder to run the deamon).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/8033815208267149110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-error-after-installation-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/8033815208267149110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/8033815208267149110'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-error-after-installation-in.html' title='Cassandra error after installation in windows'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-6721711424239701948</id><published>2011-06-27T21:01:00.000+05:30</published><updated>2011-06-27T21:02:03.068+05:30</updated><title type='text'>Installing Cassandra on UBuntu debian via ppa repository</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: black; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;a href=&quot;http://wiki.apache.org/cassandra/&quot; style=&quot;text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Cassandra&lt;/a&gt;&amp;nbsp;is a distributed database with a BigTable data model running on a&lt;a href=&quot;http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html&quot; style=&quot;text-decoration: none;&quot;&gt;Dynamo&lt;/a&gt;&amp;nbsp;like infrastructure. It is column-oriented and allows for the storage of relatively structured data. It has a fully decentralized model; every node is identical and there is no single point of failure. It&#39;s also&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;extremely fault tolerant; data is replicated to multiple nodes and across data centers. Cassandra is also very elastic; read and write throughput increase linearly as new machines are added.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Cassandra was open sourced by Facebook in 2008, where it was designed by Avinash Lakshman (one of the authors of Amazon&#39;s Dynamo) and Prashant Malik ( Facebook Engineer ). Now it is in production use&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;at Rackspace,&amp;nbsp;Digg, Facebook, Twitter, Cisco, Mahalo, Ooyala, and&amp;nbsp;&lt;a href=&quot;http://n2.nabble.com/Cassandra-users-survey-tp4040068p4040393.html&quot; style=&quot;text-decoration: none;&quot;&gt;more companies&lt;/a&gt;&amp;nbsp;that have large, active data sets. The largest production cluster has over 100 TB of data in over 150 machines.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;To install Cassandra on Debian or other Debian derivatives like Ubuntu, LinuxMint..., use the following:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;1- First upgrade your software :&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 180, 190); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(180, 180, 180); border-left-style: solid; border-left-width: 20px; border-right-color: rgb(170, 180, 190); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 180, 190); border-top-style: dotted; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 11px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 5px; padding-left: 10px; padding-right: 0px; padding-top: 5px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;sudo apt-get upgrade&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;2- Now open sources.list&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 180, 190); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(180, 180, 180); border-left-style: solid; border-left-width: 20px; border-right-color: rgb(170, 180, 190); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 180, 190); border-top-style: dotted; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 11px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 5px; padding-left: 10px; padding-right: 0px; padding-top: 5px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;sudo vi /etc/apt/sources.list&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;3- add the following lines to your source.list&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 180, 190); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(180, 180, 180); border-left-style: solid; border-left-width: 20px; border-right-color: rgb(170, 180, 190); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 180, 190); border-top-style: dotted; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 11px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 5px; padding-left: 10px; padding-right: 0px; padding-top: 5px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;deb http://www.apache.org/dist/cassandra/debian unstable main&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 180, 190); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(180, 180, 180); border-left-style: solid; border-left-width: 20px; border-right-color: rgb(170, 180, 190); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 180, 190); border-top-style: dotted; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 11px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 5px; padding-left: 10px; padding-right: 0px; padding-top: 5px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;deb-src http://www.apache.org/dist/cassandra/debian unstable main&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;4- Run update&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 180, 190); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(180, 180, 180); border-left-style: solid; border-left-width: 20px; border-right-color: rgb(170, 180, 190); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 180, 190); border-top-style: dotted; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 11px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 5px; padding-left: 10px; padding-right: 0px; padding-top: 5px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;sudo apt-get update &lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Now you will see an error similar to this:&lt;br /&gt;
&lt;br /&gt;
GPG error: http://www.apache.org unstable Release: The following signatures couldn&#39;t be verified because the public key is not available: NO_PUBKEY F758CE318D77295D&lt;br /&gt;
&lt;br /&gt;
This simply means you need to add the PUBLIC_KEY. You do that like this:&lt;br /&gt;
&lt;br /&gt;
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys F758CE318D77295D&lt;br /&gt;
gpg --export --armor F758CE318D77295D | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
5- Run update again and install cassandra&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 180, 190); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(180, 180, 180); border-left-style: solid; border-left-width: 20px; border-right-color: rgb(170, 180, 190); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 180, 190); border-top-style: dotted; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 11px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 5px; padding-left: 10px; padding-right: 0px; padding-top: 5px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install cassandra&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;6- Now start Cassandra :&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 180, 190); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(180, 180, 180); border-left-style: solid; border-left-width: 20px; border-right-color: rgb(170, 180, 190); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 180, 190); border-top-style: dotted; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 11px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 5px; padding-left: 10px; padding-right: 0px; padding-top: 5px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;sudo /etc/init.d/cassandra start&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Note :&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;-By default, Cassandra uses 7000 for cluster communication, 9160 for clients (Thrift), and 8080 for&amp;nbsp;&lt;a href=&quot;http://wiki.apache.org/cassandra/JmxInterface&quot; style=&quot;text-decoration: none;&quot;&gt;JMX&lt;/a&gt;. These are all editable in the configuration file or bin/cassandra.in.sh (for JVM options). All ports are TCP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;- The configuration files are located in /etc/cassandra&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Find more on :&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://wiki.apache.org/cassandra/&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;font-family: arial, helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;http://wiki.apache.org/cassandra/&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/6721711424239701948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/installing-cassandra-on-ubuntu-debian.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/6721711424239701948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/6721711424239701948'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/installing-cassandra-on-ubuntu-debian.html' title='Installing Cassandra on UBuntu debian via ppa repository'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-2365880627078228265</id><published>2011-06-27T20:45:00.001+05:30</published><updated>2011-06-27T20:45:39.837+05:30</updated><title type='text'>Bulk Insert Cassandra</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;Binary Memtable is the name of Cassandra&#39;s bulk-load interface. It avoids several kinds of overhead associated with the normal Thrift API:&lt;span class=&quot;anchor&quot; id=&quot;line-2&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-3&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;li&gt;Converting to Thrift from the internal structures and back&lt;span class=&quot;anchor&quot; id=&quot;line-4&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Routing (copying) from a coordinator node to the replica nodes&lt;span class=&quot;anchor&quot; id=&quot;line-5&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Writing to the commitlog&lt;span class=&quot;anchor&quot; id=&quot;line-6&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Serializing the internal structures to on-disk format&lt;span class=&quot;anchor&quot; id=&quot;line-7&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-8&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line874&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;The tradeoff you make is that it is considerably less convenient to use than Thrift:&lt;span class=&quot;anchor&quot; id=&quot;line-9&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-10&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0.25em;&quot;&gt;You must use the&amp;nbsp;&lt;a href=&quot;http://wiki.apache.org/cassandra/StorageProxy&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #4477ff; text-decoration: none;&quot;&gt;StorageProxy&lt;/a&gt;&amp;nbsp;API, only available as Java code&lt;span class=&quot;anchor&quot; id=&quot;line-11&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;You must pre-serialize the rows yourself&lt;span class=&quot;anchor&quot; id=&quot;line-12&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;line862&quot; style=&quot;margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0.25em;&quot;&gt;The rows you send are not live for querying until a flush occurs (either normally because the Binary Memtable fills up, or because you request one with&amp;nbsp;&lt;tt class=&quot;backtick&quot;&gt;nodetool&lt;/tt&gt;)&lt;span class=&quot;anchor&quot; id=&quot;line-13&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;You must write an entire row at once&lt;span class=&quot;anchor&quot; id=&quot;line-14&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-15&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;line862&quot; style=&quot;font-family: sans-serif; font-size: 16px;&quot;&gt;There is an example of using Hadoop to load data through the Binary Memtable interface at&amp;nbsp;&lt;a class=&quot;https&quot; href=&quot;https://svn.apache.org/repos/asf/cassandra/trunk/contrib/bmt_example/&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #4477ff; text-decoration: none;&quot;&gt;https://svn.apache.org/repos/asf/cassandra/trunk/contrib/bmt_example/&lt;/a&gt;.&amp;nbsp;&lt;span class=&quot;anchor&quot; id=&quot;line-16&quot;&gt;&lt;/span&gt;.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/2365880627078228265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/bulk-insert-cassandra.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/2365880627078228265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/2365880627078228265'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/bulk-insert-cassandra.html' title='Bulk Insert Cassandra'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-7208560136647445263</id><published>2011-06-27T20:44:00.001+05:30</published><updated>2011-06-27T20:44:39.618+05:30</updated><title type='text'>Cassandra Hector error on bulk inserts</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: 18px;&quot;&gt;You are hitting the limit of the thrift transport frame size as configured in Apache Cassandra (15mb by default). See the comments in the stock cassandra.yaml file for the thrift_framed_transport_size_in_mb parameter for more information.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: 18px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: 18px;&quot;&gt;Increase the transport frame size to more and you should see this issue not happen&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: 18px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: 18px;&quot;&gt;Thanks&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/7208560136647445263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-error-on-bulk-inserts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7208560136647445263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/7208560136647445263'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-error-on-bulk-inserts.html' title='Cassandra Hector error on bulk inserts'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-3653846214398212687</id><published>2011-06-27T20:42:00.000+05:30</published><updated>2011-06-27T20:42:23.167+05:30</updated><title type='text'>Cassandra Hector Broken Pipe Recovery</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #222222; font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small; line-height: 19px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
I found tons of these exceptions and a posting that this was a known&lt;br /&gt;
issue in 0.7.0-18 (?). Unfortunately I was running 0.7.0-28. This&lt;br /&gt;
happened roughly when I added 2 more nodes to the cluster. While&lt;br /&gt;
pelops picks them up hector does not and throws these exception&lt;br /&gt;
forever. Has somebody experienced this already and has a clue?&lt;br /&gt;
&lt;br /&gt;
2011-04-30 00:00:48,640 INFO  [pool-3-thread-1]&lt;br /&gt;
me.prettyprint.cassandra.connection.NodeAutoDiscoverService - using&lt;br /&gt;
existing hosts [10.0.78.42(10.0.78.42):9160, 10.0.78.40(10.0.78.40):&lt;br /&gt;
9160, 10.0.78.41(10.0.78.41):9160]&lt;br /&gt;
2011-04-30 00:00:48,640 ERROR [pool-3-thread-1]&lt;br /&gt;
me.prettyprint.cassandra.connection.NodeAutoDiscoverService -&lt;br /&gt;
Discovery Service failed attempt to connect CassandraHost&lt;br /&gt;
org.apache.thrift.transport.TTransportException:&lt;br /&gt;
java.net.SocketException: Broken pipe&lt;br /&gt;
at&lt;br /&gt;
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.java:&lt;br /&gt;
147)&lt;br /&gt;
at&lt;br /&gt;
org.apache.thrift.transport.TFramedTransport.flush(TFramedTransport.java:&lt;br /&gt;
156)&lt;br /&gt;
at org.apache.cassandra.thrift.Cassandra&lt;br /&gt;
$Client.send_describe_keyspaces(Cassandra.java:1019)&lt;br /&gt;
at org.apache.cassandra.thrift.Cassandra&lt;br /&gt;
$Client.describe_keyspaces(Cassandra.java:1009)&lt;br /&gt;
at&lt;br /&gt;
me.prettyprint.cassandra.connection.NodeAutoDiscoverService.discoverNodes(NodeAutoDiscoverService.java:&lt;br /&gt;
81)&lt;br /&gt;
at me.prettyprint.cassandra.connection.NodeAutoDiscoverService&lt;br /&gt;
$QueryRing.run(NodeAutoDiscoverService.java:56)&lt;br /&gt;
at java.util.concurrent.Executors&lt;br /&gt;
$RunnableAdapter.call(Executors.java:441)&lt;br /&gt;
at java.util.concurrent.FutureTask&lt;br /&gt;
$Sync.innerRunAndReset(FutureTask.java:317)&lt;br /&gt;
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:&lt;br /&gt;
150)&lt;br /&gt;
at java.util.concurrent.ScheduledThreadPoolExecutor&lt;br /&gt;
$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)&lt;br /&gt;
at java.util.concurrent.ScheduledThreadPoolExecutor&lt;br /&gt;
$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)&lt;br /&gt;
at java.util.concurrent.ScheduledThreadPoolExecutor&lt;br /&gt;
$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)&lt;br /&gt;
at java.util.concurrent.ThreadPoolExecutor&lt;br /&gt;
$Worker.runTask(ThreadPoolExecutor.java:886)&lt;br /&gt;
at java.util.concurrent.ThreadPoolExecutor&lt;br /&gt;
$Worker.run(ThreadPoolExecutor.java:908)&lt;br /&gt;
at java.lang.Thread.run(Thread.java:662)&lt;br /&gt;
Caused by: java.net.SocketException: Broken pipe&lt;br /&gt;
at java.net.SocketOutputStream.socketWrite0(Native Method)&lt;br /&gt;
at&lt;br /&gt;
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)&lt;br /&gt;
at java.net.SocketOutputStream.write(SocketOutputStream.java:&lt;br /&gt;
136)&lt;br /&gt;
at&lt;br /&gt;
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)&lt;br /&gt;
at&lt;br /&gt;
java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)&lt;br /&gt;
at&lt;br /&gt;
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.java:&lt;br /&gt;
145)&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: palatino, georgia, verdana, arial, sans-serif; font-size: x-small; line-height: 19px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #990000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: yellow;&quot;&gt;I did&#39;nt add the auto discovery service until *.22 iirc, so that may
have been a typo referring to *.28. Try it with the latest release and
let me know how it goes. Another thought - are you using
authentication per chance?&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #222222;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;color: #222222;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/3653846214398212687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-broken-pipe-recovery.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/3653846214398212687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/3653846214398212687'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-hector-broken-pipe-recovery.html' title='Cassandra Hector Broken Pipe Recovery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1327521981890211928.post-4151758783748697989</id><published>2011-06-27T20:38:00.001+05:30</published><updated>2011-06-27T20:38:50.909+05:30</updated><title type='text'>Cassandra Broken Pipe Exception</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 12px;&quot;&gt;Hi all,&lt;br /&gt;
I am using hector-0.7.0-18 and i meet this problem:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
I try to use hector with failover configuration:Cluster cluster =&lt;br /&gt;
HFactory.getOrCreateCluster(&quot;clusterName&quot;,&lt;br /&gt;
&quot;10.18.130.100:9160,10.18.130.201:9160&quot;);&lt;br /&gt;
every thing is OK before one of the connection&#39;s Socket meet the&lt;br /&gt;
SocketException: Broken pipe.&lt;br /&gt;
This exception was wrapped by the thrift in an TTransportException,&lt;br /&gt;
I check the hector&#39;s source FailoverOperator.java and i found the&lt;br /&gt;
function &quot;operate(Operation&amp;lt;?&amp;gt; op)&quot; catch this exception by catch&lt;br /&gt;
(Exception e) without calling the invalidate() which was used to make&lt;br /&gt;
sure the client was ok. &quot;operate&quot; simply throw this Exception to the&lt;br /&gt;
caller&lt;br /&gt;
i have to restart the application to avoid this endless loop..&lt;br /&gt;
is there any way to remove the broken client from the client pool? or&lt;br /&gt;
any other suggestion?&lt;br /&gt;
here is the exception&lt;br /&gt;
2010-10-28 14:53:55,524 - INFO &amp;nbsp;[pool-1-thread-12:CasFactory@93][] -&lt;br /&gt;
init the cluster with configure:10.18.130.100:9160,10.18.130.201:9160&lt;br /&gt;
2010-10-28 14:53:55,525 - DEBUG [pool-1-&lt;br /&gt;
thread-12:CassandraClientPoolByHostImpl@87][] - Borrowing client from&lt;br /&gt;
CassandraClientPoolImpl&amp;lt;10.18.130.201(10.18.130.201):9160&amp;gt;&lt;br /&gt;
2010-10-28 14:53:55,525 - DEBUG [pool-1-&lt;br /&gt;
thread-12:CassandraClientPoolByHostImpl@92][] - Just before borrow:&lt;br /&gt;
CassandraClientPoolImpl&amp;lt;10.18.130.201(10.18.130.201):&lt;br /&gt;
9160&amp;gt;&amp;amp;maxActive=50&amp;amp;maxIdle=-1&amp;amp;lifo=true&amp;amp;minEvictableIdleTimeMillis=1800000&amp;amp; timeBetweenEvictionRunsMillis=-1&amp;amp;blockedThreadCount=1&amp;amp;liveClientsFromPool.s ize=2&amp;amp;numActive=0&amp;amp;numIdle=2&lt;br /&gt;
2010-10-28 14:53:55,525 - DEBUG [pool-1-&lt;br /&gt;
thread-12:CassandraClientPoolByHostImpl@98][] - Client&lt;br /&gt;
CassandraClient&amp;lt;10.18.130.201:9160-4&amp;gt; successfully borrowed from&lt;br /&gt;
CassandraClientPoolImpl&amp;lt;10.18.130.201(10.18.130.201):9160&amp;gt;&lt;br /&gt;
(thread=pool-1-thread-12)&lt;br /&gt;
2010-10-28 14:53:55,525 - DEBUG [pool-1-thread-12:FailoverOperator@186]&lt;br /&gt;
[] - Performing operation on 10.18.130.201:9160; retries: 2&lt;br /&gt;
2010-10-28 14:53:55,525 - ERROR [pool-1-thread-12:FailoverOperator@146]&lt;br /&gt;
[] - Cannot retry failover, got an Exception&lt;br /&gt;
org.apache.thrift.transport.TTransportException:&lt;br /&gt;
java.net.SocketException: Broken pipe&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.jav a:&lt;br /&gt;
147)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
org.apache.thrift.transport.TFramedTransport.flush(TFramedTransport.java:&lt;br /&gt;
156)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.cassandra.thrift.Cassandra&lt;br /&gt;
$Client.send_set_keyspace(Cassandra.java:455)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.cassandra.thrift.Cassandra&lt;br /&gt;
$Client.set_keyspace(Cassandra.java:444)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.FailoverOperator.operateSingleIteration(Fa iloverOperator.java:&lt;br /&gt;
192)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator. java:&lt;br /&gt;
99)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.KeyspaceServiceImpl.operateWithFailover(Ke yspaceServiceImpl.java:&lt;br /&gt;
123)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.KeyspaceServiceImpl.multigetSuperSlice(Key spaceServiceImpl.java:&lt;br /&gt;
473)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.thrift.ThriftMultigetSuperSliceQuery&lt;br /&gt;
$1.doInKeyspace(ThriftMultigetSuperSliceQuery.java:61)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.thrift.ThriftMultigetSuperSliceQuery&lt;br /&gt;
$1.doInKeyspace(ThriftMultigetSuperSliceQuery.java:55)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMea sure(KeyspaceOperationCallback.java:&lt;br /&gt;
20)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.ExecutingKeyspace.doExecute(ExecutingKeyspac e.java:&lt;br /&gt;
58)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.thrift.ThriftMultigetSuperSliceQuery.execute (ThriftMultigetSuperSliceQuery.java:&lt;br /&gt;
54)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at my code...&lt;br /&gt;
Caused by: java.net.SocketException: Broken pipe&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.net.SocketOutputStream.socketWrite0(Native Method)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.net.SocketOutputStream.write(SocketOutputStream.java:&lt;br /&gt;
153)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.jav a:&lt;br /&gt;
145)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ... 20 more&lt;br /&gt;
2010-10-28 14:53:55,526 - DEBUG [pool-1-&lt;br /&gt;
thread-12:CassandraClientPoolByHostImpl@168][] - Maybe releasing&lt;br /&gt;
client CassandraClient&amp;lt;10.18.130.201:9160-4&amp;gt;. is aready Released?&lt;br /&gt;
false&lt;br /&gt;
2010-10-28 14:53:55,526 - ERROR [pool-1-thread-12:TThreadPoolServer&lt;br /&gt;
$WorkerProcess@259][] - Error occurred during processing of message.&lt;br /&gt;
me.prettyprint.hector.api.exceptions.HectorException:&lt;br /&gt;
org.apache.thrift.transport.TTransportException:&lt;br /&gt;
java.net.SocketException: Broken pipe&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator. java:&lt;br /&gt;
149)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.KeyspaceServiceImpl.operateWithFailover(Ke yspaceServiceImpl.java:&lt;br /&gt;
123)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.KeyspaceServiceImpl.multigetSuperSlice(Key spaceServiceImpl.java:&lt;br /&gt;
473)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.thrift.ThriftMultigetSuperSliceQuery&lt;br /&gt;
$1.doInKeyspace(ThriftMultigetSuperSliceQuery.java:61)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.thrift.ThriftMultigetSuperSliceQuery&lt;br /&gt;
$1.doInKeyspace(ThriftMultigetSuperSliceQuery.java:55)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMea sure(KeyspaceOperationCallback.java:&lt;br /&gt;
20)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.ExecutingKeyspace.doExecute(ExecutingKeyspac e.java:&lt;br /&gt;
58)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.model.thrift.ThriftMultigetSuperSliceQuery.execute (ThriftMultigetSuperSliceQuery.java:&lt;br /&gt;
54)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at my code&lt;br /&gt;
Caused by: org.apache.thrift.transport.TTransportException:&lt;br /&gt;
java.net.SocketException: Broken pipe&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.jav a:&lt;br /&gt;
147)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
org.apache.thrift.transport.TFramedTransport.flush(TFramedTransport.java:&lt;br /&gt;
156)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.cassandra.thrift.Cassandra&lt;br /&gt;
$Client.send_set_keyspace(Cassandra.java:455)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.cassandra.thrift.Cassandra&lt;br /&gt;
$Client.set_keyspace(Cassandra.java:444)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.FailoverOperator.operateSingleIteration(Fa iloverOperator.java:&lt;br /&gt;
192)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator. java:&lt;br /&gt;
99)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ... 15 more&lt;br /&gt;
Caused by: java.net.SocketException: Broken pipe&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.net.SocketOutputStream.socketWrite0(Native Method)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.net.SocketOutputStream.write(SocketOutputStream.java:&lt;br /&gt;
153)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at&lt;br /&gt;
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.jav a:&lt;br /&gt;
145)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ... 20 more&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #cc0000; font-family: arial, sans-serif; font-size: 12px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #6fa8dc;&quot;&gt;This is a known issue and has been addressed in the &quot;concurrent&quot;&lt;br /&gt;
branch on github.&lt;br /&gt;
This branch will be merged back in to master at some point in the next&lt;br /&gt;
several days.&lt;br /&gt;
Some additional background:&lt;br /&gt;
&lt;a href=&quot;http://www.google.com/url?sa=D&amp;amp;q=http://groups.google.com/group/hector-users/browse_thread/thread/3aafa368c6af2bb1/23ef8a6dad0d1900%3Flnk%3Dgst%26q%3Dsocket%2323ef8a6dad0d1900&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://groups.google.com/group/hector-users/browse_thread/thread/3aaf...&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gettingstartedwithcassandra.blogspot.com/feeds/4151758783748697989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-broken-pipe-exception.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/4151758783748697989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1327521981890211928/posts/default/4151758783748697989'/><link rel='alternate' type='text/html' href='http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-broken-pipe-exception.html' title='Cassandra Broken Pipe Exception'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00660934795468000970</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>