Syndicate content

Unable to complete the operation against any hosts — from Cassandra

Today I was testing a new intsallation that I prepared in the last month or so and once I hit Cassandra, I got this strange message:

   NoHostAvailable: ('Unable to complete the operation against any hosts',
   {<Host: 192.168.2.92 dc1>: Unavailable('Error from server: code=1000
   [Unavailable exception] message="Cannot achieve consistency level ONE"
   info={\'required_replicas\': 1, \'alive_replicas\': 0, \'consistency\': \'ONE\'}',)})

I looked for a solution with Google but was not really able to find anything that would explain that error.

Obviously, it is telling us that here is a need for at least 1 replica and right now that Cassandra cannot find any (alive_replicas is zero!)

Now, how come I can connect to Cassandra, the very one I am trying to access, the very one that tells me that there is no replicas. Is there something I do not understand here?

In this case it is a test with a single node, so you would think that it is indeed always going to work...

So... going back to the setup, I looked at my keyspace definition an I see:

    CREATE KEYSPACE snap_websites
           WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '1'}
           AND durable_writes = true;

So I'm all happy about it. After all, it looks good.

Then I wonder, could it be that somehow I need to define what DC1 actually is? I have dealt with something called a topology before and maybe that's it. I read the cassandra.yaml setup file and find out that the topology is indeed used by default, because the default snitch is GossipingPropertyFileSnitch.

    endpoint_snitch: GossipingPropertyFileSnitch

Great. So I'm making progress. I now look inside that topology file and I see two fields:

dc=dc1
rack=rack1

Am I am thinking, well... it also says DC1, doesn't it?

So I decide to search about data center and case sensitivity. It is case sensitive! So "dc1" != "DC1"... Changing the KEYSPACE with "dc1" and the database started to work as expected.

    ALTER KEYSPACE snap_websites
           WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '1'}
           AND durable_writes = true;

(Note: it is not unlikely that you will get a timeout error on this sort of change. If that happens, try the DESCRIBE KEYSPACE snap_websites to verify that it took as expected.)

Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.

  • .dylib
    Dynamic Library--the Mac OS/X naming convention for dynamic libraries. Not too sure why they choose that extension since FreeBSD uses .so just like most other Unices... To confuse people, maybe?
  • ItemInventory
  • Javascript
  • Turn Watcher
  • ps

    Unix command line tool used to list processes currently running. On some older Unices, it would also show zombies (processes that have exited but with parents who have not yet acknoledged their death.)