Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unavailable exception #29

Open
trK54Ylmz opened this issue Oct 5, 2014 · 5 comments
Open

Unavailable exception #29

trK54Ylmz opened this issue Oct 5, 2014 · 5 comments
Assignees

Comments

@trK54Ylmz
Copy link

Here is my code. I think there is a encoding/decoding or response parse problem.

require_once 'vendor/autoload.php';

$nodes = array(
    '127.0.0.1:9042' => array(
        'username'  => 'cassandra',
        'password'  => 'cassandra'
    )
);

try {
    $database = new evseevnn\Cassandra\Database($nodes, 'test');
    $database->connect();

    $users = $database->query('SELECT * FROM user');

    var_dump($users);
} catch (evseevnn\Cassandra\Exception\CassandraException $e) {
   echo $e->getMessage() . PHP_EOL;
}

And exception message is:

Unavailable exception. Error data: array (
  'consistency' => 2573153,
  'node' => 1852731252,
  'replica' => 543253352,
)

CQL shell output:

cqlsh:test> SELECT * FROM user;

 id                                   | activated | name         | password | regdate                  | status | username
--------------------------------------+-----------+--------------+----------+--------------------------+--------+----------
 ef8949f0-09da-11e4-8132-e76149b7842c |     False | Tarık Yılmaz | pass1234 | 2014-01-01 13:45:12+0200 |  False |    tarik

(1 rows)

and finally stack trace

#0 /home/tarik/Desktop/cass/index.php(15): evseevnn\Cassandra\Database->query('SELECT * FROM u...')
#1 {main}
@evseevnn-zz evseevnn-zz self-assigned this Oct 6, 2014
@LarsFronius
Copy link
Collaborator

Hey @trK54Ylmz , how is your keyspace set up? Do you have a high replication factor and not all shards available?
Its true that we should send a exception that guides you towards this error better. Can you confirm, that this can be the issue?

@bborisovs
Copy link

Hi @LarsFronius ,

I get the same problem :

Fatal error: Uncaught exception 'evseevnn\Cassandra\Exception\CassandraException' with message 'Unavailable exception. Error data: array ( 'consistency' => 2573153, 'node' => 1852731252, 'replica' => 543253352, )'

I have single node hosted on AWS; My test keyspace is :
CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true;

Any suggestions how to fix it? Should I reduce the replication factor ?

@LarsFronius
Copy link
Collaborator

With a single node, there is no way to fulfil your replication_factor of 3 replicas, so Cassandra throws back that the keyspace is unavailable, which is what you see - the Error data array though is quite misleading.
With a replication_factor set to 1, you should be fine @bborisov

@bborisovs
Copy link

Thanks @LarsFronius that helped!

@trK54Ylmz
Copy link
Author

@LarsFronius Thanks that helped me too. @evseevnn My problem solved. It was my test keyspace and replication_factor was set to 3. But,

Unavailable exception. Error data

in my opinion the error message should be better than this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants