You can create keyspaces and column families with cassandra-cli. Once it is running, type 'help create keyspace;' or 'help create column family;'
- Tyler On Wed, Dec 22, 2010 at 8:20 AM, Rajkumar Gupta <rajkumar....@gmail.com>wrote: > Thanks Nick.... your suggestion just worked.!! > > I just tried the command 'use Keyspace1' (the keyspace i was trying to > access through my php script) at cassandra-cli and it was unable to > let me use that keyspace but I could successfully write another it for > another keyspace that actually existed. Thereby I have figured out the > actual problem because of which phpcassa was unable to connect to > cassandra (since there existed no keyspace by that name). > > So to complete this solution, could you let me know what is the proper > way to define a keyspace and import it, on a windows machine? > > Thank you so much, > Raj > > On Tue, Dec 21, 2010 at 8:30 AM, Rajkumar Gupta <rajkumar....@gmail.com> > wrote: > > I will try it out & let you know soon.. > > > > Thanks > > > > On Tue, Dec 21, 2010 at 1:20 AM, Tyler Hobbs <ty...@riptano.com> wrote: > >> Yes, Nick's suggestion is good. I've added a logging statement at that > >> point in the latest commit to phpcassa. Perhaps you could try that and > see > >> what the error is? > >> > >> - Tyler > >> > >> On Mon, Dec 20, 2010 at 12:35 PM, Nick Bailey <n...@riptano.com> wrote: > >>> > >>> So it looks like phpcassa doesn't log any errors. The error you are > seeing > >>> is because the connection to the first server failed and there are no > more > >>> servers to try. It doesn't say why it failed though. The only thing i > can > >>> reccommend is on line 57 of connection.php to add a line to print out > the > >>> exception it catches there to see what the problem is. Or just throw > the > >>> exception again so the script dies there. > >>> On Mon, Dec 20, 2010 at 11:38 AM, Rajkumar Gupta < > rajkumar....@gmail.com> > >>> wrote: > >>>> > >>>> Nick, > >>>> > >>>> Sorry I can not currently access my computer on which cassandra is > >>>> installed but yes, earlier I used the 'show keyspaces;' command & it > >>>> correctly showed me the keyspace1 with corresponding column families. > >>>> Yes I was using Cassandra 0.6.8 earlier and now I have switched to > >>>> 0.7. Since I was using thobbs phpcassa which infact worked with 0.7 > >>>> version but I came to know lately. I have tried on ubuntu as well but > >>>> I am not very proficient in ubuntu therefore I quit there and decided > >>>> to get it running on windows only. > >>>> > >>>> So right now, I am using Cassandra 0.7.0 on windows. I am trying to > >>>> use thobbs's PHPcassa with it but when I try this: > >>>> > >>>> <?php > >>>> require_once('Z:/wamp/bin/php/'.'phpcassa/connection.php'); > >>>> require_once('Z:/wamp/bin/php/'.'phpcassa/columnfamily.php'); > >>>> > >>>> $servers[0]['host'] = 'localhost'; > >>>> $servers[0]['port'] = '9160'; > >>>> $conn = new Connection('Keyspace1', $servers); > >>>> > >>>> $column_family = new ColumnFamily($conn, 'Standard1'); > >>>> ?> > >>>> > >>>> > >>>> Fatal error: Uncaught exception 'NoServerAvailable' in > >>>> Z:\wamp\bin\php\phpcassa\connection.php:153 > >>>> Stack trace: #0 Z:\wamp\bin\php\phpcassa\connection.php(53): > >>>> ServerSet->get() #1 Z:\wamp\bin\php\phpcassa\connection.php(64): > >>>> Connection->connect() #2 > >>>> Z:\wamp\bin\php\phpcassa\columnfamily.php(171): Connection->connect() > >>>> #3 Z:\wamp\www\PhpProject\index.php(10): > >>>> ColumnFamily->__construct(Object(Connection), 'Standard1') #4 {main} > >>>> thrown in Z:\wamp\bin\php\phpcassa\connection.php on line 153 > >>>> > >>>> Thanks so much Nick .. > >>>> > >>>> > >>>> On Mon, Dec 20, 2010 at 10:47 PM, Nick Bailey <n...@riptano.com> > wrote: > >>>> > Just to verify the keyspace exists can you run 'use Keyspace1;' in > the > >>>> > cli? > >>>> > Also it looks like you were using 0.6.8 and now you are using 0.7.0? > >>>> > What is > >>>> > the exact error you are seeing now? > >>>> > > >>>> > On Mon, Dec 20, 2010 at 10:21 AM, Rajkumar Gupta > >>>> > <rajkumar....@gmail.com> > >>>> > wrote: > >>>> >> > >>>> >> Keyspace1 is included by default in the cassandra.yaml file and I > >>>> >> imported the schema before running the php script > >>>> >> so I hope that is not the problem.. > >>>> >> > >>>> >> I am now too much frustrated with this problem..:( and this is > just > >>>> >> the beginning of my Cassandra experiments > >>>> >> > >>>> >> > >>>> >> > >>>> >> > >>>> >> On Mon, Dec 20, 2010 at 8:36 PM, Nick Bailey <n...@riptano.com> > wrote: > >>>> >> > Have you created Keyspace1? Looks like phpcassa requires you to > set > >>>> >> > a > >>>> >> > keyspace when you connect but the cli would not. Which might > explain > >>>> >> > why > >>>> >> > you > >>>> >> > are seeing problems. > >>>> >> > > >>>> >> > On Mon, Dec 20, 2010 at 5:42 AM, Rajkumar Gupta > >>>> >> > <rajkumar....@gmail.com> > >>>> >> > wrote: > >>>> >> >> > >>>> >> >> I am using the following code to connect to Cassandra 0.7.0 > using > >>>> >> >> PHPcassa (thobbs) > >>>> >> >> > >>>> >> >> <?php > >>>> >> >> require_once('Z:/wamp/bin/php/'.'phpcassa/connection.php'); > >>>> >> >> require_once('Z:/wamp/bin/php/'.'phpcassa/columnfamily.php'); > >>>> >> >> > >>>> >> >> $servers[0]['host'] = 'localhost'; > >>>> >> >> $servers[0]['port'] = '9160'; > >>>> >> >> $conn = new Connection('Keyspace1', $servers); > >>>> >> >> > >>>> >> >> $column_family = new ColumnFamily($conn, 'Standard1'); > >>>> >> >> ?> > >>>> >> >> > >>>> >> >> However I am able to connect to cassandra instance through > >>>> >> >> cassandra-cli at command prompt but not through this php script. > >>>> >> >> > >>>> >> >> > >>>> >> >> > >>>> >> >> > >>>> >> >> > >>>> >> >> On Mon, Dec 20, 2010 at 11:10 AM, Nick Bailey <n...@riptano.com > > > >>>> >> >> wrote: > >>>> >> >> > It would probably help if you posted the code you are trying > to > >>>> >> >> > use > >>>> >> >> > from > >>>> >> >> > your php script. I don't know much about the php client but I > now > >>>> >> >> > someone on > >>>> >> >> > this list does. > >>>> >> >> > > >>>> >> >> > On Sun, Dec 19, 2010 at 10:55 PM, Rajkumar Gupta > >>>> >> >> > <rajkumar....@gmail.com> > >>>> >> >> > wrote: > >>>> >> >> >> > >>>> >> >> >> I am able to connect to cassandra through cassandra-cli > command > >>>> >> >> >> at > >>>> >> >> >> command prompt but not through my php script. I also checked > >>>> >> >> >> after > >>>> >> >> >> changing the rpc address to 0.0.0.0 in cassandra.yaml file > but > >>>> >> >> >> it > >>>> >> >> >> still does not work! > >>>> >> >> >> > >>>> >> >> >> > >>>> >> >> >> On Mon, Dec 20, 2010 at 1:47 AM, Aaron Morton > >>>> >> >> >> <aa...@thelastpickle.com> > >>>> >> >> >> wrote: > >>>> >> >> >> > Forgot to say, 0.0.0.0 is not a good idea in production... > >>>> >> >> >> > http://wiki.apache.org/cassandra/FAQ#cant_listen_on_ip_any > >>>> >> >> >> > > >>>> >> >> >> > > >>>> >> >> >> > On 20/12/2010, at 9:12 AM, Aaron Morton > >>>> >> >> >> > <aa...@thelastpickle.com> > >>>> >> >> >> > wrote: > >>>> >> >> >> > > >>>> >> >> >> >> I've not used the PHP client, but you can test > connectivity > >>>> >> >> >> >> to > >>>> >> >> >> >> your > >>>> >> >> >> >> cluster using the cassandra-cli command line client in the > >>>> >> >> >> >> bin/ > >>>> >> >> >> >> folder. > >>>> >> >> >> >> > >>>> >> >> >> >> Also check the ThriftAddress setting in your > storage-config, > >>>> >> >> >> >> this > >>>> >> >> >> >> address is the one that the server will be listening on. > Set > >>>> >> >> >> >> it > >>>> >> >> >> >> to > >>>> >> >> >> >> 0.0.0.0 > >>>> >> >> >> >> to listen on all. > >>>> >> >> >> >> > >>>> >> >> >> >> Aaron > >>>> >> >> >> >> > >>>> >> >> >> >> On 19/12/2010, at 8:45 AM, Rajkumar Gupta > >>>> >> >> >> >> <rajkumar....@gmail.com> > >>>> >> >> >> >> wrote: > >>>> >> >> >> >> > >>>> >> >> >> >>> Hi, I am trying to use phpcassa(Hoan's) with Cassandra > 0.6.8 > >>>> >> >> >> >>> but > >>>> >> >> >> >>> when > >>>> >> >> >> >>> I try to run the following php script that includes > >>>> >> >> >> >>> phpcassa, > >>>> >> >> >> >>> > >>>> >> >> >> >>> > >>>> >> >> >> >>> <?php > >>>> >> >> >> >>> $GLOBALS['THRIFT_ROOT'] = > >>>> >> >> >> >>> 'Z:/wamp/bin/php/include/thrift/'; > >>>> >> >> >> >>> require_once > >>>> >> >> >> >>> > $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php'; > >>>> >> >> >> >>> require_once > >>>> >> >> >> >>> $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php'; > >>>> >> >> >> >>> require_once > >>>> >> >> >> >>> $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php'; > >>>> >> >> >> >>> require_once > >>>> >> >> >> >>> > $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php'; > >>>> >> >> >> >>> require_once > >>>> >> >> >> >>> > $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php'; > >>>> >> >> >> >>> > >>>> >> >> >> >>> include_once('Z:/wamp/bin/php/include/phpcassa.php'); > >>>> >> >> >> >>> include_once('Z:/wamp/bin/php/include/uuid.php'); > >>>> >> >> >> >>> > >>>> >> >> >> >>> CassandraConn::add_node('192.168.1.1', 9160); > >>>> >> >> >> >>> > >>>> >> >> >> >>> $users = new CassandraCF('Keyspace1', 'Users'); > >>>> >> >> >> >>> > >>>> >> >> >> >>> $users->insert('1', array('email' => > >>>> >> >> >> >>> 'hoan.tont...@gmail.com', > >>>> >> >> >> >>> 'password' => 'test')); > >>>> >> >> >> >>> ?> > >>>> >> >> >> >>> > >>>> >> >> >> >>> > >>>> >> >> >> >>> on running above script I get this error: > >>>> >> >> >> >>> > >>>> >> >> >> >>> Fatal error: Uncaught exception 'Exception' with message > >>>> >> >> >> >>> 'Could > >>>> >> >> >> >>> not > >>>> >> >> >> >>> connect to a cassandra server' in > >>>> >> >> >> >>> Z:\wamp\bin\php\include\phpcassa.php:70 Stack trace: #0 > >>>> >> >> >> >>> Z:\wamp\bin\php\include\phpcassa.php(193): > >>>> >> >> >> >>> CassandraConn::get_client() > >>>> >> >> >> >>> #1 Z:\wamp\www\PhpProject\index.php(38): > >>>> >> >> >> >>> CassandraCF->insert('1', > >>>> >> >> >> >>> Array) #2 {main} thrown in > >>>> >> >> >> >>> Z:\wamp\bin\php\include\phpcassa.php > >>>> >> >> >> >>> on > >>>> >> >> >> >>> line 70 > >>>> >> >> >> >>> > >>>> >> >> >> >>> Please let me know how can I make it work > >>>> >> >> >> >>> > >>>> >> >> >> >>> Thanks... > >>>> >> >> >> >>> -- > >>>> >> >> >> > > >>>> >> >> >> > >>>> >> >> >> > >>>> >> >> >> > >>>> >> >> >> -- > >>>> >> >> >> > >>>> >> >> >> ___________________________________ > >>>> >> >> >> > >>>> >> >> >> Rajkumar Gupta > >>>> >> >> >> Dihing 173, > >>>> >> >> >> Indian Institute of Technology Guwahati > >>>> >> >> >> India > >>>> >> >> >> > >>>> >> >> >> > >>>> >> >> >> http://in.linkedin.com/in/rajkumargupta1 > >>>> >> >> > > >>>> >> >> > > >>>> >> > > >>>> >> > > >>>> > > >>>> > > >>> > >> > >> > > >