Closed mikeytag closed 14 years ago
Hey Mike, Thanks for being an early adopter and giving Pandra a try :)
I should probably mention first up that 0.1 is more of a functional prototype, and the library has been significantly refactored for the 0.2 release this coming April - the current snapshot will be indicative of the 0.2 API, perhaps there would be less pain going that path if you're looking to use it on a project?
But anyway, in terms of setup Pandra is mostly self-aware and comes bundled with the generated Thrift transports and php module source for Cassandra 0.5. No autoconfig is needed, you can just place the package where you want (maintaining directory structure, minus examples and tests in production), and include the config.php in your script, eg :
<?php require_once('/path/to/pandra/config.php'); if (PandraCore::connect('default', 'localhost)) echo "connected"; ?>
... and that should be it. There's a few basic examples in the /examples directory, which should just run out of the box on a fresh Cassandra install.
Thrift itself is the protocol Cassandra talks to its clients over, the bonus being a .thrift file manifest can be created whenever Cassandra's client facing API is changed - this is happening every few months at the moment as the Cassandra dev's are making their own fixes. The thrift (bin) tool can then generate an appropriate API for whatever language is in use, so in this case I've generated the php from thrift-php/cassandra.thrift and bundled it. In the event that I can't keep up with abstracting the Cassandra API changes, new versions of the .thrift can be grabbed from the Cassandra site, re-generated and installed into the library. You can then just bypass the data model and call getClient() directly for access to the new API until a Pandra analogue has been implemented. I guess that's for when you become more comfortable with Thrift/Cassandra, but just mentioning. :)
If you're using a 64-bit system, I'd suggest compiling up the php module. It's blazingly fast, and once compiled and installed Pandra will just detect it.
cd thrift-php/ext/thrift_protocol/ phpize configure make cp modules/thrift_protocol.so /path/to/php/modules
.. add it as an extension to your php.ini, restart apache etc.
Hope that helps, I'm working on a proper project site in the background and will try to iron out all this information a little more formally.
-Michael
Thank you so much Michael. Turns out I was thinking it was more complicated than it really was. Thanks for the recommendation for 64 bit machines, I will definitely compile my own thrift php module.
I look forward to working with Pandra/Cassandra and giving back to the project wherever possible. If you need anything or any help in getting the project site up let me know. I can provide mirroring/documentation or anything else you think would help the project. Just let me know.
Hi Michael. First I want to say thank you for writing this PHP library for Cassandra. I expect it will give me a great leg up into moving away from MySQL to Cassandra for our particular app.
I have installed and run Cassandra 0.51 successfully and done some basic get/set/del commands through the CLI. I think I am finally wrapping my RDBMS mind around this new architecture! ;) My next step is to begin to integrate Cassandra into my PHP application.
The problem I have right now is I am not entirely sure how to proceed using Pandra. I have downloaded the tarball, but am unsure over whether this is an extension I need to compile myself on all the clients (phpize, etc) or if I include specific files in the scripts I want to use it with, or both. Forgive me for asking such a newbie question here. I don't have a whole lot of experience with installing custom PHP extensions, about as far as I have gone is installing via pear and pecl.
I'm also a bit green on what Thrift is or how I need to install it on my client servers. The best thing I have found so far is: https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP However, they stop at installing the Thrift API and don't talk about Pandra at all.
If you or anyone else reading this forum could point me in the right direction for how best to integrate Cassandra into an existing PHP script I would greatly appreciate it.
Thanks, Mike