ActiveMQ Artemis HA & users/roles - 我应该在每个节点上分别创建 user/role 吗?
ActiveMQ Artemis HA & users/roles - am I supposed to create user/role on each node separately?
我有 ActiveMQ Artemis 集群(2 个节点)和主动备份 HA(共享存储模式),2.17.0。
共享存储使用 NFS 设置,安装在 $ARTEMIS_INSTANCE/data
上。在 broker.xml
中,我指定了以下设置 - 非常标准:
<paging-directory>data/paging</paging-directory>
<bindings-directory>data/bindings</bindings-directory>
<journal-directory>data/journal</journal-directory>
<large-messages-directory>data/large-messages</large-messages-directory>
根据这个 official documentation page,在 etc
目录中有 login.conf
文件指定用户和角色文件。我有以下内容:
activemq {
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule required
debug=false
reload=true
org.apache.activemq.jaas.properties.user="artemis-users.properties"
org.apache.activemq.jaas.properties.role="artemis-roles.properties";
};
好吧,一切似乎都很好,但我注意到每次我想创建一个新的 user/role,我都必须创建两次,分别在每个节点中创建。如果我有复制 HA 模式和 6 个节点,我需要创建相同的 user/role 6 次(对于每个节点)。
我这里没有遗漏什么吗?
然后我想出了一个想法,将 artemis-users.properties
和 artemis-roles.properties
移动到 $ARTEMIS_INSTANCE/data
目录并相应地修改 login.conf
文件,这样我就可以创建user/role 仅一次,创建的条目可以从其他节点访问:
activemq {
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule required
debug=false
reload=true
org.apache.activemq.jaas.properties.user="../data/artemis-users.properties"
org.apache.activemq.jaas.properties.role="../data/artemis-roles.properties";
};
因为这是共享商店,所以我以这种方式存储有点有意义。我做了很多测试,一切似乎都很好,我认为这样不会有任何竞争条件。
再说一遍,我是不是漏掉了什么?任何 suggestions/better 解决方法?
默认提供PropertiesLoginModule
,因为它为基本用例配置简单直接。但是,它并不是真正为跨集群的生产用途而设计的。通常,您会使用 LDAP 服务器(或某些等效服务器),它是所有用户和角色数据的中央存储。正如 the documentation 所述:
In general, using properties files and broker-centric user management for anything other than very basic use-cases is not recommended. The broker is designed to deal with messages. It's not in the business of managing users, although that functionality is provided at a limited level for convenience. LDAP is recommended for enterprise level production use-cases.
当然,您可以在更复杂的用例(例如您的用例)中自由使用 PropertiesLoginModule
。我认为将属性文件放在共享存储上很好,不太可能导致问题。
我有 ActiveMQ Artemis 集群(2 个节点)和主动备份 HA(共享存储模式),2.17.0。
共享存储使用 NFS 设置,安装在 $ARTEMIS_INSTANCE/data
上。在 broker.xml
中,我指定了以下设置 - 非常标准:
<paging-directory>data/paging</paging-directory>
<bindings-directory>data/bindings</bindings-directory>
<journal-directory>data/journal</journal-directory>
<large-messages-directory>data/large-messages</large-messages-directory>
根据这个 official documentation page,在 etc
目录中有 login.conf
文件指定用户和角色文件。我有以下内容:
activemq {
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule required
debug=false
reload=true
org.apache.activemq.jaas.properties.user="artemis-users.properties"
org.apache.activemq.jaas.properties.role="artemis-roles.properties";
};
好吧,一切似乎都很好,但我注意到每次我想创建一个新的 user/role,我都必须创建两次,分别在每个节点中创建。如果我有复制 HA 模式和 6 个节点,我需要创建相同的 user/role 6 次(对于每个节点)。
我这里没有遗漏什么吗?
然后我想出了一个想法,将 artemis-users.properties
和 artemis-roles.properties
移动到 $ARTEMIS_INSTANCE/data
目录并相应地修改 login.conf
文件,这样我就可以创建user/role 仅一次,创建的条目可以从其他节点访问:
activemq {
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule required
debug=false
reload=true
org.apache.activemq.jaas.properties.user="../data/artemis-users.properties"
org.apache.activemq.jaas.properties.role="../data/artemis-roles.properties";
};
因为这是共享商店,所以我以这种方式存储有点有意义。我做了很多测试,一切似乎都很好,我认为这样不会有任何竞争条件。
再说一遍,我是不是漏掉了什么?任何 suggestions/better 解决方法?
默认提供PropertiesLoginModule
,因为它为基本用例配置简单直接。但是,它并不是真正为跨集群的生产用途而设计的。通常,您会使用 LDAP 服务器(或某些等效服务器),它是所有用户和角色数据的中央存储。正如 the documentation 所述:
In general, using properties files and broker-centric user management for anything other than very basic use-cases is not recommended. The broker is designed to deal with messages. It's not in the business of managing users, although that functionality is provided at a limited level for convenience. LDAP is recommended for enterprise level production use-cases.
当然,您可以在更复杂的用例(例如您的用例)中自由使用 PropertiesLoginModule
。我认为将属性文件放在共享存储上很好,不太可能导致问题。