【问题标题】:Specify multiple cassandra port in application properties在应用程序属性中指定多个 cassandra 端口
【发布时间】:2021-05-18 12:48:55
【问题描述】:

我有关注application.properties:

spring.data.cassandra.contact-points=localhost
spring.data.cassandra.port=1112

在我们的信息系统中,有 2 个可访问的 ** cassandra 节点** (在我的笔记本电脑上的 localhost:1112localhost:1113 上完成了一次重定向)

我的问题是:我如何在 application.properties 中指定 2 个不同的主机/端口?因为我已经用 spring.data.cassandra.contact-points=localhost:1112,localhost:1113 使用不同的端口,它不起作用

【问题讨论】:

    标签: spring cassandra


    【解决方案1】:

    如spring数据documentation中所述,你试过了吗:

    cassandra.contactpoints=10.1.55.80:9042,10.1.55.81:9042
    cassandra.keyspace=showcase
    

    *您可能仍需要在其前面加上 spring.data

    【讨论】:

    • 它不起作用,因为应用程序属性中不是'cassandra.contactpoints',而是spring.data.cassandra.contact-points 使用它时,我有以下错误:[org/ springframework/boot/autoconfigure/cassandra/Cas​​sandraAutoConfiguration.class]:通过工厂方法进行 Bean 实例化失败;嵌套异常无法实例化 [com.datastax.driver.core.Cluster]:工厂方法“cassandraCluster”抛出异常;嵌套异常是 java.lang.IllegalArgumentException: 无法添加联系点: localhost:1112 java.net.UnknownHostException: localhost:1112: Nom ou service inconnu
    • 您能否提供来自应用程序属性的实际 sn-p?
    • 我添加配置截图
    • 请在此处的评论中添加截图链接,而不是作为我的答案的建议编辑。
    • 堆栈溢出无法采取行动抱歉
    猜你喜欢
    • 2019-05-29
    • 2019-12-18
    • 2016-03-24
    • 1970-01-01
    • 1970-01-01
    • 2017-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多