Question

I need help to connect Cassandra with php using 'PHPCassa'.I try it but getting following exception.I am using Ubuntu as a web server.

NoServerAvailable Object ( [message:protected] => An attempt was made to connect to every server twice, but all attempts failed. The last error was: exception 'cassandra_InvalidRequestException' with message 'Keyspace 'testApp' does not exist' in /var/www/Cassandra/phpcassa/thrift/packages/cassandra/Cassandra.php:138 Stack trace: #0 /var/www/Cassandra/phpcassa/thrift/packages/cassandra/Cassandra.php(138): thrift_protocol_read_binary(Object(TBinaryProtocolAccelerated), 'cassandra_Cassa...', false) #1 /var/www/Cassandra/phpcassa/thrift/packages/cassandra/Cassandra.php(113): CassandraClient->recv_set_keyspace() #2 /var/www/Cassandra/phpcassa/connection.php(102): CassandraClient->set_keyspace('testApp') #3 /var/www/Cassandra/phpcassa/connection.php(84): ConnectionWrapper->set_keyspace('testApp') #4 /var/www/Cassandra/phpcassa/connection.php(222): ConnectionWrapper->__construct('testApp', '127.0.0.1:9160', NULL, true, 5000, 5000) #5 /var/www/Cassandra/phpcassa/connection.php(258): ConnectionPool->make_conn() #6 /var/www/Cassandra/phpcassa/connection.php(352): ConnectionPool->get() #7 /var/www/Cassandra/phpcassa/connection.php(287): ConnectionPool->call('describe_keyspa...', 'testApp') #8 /var/www/Cassandra/phpcassa/columnfamily.php(194): ConnectionPool->describe_keyspace() #9 /var/www/Cassandra/index.php(7): ColumnFamily->__construct(Object(ConnectionPool), 'Users') #10 {main} [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/Cassandra/phpcassa/connection.php [line:protected] => 233 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/Cassandra/phpcassa/connection.php [line] => 258 [function] => make_conn [class] => ConnectionPool [type] => -> [args] => Array ( ) ) [1] => Array ( [file] => /var/www/Cassandra/phpcassa/connection.php [line] => 352 [function] => get [class] => ConnectionPool [type] => -> [args] => Array ( ) ) [2] => Array ( [file] => /var/www/Cassandra/phpcassa/connection.php [line] => 287 [function] => call [class] => ConnectionPool [type] => -> [args] => Array ( [0] => describe_keyspace [1] => testApp ) ) [3] => Array ( [file] => /var/www/Cassandra/phpcassa/columnfamily.php [line] => 194 [function] => describe_keyspace [class] => ConnectionPool [type] => -> [args] => Array ( ) ) [4] => Array ( [file] => /var/www/Cassandra/index.php [line] => 7 [function] => __construct [class] => ColumnFamily [type] => -> [args] => Array ( [0] => ConnectionPool Object ( [keyspace] => testApp [servers:ConnectionPool:private] => Array ( [0] => 127.0.0.1:9160 ) [pool_size:ConnectionPool:private] => 5 [send_timeout:ConnectionPool:private] => 5000 [recv_timeout:ConnectionPool:private] => 5000 [credentials:ConnectionPool:private] => [framed_transport:ConnectionPool:private] => 1 [queue:ConnectionPool:private] => Array ( ) [keyspace_description:ConnectionPool:private] => [max_retries] => 5 [recycle] => 10000 [stats] => Array ( [created] => 0 [failed] => 2 [recycled] => 0 ) [list_position] => 0 ) [1] => Users ) ) ) [previous:Exception:private] => )

Était-ce utile?

La solution

Keyspace names are case sensitive from thrift (phpcassa). If you used "cqlsh" to create your keyspace, and you did not use single quotes, then CQL will convert the name to be lower case before creating it.
http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/cql_reference/cql_lexicon_c.html#reference_ds_b4h_gx5_yj

Try connecting with "testapp" as the name in phpcassa.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top