Cassandra Connection problem: Upgrade Cassandra driver

Hello,

Please help, I am having a problem connecting to cassandra:

, e:Traceback (most recent call last):
File “/opt/zato/2.0.7/zato-server/src/zato/server/connection/init.py”, line 405, in _create
session = self.create_session(name, item.config, item.config_no_sensitive)
File “/opt/zato/2.0.7/zato-server/src/zato/server/connection/cassandra.py”, line 66, in create_session
session = cluster.connect()
File “cassandra/cluster.py”, line 824, in cassandra.cluster.Cluster.connect (cassandra/cluster.c:11384)
File “cassandra/cluster.py”, line 850, in cassandra.cluster.Cluster.connect (cassandra/cluster.c:11204)
File “cassandra/cluster.py”, line 844, in cassandra.cluster.Cluster.connect (cassandra/cluster.c:11083)
File “cassandra/cluster.py”, line 2041, in cassandra.cluster.ControlConnection.connect (cassandra/cluster.c:36056)
File “cassandra/cluster.py”, line 2076, in cassandra.cluster.ControlConnection._reconnect_internal (cassandra/cluster.c:36914)
NoHostAvailable: (‘Unable to connect to any servers’, {‘cassandra.local’: error(24, ‘Too many open files’)})

I found out that my cassandra version and python 2.7.12 with cassandra_driver 3.0.0 (latest zato) have a problem.
The solution to upgrade this is to update the cassandra driver to at least 3.4.
I tried installing the cassandra-driver==3.9.0 and link it to the zato_extra_paths but looks like it’s not picked up.

How do I upgrade the zato embedded cassandra driver?

Thank you.

Hello,

can you please clarify what you mean by its not being picked up? What you did, what was expected and what instead the outcome was?

Regards.

This is what I found:

In folder: /opt/zato/2.0.7/eggs/
there was this file: cassandra_driver-3.0.0-py2.7-linux-x86_64.egg

I needed to upgrade it.

So I did a pip install cassandra-driver -U from zato user (the latest is 3.9.0)
and got an error of it not being able to remove it from a .pth file in the eggs folder

I also tried pip install cassandra-driver -U --ignore-installed
that didn’t throw an error but this was still there: /opt/zato/2.0.7/eggs/cassandra_driver-3.0.0-py2.7-linux-x86_64.egg
and pip freeze still showed cassandra-driver==3.0.0 (from zato user)

So I tried installing the cassandra driver as root and creating a symlink in /opt/zato/2.0.7/zato_extra_paths
lrwxrwxrwx 1 zato zato 48 Apr 25 18:34 cassandra -> /usr/local/lib/python2.7/dist-packages/cassandra
and restarted the server.

pip freeze from zato still showed 3.0.0 and the 3.0.0 egg was still in the eggs folder.
and the zato server still used 3.0.0

That’s what I meant for it not being picked up (3.9.0 from zato_extra_paths symlink)

Then I finally removed this folder /opt/zato/2.0.7/eggs/cassandra_driver-3.0.0-py2.7-linux-x86_64.egg
and I tested pip freeze again from zato user and now it’s cassandra-driver==3.9.0
and now my connections work.

So it kind of solved my issue, but I don’t know if that is the correct way of doing it.

Regards.

Hello @megalab,

to update the version of a dependency, please do the following:

  • cd to the directory with Zato
  • Open ./versions.cfg
  • Set the new version as needed
  • Run ./bin/buildout

I.e. we don’t use pip because up until very recently pip was not capable of achieving what we need.

As it happens, there is a recent feature branch where pip and requirements.txt file were in fact introduced but they have not been merged to the main branch yet:

The reason for the fact that it’s not in main is that I stumbled upon a few cryptic PYTHONPATH-related errors that occur only when using pip and I haven’t got around to dealing with it yet.

But in principle, yes, we will be migrating to pip from buildout, the process has begun.