简体   繁体   English

可以在cassandra的连接URL中传递用户名和密码吗

[英]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: 我想问一下我们是否可以在数据库连接URL中传递用户名和密码。

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

I'm using cdata drivers for apache cassandra. 我正在为Apache Cassandra使用cdata驱动程序。 And if yes, how can i create a user with password whom I'll via the connection url? 如果是的话,我该如何创建一个使用连接URL的密码的用户? And no, the documentation on datastax is not helping me out. 不,关于datastax的文档没有帮助我。

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: 除其他必要属性外,将AuthScheme连接属性设置为“基本”,并设置用户密码连接属性:

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 @Aaron提供了用于创建第一个用户的解决方案: 如何在Cassandra DB中创建第一个用户

From the online CData JDBC Driver for Cassandra help : Cassandra在线CData JDBC驱动程序帮助

The driver supports Basic authentication with login credentials and the additional authentication features of DataStax Enterprise (DSE) Cassandra. 该驱动程序支持带有登录凭据的基本身份验证以及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. 您需要将AuthScheme设置为与为系统配置的身份验证器相对应的值。 You specify the authenticator in the authenticator property in the cassandra.yaml file. 您可以在cassandra.yaml文件的authenticator属性中指定身份验证器。 This file is typically found in /etc/dse/cassandra . 该文件通常位于/etc/dse/cassandra or through the DSE Unified Authenticator on DSE Cassandra. 或通过DSE Cassandra上的DSE统一身份验证器。

Basic Authentication 基本认证

Basic authentication is supported through Cassandra's built-in default PasswordAuthenticator. 通过Cassandra的内置默认PasswordAuthenticator支持基本身份验证。

  • Set the AuthScheme property to 'BASIC' and set the User and Password properties. 将AuthScheme属性设置为'BASIC'并设置用户密码属性。
  • In the cassandra.yaml file, set the authenticator property to 'PasswordAuthenticator'. 在cassandra.yaml文件中,将authenticator属性设置为'PasswordAuthenticator'。

Kerberos Authentication Kerberos身份验证

Kerberos authentication is supported through DataStax Enterprise Unified Authentication. 通过DataStax Enterprise统一身份验证支持Kerberos身份验证。

  • Set the AuthScheme property to 'KERBEROS' and set the User and Password properties. AuthScheme属性设置为'KERBEROS'并设置用户密码属性。
  • Set the KerberosKDC, KerberosRealm, and KerberosSPN properties. 设置KerberosKDC,KerberosRealm和KerberosSPN属性。
  • In the cassandra.yaml file, set the authenticator property to "com.datastax.bdp.cassandra.auth.DseAuthenticator". 在cassandra.yaml文件中,将Authenticator属性设置为“ 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'. 修改dse.yaml文件中的authentication_options部分,将default_schema和other_schemas属性指定为“ kerberos”。
  • Modify the kerberos_options section in the dse.yaml file, specifying the keytab, service_principle, http_principle and qop properties 修改dse.yaml文件中的kerberos_options部分,并指定keytab,service_principle,http_principle和qop属性

LDAP Authentication LDAP验证

LDAP authentication is supported through DataStax Enterprise Unified Authentication. 通过DataStax Enterprise统一身份验证支持LDAP身份验证。

  • Set the AuthScheme property to 'LDAP' and set the User and Password properties. AuthScheme属性设置为'LDAP'并设置用户和密码属性。
  • In the cassandra.yaml file, set the authenticator property to "com.datastax.bdp.cassandra.auth.DseAuthenticator". 在cassandra.yaml文件中,将Authenticator属性设置为“ 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'. 修改dse.yaml文件中的authentication_options部分,将default_schema和other_schemas属性指定为'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 修改dse.yaml文件中的ldap_options部分,并指定server_host,server_port,search_dn,search_password,user_search_base和user_search_filter属性

Using PKI 使用PKI

You can specify a client certificate to authenticate the driver with SSLClientCert , SSLClientCertType , SSLClientCertSubject , and SSLClientCertPassword . 您可以指定客户端证书,以使用SSLClientCertSSLClientCertTypeSSLClientCertSubjectSSLClientCertPassword验证驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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