简体   繁体   中英

Can username and password be passed in connection url for cassandra

I want to ask if we can pass username and password in database connection url Example:

jdbc:cassandra:keyspace=keyspace1;host=host;port=port;user=user;password=password;

I'm using cdata drivers for apache cassandra. And if yes, how can i create a user with password whom I'll via the connection url? And no, the documentation on datastax is not helping me out.

In short, yes. Set the AuthScheme Connection property to 'Basic' and set the User and Password connection properties, in addition to the other necessary properties:

jdbc:cassandra:AuthSchem=BASIC;User=<username>;Password=<password>;...

@Aaron offers the solution for creating the first user: How do you create the first user in Cassandra DB

From the online CData JDBC Driver for Cassandra help :

The driver supports Basic authentication with login credentials and the additional authentication features of DataStax Enterprise (DSE) Cassandra. The following sections detail connection properties your authentication method may require.

You need to set AuthScheme to the value corresponding to the authenticator configured for your system. You specify the authenticator in the authenticator property in the cassandra.yaml file. This file is typically found in /etc/dse/cassandra . or through the DSE Unified Authenticator on DSE Cassandra.

Basic Authentication

Basic authentication is supported through Cassandra's built-in default PasswordAuthenticator.

  • Set the AuthScheme property to 'BASIC' and set the User and Password properties.
  • In the cassandra.yaml file, set the authenticator property to 'PasswordAuthenticator'.

Kerberos Authentication

Kerberos authentication is supported through DataStax Enterprise Unified Authentication.

  • Set the AuthScheme property to 'KERBEROS' and set the User and Password properties.
  • Set the KerberosKDC, KerberosRealm, and KerberosSPN properties.
  • In the cassandra.yaml file, set the authenticator property to "com.datastax.bdp.cassandra.auth.DseAuthenticator".
  • Modify the authentication_options section in the dse.yaml file, specifying the default_schema and other_schemas properties as 'kerberos'.
  • Modify the kerberos_options section in the dse.yaml file, specifying the keytab, service_principle, http_principle and qop properties

LDAP Authentication

LDAP authentication is supported through DataStax Enterprise Unified Authentication.

  • Set the AuthScheme property to 'LDAP' and set the User and Password properties.
  • In the cassandra.yaml file, set the authenticator property to "com.datastax.bdp.cassandra.auth.DseAuthenticator".
  • Modify the authentication_options section in the dse.yaml file, specifying the default_schema and other_schemas properties as 'ldap'.
  • Modify the ldap_options section in the dse.yaml file, specifying the server_host, server_port, search_dn, search_password, user_search_base, and user_search_filter properties

Using PKI

You can specify a client certificate to authenticate the driver with SSLClientCert , SSLClientCertType , SSLClientCertSubject , and SSLClientCertPassword .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM