Reputation: 679
I had setup Cassandra on 1 node and flooded it with data. Then I configured a second node, its initial token, seed etc. and started Cassandra on it. Now when I ran my Hector code on 1 node cluster it gave me all the data. But when I am running the same code on 2 node cluster I get less data(lesser number of columns and rows) . I am not understanding what I am doing wrong. I even tried to add a string of hosts using CassandraHostConfigurator but still I am not getting the entire data. I also tried running nodetool repair but still facing the same issue
Please help me
Upvotes: 2
Views: 407
Reputation: 1535
after you add a node to ring , Use nodetool ring
to view data load example my cluster have 3 nodes result will be similar:
192.168.23.84 datacenter1 rack1 Up Normal 37.52 GB 33.33%
192.168.23.85 datacenter1 rack1 Up Normal 37.5 GB 33.33%
192.168.23.86 datacenter1 rack1 Up Normal 37.5 GB 33.33%
if it similar that, when u use hector, use this code to check hector request to which server:
MutationResult result = mutator.execute();
logger.info(" host:" + result.getHostUsed().getHost());
try to write many time to recheck the destination host is contain all your host.
i use this CassandraHostConfigurator to add many host to a cluster when use Hector example:
CassandraHostConfigurator cassandraHostConfigurator = new CassandraHostConfigurator(
"192.168.23.84:9160,192.168.23.85:9160,192.168.23.86:9160");
cluster = HFactory.getOrCreateCluster("testcluster", cassandraHostConfigurator);
Upvotes: 0
Reputation: 4024
When you are adding nodes into the cluster you should start that node with
auto_bootstrap: true
in cassandra.yaml so that the other nodes in the cluster (in your case the only node) will stream the data new node (according to token).
Edit For the Casssandra-1.0 onwards there is no option as bootstrap in this case we have to start second node with new token calculated it will start streaming data.once streaming is finished run nodetool move <new_token>
. for more information see Adding nodes to cluster
If this is not done the second node will not have the data which it is supposed to hold according to token. And when you try to read data out of Cassandra It may be looking for the data on newly added node according to token but as there is no data you are not getting correct result.
Upvotes: 1