connect to cassandra using withWhiteListHosts

44 views
Skip to first unread message

regis le bretonnic

unread,
Jan 18, 2018, 2:43:18 PM1/18/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hi

We're desesperately trying to connect to cassandra using withWhiteListHosts policy. But despite all our attempts, it fails with the same error :

Uncaught exception 'Cassandra\Exception\RuntimeException' with message 'No hosts available for connection using the current load balancing policy'

We simplify our test with a very basic config which works if we comment the withWhiteListHosts line but fails with it :

$cluster = Cassandra::cluster()
->withContactPoints('xpdbtest01b')
->withCredentials("cassandra", "cassandra")
->withWhiteListHosts('xpdbtest01b')
->build();

our config :
- PHP 5.6
- cassandra-cpp-driver-2.7.1-1.el7.centos.x86_64
- cassandra php driver 1.3.2
- cassandra 3.11.1

Thx in advance for help.

Michael Fero

unread,
Jan 19, 2018, 5:54:32 AM1/19/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
It appears that hostname resolution may be disabled on your build; can you confirm that you are not receiving the following error: `The underlying C/C++ driver does not implement hostname resolution it will be disabled`. This issue (PHP-163) is caused by using an older libuv that does not support hostname resolution (v0.10.x). Based on the config information you provided it appears you downloaded the drivers from the downloads.datastax.com website which also mean you probably downloaded the libuv v1.16.1 from the CentOS 7 dependencies folder too. If that is the case then some additional investigation/testing may be needed to ensure whitelist policy is working correctly with hostnames. Can you also confirm the version of libuv that is installed on your system?

Thank you.

~Fero

regis le bretonnic

unread,
Jan 19, 2018, 6:33:28 AM1/19/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
Humm... It seems I have the right libuv...

# rpm -qa| grep libuv
libuv-devel-1.16.1-1.el7.centos.x86_64
libuv-1.16.1-1.el7.centos.x86_64

I didn't compile the C++ driver but I downloaded it from datastax.
# wget http://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.7.1/cassandra-cpp-driver-2.7.1-1.el7.centos.x86_64.rpm

But you raise a very interesting thing and I just make a test with IP instead of hostname and it seems to work.

I will do some more tests, and I will try to compile C++ driver by myself to check options.

I keep you in touch...
Thx a lot Michael

Michael Penick

unread,
Jan 19, 2018, 8:31:51 AM1/19/18
to php-dri...@lists.datastax.com
I'm pretty sure that the whitelist/blacklist policies does not work with hostnames.

Mike


--
You received this message because you are subscribed to the Google Groups "DataStax PHP Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-driver-user+unsubscribe@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages