How do I connect to Cassandra DB from PHP? - cassandra

I am new to cassandra. I would like to know how can I connect to a Cassandra DB from PHP. I am looking to use this for a very high traffic website. Will thrift be the best option? Or can I connect using some other method efficiently?
Kindly let me know.

You should use the DataStax Cassandra PHP Driver. You should not use thrift.

Related

Using Cassandra for Message Archive Management (mod_mam) database in Ejabberd 16.09

I'm trying to use Cassandra for mod_mam in Ejabberd 16.09. Does that version of Ejabberd support Cassandra? If it does, how to configure Ejabberd to use Cassandra?
Also, I found some Erlang-Cassandra driver such as Cqerl, Erlcass, and Erlang-cassandra-cql. Can I use them to connect Ejabberd and Cassandra?
ejabberd doesn't support Cassandra as a database backend. The only available backends at the moment are: internal (i.e. Mnesia), Riak, MySQL, PostgreSQL, MS SQL, sqlite and other ODBC compatible databases.
Of course you can use mentioned Erlang drivers, but this will not be very easy to write a new database backend using them: some experience in Erlang and ejabberd is required.

Is it possible to use Cassandra with Node.js?

I would like to try Cassandra, but don't know how to integrate Cassandra with Node.js. When I say Node.js it is MEAN.JS or any other framework. Just let me know if there is a way?
you can follow these links datastax and github datastax node.js driver
If you are new to cassandra then you can study cassandra on datastax for free also.
You can use this cassandra-client npm also.

For Cassandra kundera.client.lookup.class options

In order to configure kundera for Cassandra, I notice there are 3 possible options for kundera.client.lookup.class as below
com.impetus.client.cassandra.pelops.PelopsClientFactory
com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory
com.impetus.client.cassandra.thrift.ThriftClientFactory
I am not sure of the Pros and Cons of the above 3 and hence not sure which one to use. Please help me decide
I suggest you to use com.impetus.client.cassandra.thrift.ThriftClientFactory. It is the implementation using just Cassandra's thrift api.
PelopsClient is not in active development.
DSClient is built over datastax driver of cassandra.
There is no real advantage of using either DSClient or ThriftClient.
After further research, I found the following
Don't use PelopsClient as its not in active development as mentioned by #karthik , but more importantly because of the issue reported here
Data Stax Driver is better than thrift client as it over comes few limitations of thrift and they use a different binary protocol specific to cassandra which gives a better performance. Refer Datastax java driver support for Cassandra using Kundera

Connecting to Cassandra Cluster instead of specific node

I am trying to learn Cassandra and have setup a 2 node Cassandra cluster. I have written a client in Java using cassandra jdbc driver, which currently connects to a hard coded single node in the cluster. Ideally, I would like my client to connect to the "cluster" rather then a specific node.
So that client code automatically connects to other node if the first node is down.
Is this possible using cassandra jdbc driver? Currently using below code to create connection
DriverManager.getConnection("jdbc:cassandra://localhost:9160/testdb");
Yes. If you're using the Datastax Java driver, you can get all of these benefits and more. From the documentation:
The driver has the following features:
connection pooling
node discovery
automatic failover
load balancing
What is your language? If you're using Java, I suggest for Hector framework.
http://hector-client.github.io/hector/build/html/index.html
I think it's very good for correspond on Cassandra db.

Using Zookeeper + Play + Cassandra DB (via Kundera)

Have anyone tried using Play framework(2.0.4) application with connect to cassandra db via kundera? I want to implement Zookeeper on top of cassandra DB. Have anyone tried combining them before?
I guess integration with play framework via Kundera is possible. Implementing zookeeper on top of cassandra is also possible, i guess. Did you look into cage API for this?
-Vivek

Resources