我需要帮助才能使用'PHPCassa'将Cassandra与php连接起来。我尝试了但是得到了以下异常。我正在使用Ubuntu作为Web服务器。
NoServerAvailable Object([message:protected] =>尝试连接到每个服务器两次,但所有尝试都失败。最后一个错误是:异常'cassandra_InvalidRequestException',消息'Keyspace'testApp'不存在'在/var/www/Cassandra/phpcassa/thrift/packages/cassandra/Cassandra.php:138堆栈追踪:#0 /var/www/Cassandra/phpcassa/thrift/packages/cassandra/Cassandra.php(138):swift_protocol_read_binary(对象(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 /卡桑德拉/ phpcassa / connection.p hp(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):ConnectPool-> 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] =>数组([0] =>数组([file] => /var/www/Cassandra/phpcassa/connection.php [line] => 258 [function] => make_conn [class] => ConnectionPool [ type] => - > [args] => Array())[1] =>数组([file] => /var/www/Cassandra/phpcassa/connection.php [line] => 352 [function] => get [class] => ConnectionPool [type] => - > [args] => Array())[2] =>数组([file] => / var /www/Cassandra/phpcassa/connection.php [line] => 287 [function] => call [class] => ConnectionPool [type] => - > [args] =>数组([0 ] => describe_keyspace [1] => testApp))[3] =>数组([file] => /var/www/Cassandra/phpcassa/columnfamily.php [line] => 194 [功能] => describe_keyspace [class] => ConnectionPool [type] => - > [args] => Array())[4] =>数组([file] => / var / www / Cassandra /index.php [line] => 7 [function] => __construct [class] => ColumnFamily [type] => - > [args] =>数组([0] => Co nnectionPool对象([keyspace] => testApp [servers:ConnectionPool:private] =>数组([0] => 127.0.0.1:9160)[pool_size:ConnectionPool:private] => 5 [send_timeout:ConnectionPool:private] => 5000 [recv_timeout:ConnectionPool:private] => 5000 [凭证:ConnectionPool:私人] => [framed_transport:ConnectionPool:private] => 1 [queue:ConnectionPool:private] => Array()[keyspace_description:ConnectionPool:private] => [max_retries] => 5 [recycle] => 10000 [stats] =>数组([created] => 0 [失败] => 2 [再生] => 0)[list_position] => 0)[1] =>用户)))[上一个:例外:私人] => )
答案 0 :(得分:1)
Keyspace名称与thrift(phpcassa)区分大小写。如果使用“cqlsh”创建密钥空间,并且未使用单引号,则CQL会在创建之前将名称转换为小写。
http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/cql_reference/cql_lexicon_c.html#reference_ds_b4h_gx5_yj
尝试连接“testapp”作为phpcassa中的名称。