在 hazelcast 集群期间 jclouds 连接被拒绝

jclouds connection refused during hazelcast clustering

问题

上下文

设置

我的 hazelcast.xml 配置如下:

        <discovery-strategies>
            <discovery-strategy class="com.hazelcast.jclouds.JCloudsDiscoveryStrategy" enabled="true">
                <properties>
                    <property name="modules">org.jclouds.logging.slf4j.config.SLF4JLoggingModule</property>
                    <property name="provider">openstack-nova</property>
                    <property name="endpoint">http://dev.nova.cloud.youdontknow.net:8774/v2/</property>
                    <property name="identity">redacted</property>
                    <property name="credential">cens0red</property>
                </properties>
            </discovery-strategy>
        </discovery-strategies>

问题

应用程序初始化失败。这是一些日志花絮:

[TRACE] o.j.r.internal.RestAnnotationProcessor   : looking up default endpoint for org.jclouds.openstack.keystone.v2_0.AuthenticationApi.public abstract org.jclouds.openstack.keystone.v2_0.domain.Access org.jclouds.openstack.keystone.v2_0.AuthenticationApi.authenticateWithTenantNameAndCredentials(java.lang.String,org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials)[bnet-web, PasswordCredentials{username=redacted, password=*****}]
[TRACE] o.j.r.internal.RestAnnotationProcessor   : using default endpoint Optional.of(http://localhost:5000/v2.0/) for org.jclouds.openstack.keystone.v2_0.AuthenticationApi.public abstract org.jclouds.openstack.keystone.v2_0.domain.Access org.jclouds.openstack.keystone.v2_0.AuthenticationApi.authenticateWithTenantNameAndCredentials(java.lang.String,org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials)[bnet-web, PasswordCredentials{username=redacted, password=*****}]
[TRACE] o.j.rest.internal.InvokeHttpMethod       : << converted AuthenticationApi.authenticateWithTenantNameAndCredentials to POST http://localhost:5000/v2.0/tokens HTTP/1.1

下面是一些异常堆栈跟踪:

Caused by: com.hazelcast.core.HazelcastException: Failed to get registered addresses
at com.hazelcast.jclouds.JCloudsDiscoveryStrategy.discoverNodes(JCloudsDiscoveryStrategy.java:93)
at com.hazelcast.jclouds.JCloudsDiscoveryStrategy.discoverLocalMetadata(JCloudsDiscoveryStrategy.java:106)
at com.hazelcast.spi.discovery.impl.DefaultDiscoveryService.discoverLocalMetadata(DefaultDiscoveryService.java:91)

...

Caused by: org.jclouds.http.HttpResponseException: Connection refused: connect connecting to POST http://localhost:5000/v2.0/tokens HTTP/1.1
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:122)
    ...
    at com.sun.proxy.$Proxy147.authenticateWithTenantNameAndCredentials(Unknown Source)
    at org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:43)

其他注意事项

看起来它正在使用 org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata 中配置的默认 keystone 地址 - 但我不知道这是怎么回事。

通过查看代码,我认为 hazlecast-jclouds 不准备管理通用 API。当连接到 provider 时,您不需要指定端点,因为它是众所周知的(AWS 端点、Google、Azure 等),但是当使用 OpenStack 等通用 API 时或者 CloudStack,你需要告诉 jclouds 在哪里连接。不幸的是,hazlecast-jclouds 似乎不支持为通用 API 配置自定义端点。

不过,快速浏览一下代码表明它可以很容易地添加。所考虑的属性在 JCloudsDiscoveryStrategyFactory, and then read in the ComputeServiceBuilder to create the jclouds context.

中定义

我不熟悉 Hazlecast,但我会说添加 "endpoint" 属性 的定义,然后,如果存在,通过调用 jclouds [=12] 来配置它=] 方法应该可以解决问题。