1

I'm using cassandradb with the datastax python driver on a linux system. Typically when using other databases, I've found that that on unix-compatible systems there's usually a way to establish a connection to the database via a unix socket, instead of using the loopback interface. By connecting via socket, you can bypass the OS networking stack altogether, and the result is usually better performance.

I'm pretty sure that cassandra supports this, not in the least because there is a UnixSocketEndPoint class in the cassandra.connection module of the cassandra pip package. This class is implemented in the github repo, but there's no documentation whatsoever about how to use it. Is anybody using this? How do I go about configuring a unix-socket connection to cassandra with the python API?

I've managed to find the following code snippet, from the cassandra python driver tests on github:

lbp = UnixSocketWhiteListRoundRobinPolicy([UNIX_SOCKET_PATH])
ep = ExecutionProfile(load_balancing_policy=lbp)
endpoint = UnixSocketEndPoint(UNIX_SOCKET_PATH)
cls.cluster = TestCluster(contact_points=[endpoint], execution_profiles={EXEC_PROFILE_DEFAULT: ep})

Which actually is most of what I'm looking for. I'm just confused about how to configure cassandra to listen via socket instead of TCP. Or does cassandra have a default socket path?

Many thanks in advance.

Alex Pilafian
  • 121
  • 1
  • 5

0 Answers0