0

I am running a Java app with DataStax Java driver version 3.3.0 and I am trying to change Cassandra user and password at runtime. According to this issue by calling setUser and setPassword in this object it should reuse it for future calls to the DB, so I did in my code something like

PlainTextAuthProvider authProvider = (PlainTextAuthProvider) cluster.getConfiguration().getProtocolOptions().getAuthProvider();

authProvider.setUsername(user);
authProvider.setPassword(pwd);

But even after this change I find that it still use the user/pass I set on startup.

This docu indicates that in versions > 4.x you can force a config reload at runtime.

So my question is, Is there a way to force all new calls to Cassandra start using the new User and Pass provided via PlainTextAuthProvider in version 3.x ?

Extra: I am doing this to try to rotate Vault passwords when they expire and update the driver accordingly. Something like what is described in this post for relational DB accessed by Spring Boot but on Cassandra

jesantana
  • 1,241
  • 2
  • 14
  • 27

1 Answers1

0

The question was also asked on https://community.datastax.com/questions/11846/ and I'm reposting my response here:

I'm not familiar with this API but I think the credentials are used just for new connections initiated after the credentials are set. I suspect it doesn't apply to existing connections which continue to use the old credentials.

I'm going to reach out to the Driver devs here at DataStax and will either get them to respond directly or I will update my answer. Cheers!

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23