首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有已知类型为cassandra -AWS键空间的物理数据库

没有已知类型为cassandra -AWS键空间的物理数据库
EN

Stack Overflow用户
提问于 2022-06-15 04:04:35
回答 1查看 35关注 0票数 0

我们正在通过dbaas将我们的微服务连接到aws关键空间(Cassandra)。

代码语言:javascript
复制
Getting error
cloud.dbaas.client.exceptions.CreateDbException: MicroserviceRestClientResponseException{message=404 Not Found: "No physical database known of type cassandra

甚至从dbaas吊舱日志中得到相同的错误。我已经配置了以下参数

代码语言:javascript
复制
spring.data.cassandra.ssl
spring.data.cassandra.contact-points
spring.data.cassandra.local-datacenter
spring.data.cassandra.port
spring.data.cassandra.password
spring.data.cassandra.username
EN

回答 1

Stack Overflow用户

发布于 2022-06-30 14:12:17

您将希望引用外部配置。请参阅下面的Amazon示例。

https://github.com/aws-samples/amazon-keyspaces-spring-app-example/

代码语言:javascript
复制
@Configuration
public class AppConfig {
    private final String username = System.getenv("AWS_MCS_SPRING_APP_USERNAME");
    private final String password = System.getenv("AWS_MCS_SPRING_APP_PASSWORD");
    File driverConfig = new File(System.getProperty("user.dir")+"/application.conf");

    @Primary
    public @Bean
    CqlSession session() throws NoSuchAlgorithmException {
        return CqlSession.builder().
                withConfigLoader(DriverConfigLoader.fromFile(driverConfig)).
                withAuthCredentials(username, password).
                withSslContext(SSLContext.getDefault()).
                withKeyspace("keyspace_name").
                build();
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72625800

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档