kallaspriit / Cassandra-PHP-Client-Library

Cassandra PHP-based client library for managing and querying your Cassandra cluster
http://cassandra-php-client-library.com
103 stars 25 forks source link

Cannot create keyspace #17

Closed jeffjrare closed 12 years ago

jeffjrare commented 12 years ago

Hello!

I'm using Cassandra 1.1.0 installed from deb package (under Ubuntu 12), and I noticed that in the example.php the line

$cassandra->createKeyspace('CassandraExample')" 

isnt working, giving me the following stack trace (after ~10 sec.):

PHP Fatal error:  Uncaught exception 'cassandra_InvalidRequestException' in /home/jeff/Documents/projects/Cassandra-PHP-Client-Library/thrift/packages/cassandra/Cassandra.php:7863
Stack trace:
#0 /home/jeff/Documents/projects/Cassandra-PHP-Client-Library/thrift/packages/cassandra/Cassandra.php(1586): cassandra_Cassandra_system_add_keyspace_result->read(Object(TBinaryProtocolAccelerated))
#1 /home/jeff/Documents/projects/Cassandra-PHP-Client-Library/thrift/packages/cassandra/Cassandra.php(1547): cassandra_CassandraClient->recv_system_add_keyspace()
#2 [internal function]: cassandra_CassandraClient->system_add_keyspace(Object(cassandra_KsDef))
#3 /home/jeff/Documents/projects/Cassandra-PHP-Client-Library/Cassandra.php(971): call_user_func_array(Array, Array)
#4 /home/jeff/Documents/projects/Cassandra-PHP-Client-Library/Cassandra.php(1256): Cassandra->call('system_add_keys...', Object(cassandra_KsDef))
#5 /home/jeff/Documents/projects/Cassandra-PHP-Client-Library/test.php(37): Cassandra->createKeyspace('CassandraExampl...')
#6 {m in /home/jeff/Documents/projects/Cassandra-PHP-Client-Library/Cassandra.php on line 979

*When I create the keyspace manually from cassandra-cli, and after I run the example with commenting the drop-create line, everything works fine, columns family are correctly created into my keyspace, and the rest of the methods seems to work perfectly!

Thanks!

kallaspriit commented 12 years ago

Does the example.php code work for you?

jeffjrare commented 12 years ago

No, I tried it too, well my "test.php" file you see in stacktrace is a great copy-paste of it ;)

So same problem with example.php, createKeyspace fail.

Are you able on your side to run without any problem the example.php against Cassandra 1.1.0?

snipeur commented 12 years ago

same issue,

snipeur commented 12 years ago

[client 82.235.109.95] PHP Fatal error: Uncaught exception 'cassandra_InvalidRequestException' in /var/www/kallaspriit/thrift/packages/cassandra/Cassandra.php:7863\nStack trace:\n#0 /var/www/kallaspriit/thrift/packages/cassandra/Cassandra.php(1586): cassandra_Cassandra_system_add_keyspace_result->read(Object(TBinaryProtocolAccelerated))\n#1 /var/www/kallaspriit/thrift/packages/cassandra/Cassandra.php(1547): cassandra_CassandraClient->recv_system_add_keyspace()\n#2 [internal function]: cassandra_CassandraClient->system_add_keyspace(Object(cassandra_KsDef))\n#3 /var/www/kallaspriit/Cassandra.php(996): call_user_func_array(Array, Array)\n#4 /var/www/kallaspriit/Cassandra.php(1281): Cassandra->call('system_add_keys...', Object(cassandra_KsDef))\n#5 /var/www/kallaspriit/example.php(37): Cassandra->createKeyspace('CassandraExampl...')\n#6 {main}\n\nNext exception 'CassandraMaxRetriesException' with message 'Failed calling "system_add_keyspace" the maximum of 5 times' in /var/www/kallaspriit/Cassandra.php:1004\nStack trace:\n#0 /var/www/kallaspriit/Cassandra.php(1281 in /var/www/kallaspriit/Cassandra.php on line 1004

gykhauth commented 12 years ago

Same issue. Using: Cassandra 1.1.1 on Windows 7 localhost (for testing purpose) with Apache 2.2.2 and PHP 5.3.14.

caseylai commented 12 years ago

change the code of line 1277 in Cassandra.php to "$def->strategy_options = $placementStrategyOptions ? $placementStrategyOptions : array("replication_factor" => 1);", then works fine.