首页 > 解决方案 > Hazelcast 实例发现在 azure 应用服务中以嵌入模式运行

问题描述

我有运行在 azure 应用服务中的 hazelcast IMDG 3.11.1 的 Spring Boot 应用,扩展至 4 个实例。

1. build.gradle dependencies

compile 'com.hazelcast:hazelcast-azure:1.2.1'
compile 'com.hazelcast:hazelcast:3.11.1'
compile 'com.hazelcast:hazelcast-spring:3.11.1'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-web'

尝试使用 hazelcast-azure 发现插件
2. hazelcast.xml

<?xml version="1.0" encoding="UTF-8"?>
<hazelcast
  xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.10.xsd"
  xmlns="http://www.hazelcast.com/schema/config"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>${hazelcast.environment.name}</name>
        <password>${hazelcast.environment.password}</password>
    </group>
    <properties>
        <property name="hazelcast.discovery.enabled">true</property>
    </properties>
    <network>
        <port auto-increment="false">5701</port>
        <join>
            <tcp-ip enabled="false" />
            <multicast enabled="false"/>
            <aws enabled="false" />
            <discovery-strategies>
                <!-- class equals to the DiscoveryStrategy not the factory! -->
                <discovery-strategy enabled="true" class="com.hazelcast.azure.AzureDiscoveryStrategy">
                    <properties>
                        <property name="client-id">${platform.azure.client-id}</property>
                        <property name="client-secret">${platform.azure.client-secret}</property>
                        <property name="tenant-id">${platform.azure.client-domain}</property>
                        <property name="subscription-id">${platform.azure.subscription}</property>
                        <property name="cluster-id">${hazelcast.environment.name}</property>
                        <property name="group-name">${hazelcast.environment.name}</property>
                    </properties>
                </discovery-strategy>
            </discovery-strategies>
        </join>
    </network>
...
My Map list
...
</hazelcast>

深入挖掘 azure 插件允许发现专用集群,即 hazelcast 集群的客户端-服务器模式。

是否有任何方法可以为在 azure 应用服务中以嵌入模式运行的 hazelcast 节点启用集群节点发现?

标签: azurespring-boothazelcastazure-web-app-service

解决方案


@Mr.Arjun,不是现在,但我正在为 Hazelcast 创建一个新版本的 Azure Discovery 插件,它使用 Azure REST API 并且也希望添加此功能(适用于 Hazelcast)。您能否在 hazelcast azure github repo 中为此打开一个 github 问题:https ://github.com/hazelcast/hazelcast-azure


推荐阅读