Hi,
I have spent half of the day today trying to make a new Cassandra
cluster to work. I have setup a single data center cluster, using
NetworkTopologyStrategy, DC1:3.
I'm using latest version of Astyanax client to connect. After many hours
of debug, I found out that the problem may be in cqlsh utility.
So, after the cluster was up and running:
[me@cassandra-node1 cassandra]$ nodetool status
Datacenter: DC-1
======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host
ID Rack
UN 10.11.1.109 59.1 KB 256 0.0%
726689df-edc3-49a0-b680-370953994a8c RAC2
UN 10.11.1.108 67.49 KB 256 0.0%
73cd86a9-4efb-4407-9fe8-9a1b3a277af7 RAC1
UN 10.11.1.200 59.84 KB 64 0.0%
d6d700d4-28aa-4722-b215-a6a7d304b8e7 RAC3
I went to create the keyspace:
1. First I have tried using cqlsh:
create keyspace foo with replication=
{'class':'NetworkTopologyStrategy','DC1':3};
after this, I have checked that the keyspace was properly created by
running
cqlsh> select * from system.schema_keyspaces;
keyspace_name | durable_writes |
strategy_class | strategy_options
---------------+----------------+------------------------------------------------------+----------------------------
system_auth | True |
org.apache.cassandra.locator.SimpleStrategy | {"replication_factor":"1"}
foo | True |
org.apache.cassandra.locator.NetworkTopologyStrategy | {"dc1":"3"}
system | True |
org.apache.cassandra.locator.LocalStrategy | {}
system_traces | True |
org.apache.cassandra.locator.SimpleStrategy | {"replication_factor":"1"}
but if I run nodetool describering foo, it will not show anything into
endpoint, or endpoint_details fields.
In this situation, Astyanax client will throw exception with
/NoAvailableHostsException/. I have used following configuration:
withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
.setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
.setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
First option did not worked at all.
2. I've dropped the keyspace crated with cqlsh and re-created with
cassandra-cli. This time, the nodetool describering foo, shows
information into endpoint and endpoint_details columns, and also the
Astyanax client works properly.
Hope it will avoid others to avoid spending time to figure out how to go
around this issue.
Br,
Gabi