以下是我从其他来源找到的内容,以防它对某人有所帮助:
关于门户属性,首先要记住的最重要的事情之一是它们总是被 Liferay 控制面板中的任何设置覆盖。原因是在控制面板中完成的任何配置都直接保存到数据库中,并且在导入门户属性后始终读取数据库中设置的配置,从而覆盖它们。一旦在控制面板中完成配置,该设置就不能再被门户属性修改或更改。
这确实让人想知道为什么有两个地方可以进行设置配置更改以及为什么控制面板每次都胜过门户属性文件。这样做的原因与您关于全局和范围设置的第一个问题直接相关。
portal-ext.properties 文件通常用于设置 Liferay 物理包的配置;该物理捆绑包上的每个 Liferay 实例都将继承这些设置,但这些设置不会被同一实例的任何其他 Liferay 节点或捆绑包自动继承。
控制面板通常用于设置 Liferay 门户实例的配置;连接到该实例的每个节点都将继承这些设置并覆盖门户属性中设置的任何值,但这些设置只会被连接到同一实例的其他节点继承。
换句话说...
- 控制面板设置用于 Liferay 实例。
- 门户属性设置用于 Liferay 捆绑包
- 控制面板设置将始终覆盖门户属性设置
这确实允许对如何设置包或节点的默认属性以及保存整个实例的配置进行一些控制。例如,您需要使用门户属性来配置集群设置、数据库连接设置、文档库连接以及其他性能/系统设置。
但是,您也可以选择在哪里配置设置,例如邮件服务器。如果您在门户属性中设置它,该节点上的每个 Liferay 实例将自动具有这些设置,这可能不是您所希望的,具体取决于您的目标。如果您在控制面板中设置它,那么连接到该实例的 Liferay 节点将自动获取这些设置,但门户属性不会再次修改这些设置。
现在,有一种方法可以创建一个特定于实例的门户属性文件,该文件的值只能由 Liferay 的该实例读取。请注意,这确实会使事情变得更加复杂,并且可能不符合您的目标。以下属性及其定义说明了如何完成此操作:
#
# Each portal instance can have its own overriden property file following
# the convention portal-companyWebId.properties. To enable this feature, set
# the "company-id-properties" system property to true.
#
# To enable:
#
# java ... -Dcompany-id-properties=true
#
# The read order will now be: portal.properties, then portal-ext.properties,
# and then portal-liferay.com.properties.
#
# Note that not all properties can have different values per company. This
# functionality is only available for legacy reasons. The preferred way to
# configure a portal instance is through the Control Panel.
#
include-and-override=portal-${easyconf:companyId}.properties
include-and-override=${liferay.home}/portal-${easyconf:companyId}.properties
您可以选择在哪里配置门户设置,并且根据上述知识,我相信您将能够为您的目标做出最佳决定。
关于分片,分片默认禁用,必须通过门户属性以及数据库本身手动配置。这是一篇稍早的 wiki 文章,关于如何在 Liferay 中启用数据库分片支持,https://www.liferay.com/community/wiki/-/wiki/Main/Database+Sharding。作为参考,以下是一些需要更改的属性:
##
## 分片数据库
##
#
# Set the database that is to be used for the default company and globally
# used tables in a sharded environment.
#
shard.default.name=default
#
# Specify an algorithm for selecting a new shard on portal instance
# creation. Use ManualShardSelector for shard selection via the web
# interface.
#
shard.selector=com.liferay.portal.dao.shard.RoundRobinShardSelector
#shard.selector=com.liferay.portal.dao.shard.ManualShardSelector
##
## Spring
##
#
# Input a list of comma delimited Spring configurations. These will be
# loaded after the bean definitions specified in the contextConfigLocation
# parameter in web.xml.
#
# Note that there is a special case for hibernate-spring.xml and
# jpa-spring.xml. Even though both files are specified, only one will
# actually load at runtime based on the property "persistence.provider".
#
spring.configs=\
META-INF/base-spring.xml,\
\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
\
META-INF/util-spring.xml,\
\
META-INF/jpa-spring.xml,\
\
META-INF/executor-spring.xml,\
\
META-INF/audit-spring.xml,\
META-INF/cluster-spring.xml,\
META-INF/editor-spring.xml,\
META-INF/jcr-spring.xml,\
META-INF/ldap-spring.xml,\
META-INF/messaging-core-spring.xml,\
META-INF/messaging-misc-spring.xml,\
META-INF/mobile-device-spring.xml,\
META-INF/notifications-spring.xml,\
META-INF/poller-spring.xml,\
META-INF/rules-spring.xml,\
META-INF/scheduler-spring.xml,\
META-INF/search-spring.xml,\
META-INF/workflow-spring.xml,\
\
META-INF/counter-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
META-INF/staging-spring.xml,\
META-INF/virtual-layouts-spring.xml,\
\
META-INF/monitoring-spring.xml,\
\
#META-INF/dynamic-data-source-spring.xml,\
#META-INF/shard-data-source-spring.xml,\
#META-INF/memcached-spring.xml,\
\
classpath*:META-INF/ext-spring.xml
如果您有兴趣,可以在此处的用户指南https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/liferay-clustering-liferay-portal-6-2-user-guide-20-en 中阅读有关如何实施分片的更多信息。
关于允许的实例数量,没有硬性限制,但请注意,每个实例都将竞争相同数量的资源,并且可能会出现性能下降。这确实使性能调整比正常情况更重要,以避免不良性能。
作为一个仅供参考 - 通过测试,我发现以下用于配置公告 portlet 模板等的属性只能通过 portal-ext.properties 文件而不是通过控制面板来实现。因此,如果实例之间的属性值不同,您将需要一个公司特定的属性文件。
希望这会有所帮助!