在 AEM 6 中配置节点存储与数据存储 configuring-node-stores-and-data-stores-in-aem
简介 introduction
在Adobe Experience Manager (AEM)中,二进制数据可以独立于内容节点进行存储。 二进制数据存储在数据存储中,而内容节点存储在节点存储中。
数据存储和节点存储都可以使用OSGi配置进行配置。 每个OSGi配置都使用永久性标识符(PID)引用。
配置步骤 configuration-steps
要配置节点存储和数据存储,请执行以下步骤:
-
将AEM快速入门JAR文件复制到其安装目录。
-
在安装目录中创建文件夹
crx-quickstart/install。 -
首先,通过创建一个配置文件来配置节点存储,该配置文件具有您要在
crx-quickstart/install目录中使用的节点存储选项的名称。例如,Document节点存储(AEM的MongoMK实现的基础)使用文件
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.config。 -
编辑文件,并设置配置选项。
-
创建配置文件,该文件应具有您要使用的数据存储的PID。 编辑文件以设置配置选项。
note note NOTE 有关配置选项,请参阅节点存储配置和数据存储配置。 -
启动AEM。
节点存储配置 node-store-configurations
crx-quickstart/install文件夹。 升级后,将文件夹的内容还原到已升级的安装,并将配置文件的扩展名从**.cfg**修改为**.config**。区段节点存储 segment-node-store
区段节点存储是Adobe在AEM6中实施TarMK的基础。 它使用org.apache.jackrabbit.oak.segment.SegmentNodeStoreService PID进行配置。
org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService in previous versions更改为AEM 6.3中的org.apache.jackrabbit.oak.segment.SegmentNodeStoreService。 确保进行必要的配置调整以反映此更改。您可以配置以下选项:
-
repository.home:存储存储库相关数据的存储库主目录的路径。 默认情况下,区段文件存储在crx-quickstart/segmentstore目录下。 -
tarmk.size:区段的最大大小(以MB为单位)。 默认最大为256MB。 -
customBlobStore:布尔值,指示使用了自定义数据存储。 AEM 6.3及更高版本的默认值为true。 在AEM 6.3之前,默认为false。
以下是示例org.apache.jackrabbit.oak.segment.SegmentNodeStoreService.config文件:
#Path to repo
repository.home="crx-quickstart/repository"
#Max segment size
tarmk.size=I"256"
#Custom data store
customBlobStore=B"true"
文档节点存储 document-node-store
文档节点存储是AEM实施MongoMK的基础。 它使用org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService* *PID。 可以使用以下配置选项:
-
mongouri:连接到Mongo数据库所需的MongoURI。 默认值为mongodb://localhost:27017 -
db: Mongo数据库的名称。 默认数据库名称为Oak. However, new AEM 6 installations use **aem-author**。 -
cache:缓存大小(MB)。 它分布在DocumentNodeStore中使用的各种缓存中。 默认值为256 -
changesSize: Mongo中用于缓存差异输出的上限集合的大小(以MB为单位)。 默认值为256 -
customBlobStore:布尔值,指示使用了自定义数据存储。 默认为false。
以下是示例org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.config文件:
#Mongo server details
mongouri="mongodb://localhost:27017"
#Name of Mongo database to use
db="aem-author"
#Store binaries in custom BlobStore
customBlobStore=B"false"
数据存储配置 data-store-configurations
在处理大量二进制文件时,建议使用外部数据存储而不是默认节点存储,以最大限度地提高性能。
例如,如果您的项目需要许多媒体资产,将它们存储在File或S3 Data Store下时,访问它们的速度会比直接存储在MongoDB中更快。
文件数据存储提供了比MongoDB更好的性能,而且对于大量资产,Mongo备份和恢复操作速度也会比较慢。
有关不同数据存储和配置的详细信息如下所述。
文件数据存储 file-data-store
这是Jackrabbit 2中存在的FileDataStore的实现。 它提供了一种将二进制数据作为普通文件存储在文件系统中的方法。 它使用org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore PID。
可以使用以下配置选项:
-
repository.home: Path to repository home under which various repository related data is stored. By default, binary files would be stored undercrx-quickstart/repository/datastoredirectory -
path: Path to the directory under which the files would be stored. If specified then it takes precedence overrepository.homevalue -
minRecordLength: The minimum size in bytes of a file stored in the data store. Binary content less than this value would be inlined.
Amazon S3 Data Store amazon-s-data-store
AEM can be configured to store data in Amazon's Simple Storage Service (S3). 它使用org.apache.jackrabbit.oak.plugins.blob.datastore.S3DataStore.config PID进行配置。
To enable the S3 data store functionality, a feature pack containing the S3 Datastore Connector must be downloaded and installed. Go to the Adobe Repository and download the latest version from the 1.10.x versions of the feature pack (for example, com.adobe.granite.oak.s3connector-1.10.0.zip). Also, you must download and install the latest AEM service pack as listed on the AEM 6.5 Release Notes page.
FileDataStore. To use TarMK with the S3 Datastore, you must start AEM using the crx3tar-nofds runmode, for example:java -jar <aem-jar-file>.jar -r crx3tar-nofds
Once downloaded, you can install and configure the S3 Connector as follows:
-
Extract the contents of the feature pack zip file to a temporary folder.
-
Go to the temporary folder and navigate to the following location:
code language-xml jcr_root/libs/system/installCopy all the contents from the above location to
<aem-install>/crx-quickstart/install. -
If AEM is already configured to work with the Tar or MongoDB storage, remove any existing configuration files from the <aem-install>/crx-quickstart/install folder before proceeding. The files that must be removed are:
For MongoMK: org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.configFor TarMK: org.apache.jackrabbit.oak.segment.SegmentNodeStoreService.config
-
Return to the temporary location where the feature pack has been extracted, and copy the contents of the following folder:
jcr_root/libs/system/config
到
<aem-install>/crx-quickstart/install
Make sure you only copy the configuration files needed by your current configuration. For both a dedicated data store and a shared data store setup copy the
org.apache.jackrabbit.oak.plugins.blob.datastore.S3DataStore.configfile.note note NOTE 在群集设置中,对群集的所有节点逐个执行上述步骤。 此外,请确保对所有节点使用相同的S3设置。 -
编辑文件并添加安装程序所需的配置选项。
-
启动AEM。
升级到1.10.x S3连接器的新版本 upgrading-to-a-new-version-of-the-s-connector
要升级到新版本的1.10.x S3连接器(例如,从1.10.0升级到1.10.4),请执行以下步骤:
-
停止 AEM 实例。
-
导航到AEM安装文件夹中的
<aem-install>/crx-quickstart/install/15,并备份其内容。 -
备份后,通过删除
<aem-install>/crx-quickstart/install/15文件夹中的所有jar文件来删除S3 Connector的旧版本及其依赖项,例如:- oak-blob-cloud-1.6.1.jar
- aws-java-sdk-osgi-1.10.76.jar
note note NOTE 上述文件名仅用于说明目的。 -
从Adobe存储库下载1.10.x功能包的最新版本。
-
将内容解压缩到单独的文件夹,然后导航到
jcr_root/libs/system/install/15。 -
将jar文件复制到AEM安装文件夹中的<aem-install>/crx-quickstart/install/15。
-
启动AEM并检查连接器功能。
您可以使用配置文件以及下面详述的选项。
S3连接器配置文件选项 s3-connector-configuration-file-options
crx-quickstart/repository/datastorecacheSize的百分比。数据存储缓存 data-store-caching
S3DataStore、CachingFileDataStore和AzureDataStore的DataStore实现支持本地文件系统缓存。 当DataStore位于NFS (网络文件系统)上时,CachingFileDataStore实现非常有用。从旧版缓存实施(Oak 1.6以前的版本)升级时,本地文件系统缓存目录的结构存在差异。 在旧的缓存结构中,下载的文件和上传的文件都直接放在缓存路径下。 新结构将下载和上传分开,并将其存储在缓存路径下名为upload和download的两个目录中。 升级过程应是无缝的,应安排任何挂起的上传进行上传,并且在初始化时将之前下载到缓存中的任何文件放入缓存中。
您还可以使用oak-run的datastorecacheupgrade命令脱机升级缓存。 有关如何执行命令的详细信息,请查看oak-run模块的readme。
缓存具有大小限制,可以使用cacheSize参数进行配置。
下载 downloads
在从DataStore访问请求文件/blob之前,将检查本地缓存以查找其记录。 在将文件添加到缓存时,如果缓存超出配置的限制(请参阅cacheSize参数),则将收回某些文件以回收空间。
异步上传 async-upload
缓存支持将数据异步上传到DataStore。 文件将存放在本地、缓存(在文件系统上)中,并且异步作业将开始上载文件。 异步上传的数量受临时缓存大小的限制。 临时缓存的大小通过使用stagingSplitPercentage参数来配置。 此参数定义用于临时缓存的缓存大小百分比。 此外,可用于下载的缓存的百分比计算为(100 - stagingSplitPercentage) *cacheSize。
异步上传是多线程的,线程数是使用uploadThreads参数配置的。
上传完成后,文件将移至主下载缓存。 当暂存缓存大小超过其限制时,文件将同步上传到DataStore,直到上一次异步上传完成并且暂存缓存中再次有可用空间为止。 通过周期性作业(其间隔由stagingPurgeInterval参数配置),将上载的文件从临时区域删除。
失败的上传(例如,由于网络中断)将被置于重试队列中,并定期重试。 使用stagingRetryInterval parameter配置重试间隔。
使用Amazon S3配置无二进制复制 configuring-binaryless-replication-with-amazon-s
要使用S3配置无二进制复制,需要执行以下步骤:
-
安装创作实例和发布实例,并确保它们已正确启动。
-
通过打开 https://localhost:4502/etc/replication/agents.author/publish.html 的页面,转到复制代理设置。
-
按 设置 部分中的 编辑 按钮。
-
将 序列化 类型选项更改为无二进制文件。
-
在传输URI中添加参数“
binaryless=true”。 进行更改后,URI应当类似于以下内容:https://localhost:4503/bin/receive?sling:authRequestLogin=1&binaryless=true
-
重新启动所有创作和发布实例,以使更改生效。
使用S3和MongoDB创建群集 creating-a-cluster-using-s-and-mongodb
-
使用以下命令解压缩CQ快速启动:
java -jar cq-quickstart.jar -unpack -
解压缩AEM后,在安装目录crx-quickstart/install中创建文件夹。
-
在
crx-quickstart文件夹中创建这两个文件:-
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.config
-
org.apache.jackrabbit.oak.plugins.blob.datastore.S3DataStore.config
创建文件后,根据需要添加配置选项。
-
-
按照上面的说明,安装S3数据存储所需的两个捆绑包。
-
确保已安装MongoDB并且
mongod的实例正在运行。 -
使用以下命令启动AEM:
java -Xmx1024m -jar cq-quickstart.jar -r crx3,crx3mongo -
对第二个AEM实例重复步骤1至4。
-
启动第二个AEM实例。
配置共享数据存储 configuring-a-shared-data-store
-
首先,在共享数据存储所需的每个实例上创建数据存储配置文件:
-
如果您使用的是
FileDataStore,请创建一个名为org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore.config的文件并将其放在<aem-install>/crx-quickstart/install文件夹中。 -
如果使用S3作为数据存储,则在
<aem-install>/crx-quickstart/install文件夹中创建名为rg.apache.jackrabbit.oak.plugins.blob.datastore.S3DataStore.config的文件,如上所述。
-
-
修改每个实例上的数据存储配置文件,使其指向相同的数据存储。 有关详细信息,请参阅数据存储配置。
-
如果实例是从现有服务器克隆的,则必须在存储库脱机时使用最新的oak-run工具删除新实例的
clusterId。 必须运行的命令是:code language-xml java -jar oak-run.jar resetclusterid < repository path | Mongo URI >note note NOTE 如果配置了区段节点存储,则必须指定存储库路径。 默认情况下,路径为 <aem-install-folder>/crx-quickstart/repository/segmentstore.如果配置了文档节点存储,则可以使用Mongo连接字符串URI。note note NOTE 可以从以下位置下载Oak-run工具: https://mvnrepository.com/artifact/org.apache.jackrabbit/oak-run/ 根据您在安装AEM时使用的Oak版本,必须使用该工具的不同版本。 Check the version requirements list below before using the tool: code language-none * For Oak versions **1.2.x** use the Oak-run **1.2.12 or newer** * For Oak versions **newer than the above**, use the version of Oak-run that matches the Oak core of your AEM installation. -
Lastly, validate the configuration. To validate, look for a unique file added to the data store by each repository that is sharing it. The format of the files is
repository-[UUID], where the UUID is a unique identifier of each individual repository.Therefore, a proper configuration should have as many unique files as there are repositories sharing the data store.
The files are stored differently, depending on the data store:
- For the
FileDataStorethe files are created under the root path of the data store folder. - For the
S3DataStorethe files are created in the configured S3 bucket under theMETAfolder.
- For the
Azure 数据存储 azure-data-store
AEM can be configured to store data in Microsoft®'s Azure storage service. 它使用org.apache.jackrabbit.oak.plugins.blob.datastore.AzureDataStore.config PID进行配置。
To enable the Azure data store functionality, a feature pack containing the Azure Connector must be downloaded and installed. Go to the Adobe Repository and download the latest version from the 1.6.x versions of the feature pack (for example, com.adobe.granite.oak.azureblobconnector-1.6.3.zip).
crx3tar-nofds runmode, for example:java -jar <aem-jar-file>.jar -r crx3tar-nofds
Once downloaded, you can install and configure the Azure connector as follows:
-
Extract the contents of the feature pack zip file to a temporary folder.
-
Go to the temporary folder and copy the contents of
jcr_root/libs/system/installto the<aem-install>crx-quickstart/installfolder. -
If AEM is already configured to work with the Tar or MongoDB storage, remove any existing configuration files from the
/crx-quickstart/installfolder before proceeding. The files that must be removed are:ForMongoMK:
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.configFor TarMK:
org.apache.jackrabbit.oak.segment.SegmentNodeStoreService.config -
Return to the temporary location where the feature pack has been extracted and copy the contents of
jcr_root/libs/system/configto the<aem-install>/crx-quickstart/installfolder. -
Edit the configuration file and add the configuration options required by your setup.
-
启动AEM。
配置文件具有以下选项:
-
azureSas=":在连接器的1.6.3版本中,添加了Azure共享访问签名(SAS)支持。 如果配置文件中同时存在SAS和存储凭据,则SAS具有优先级。 有关SAS的详细信息,请参阅官方文档。 确保“=”字符像“=”一样转义。
-
azureBlobEndpoint="": Azure Blob端点。 例如,https://<storage-account>.blob.core.windows.net。
-
accessKey="":存储帐户名称。 有关® Azure身份验证凭据的更多详细信息,请参阅官方文档。
-
secretKey="":存储访问密钥。 确保“=”字符像“=”一样转义。
-
container="": ® Azure Blob存储容器名称。 容器是一组Blob。 有关其他详细信息,请阅读官方文档。
-
maxConnections=":每个操作的并发请求数。 默认值为 1。
-
maxErrorRetry="":每个请求的重试次数。 默认值为 3。
-
socketTimeout="":用于请求的超时间隔(以毫秒为单位)。 默认值为5分钟。
除了上述设置之外,还可以配置以下设置:
- path:数据存储的路径。 默认值为
<aem-install>/repository/datastore. - RecordLength:应存储在数据存储中的对象的最小大小。 默认值为16 KB。
- maxCachedBinarySize:大小小于或等于此大小的二进制文件存储在内存缓存中。 大小以字节为单位。 默认值为17408 (17 KB)。
- cacheSize:高速缓存的大小。 该值以字节为单位指定。 默认值为64 GB。
- 密钥:仅在为共享数据存储设置使用无二进制复制时使用。
- stagingSplitPercentage:配置为用于暂存异步上载的缓存大小的百分比。 默认值为 10。
- uploadThreads:用于异步上传的上传线程数。 默认值为 10。
- stagingPurgeInterval:从暂存缓存中清除已完成上载的时间间隔(以秒为单位)。 默认值为300秒(5分钟)。
- stagingRetryInterval:失败上载的重试间隔(以秒为单位)。 默认值为600秒(10分钟)。
accessKey="ASDASDERFAERAER"
secretKey="28932hfjlkwdo8fufsdfas\=\="
数据存储垃圾收集 data-store-garbage-collection
数据存储垃圾收集过程用于删除数据存储中的任何未使用文件,从而在该过程中释放宝贵的磁盘空间。
您可以通过以下方式运行数据存储垃圾收集:
-
转到 https://<serveraddress:port/system/console/jmx 处的JMX控制台
-
正在搜索RepositoryManagement。 找到存储库管理器MBean后,单击它可显示可用选项。
-
滚动到页面末尾,然后单击 startDataStoreGC(boolean markOnly) 链接。
-
在以下对话框中,输入
markOnly参数的false,然后单击调用:
note note NOTE markOnly参数表示垃圾回收的扫描阶段是否运行。
共享数据存储的数据存储垃圾收集 data-store-garbage-collection-for-a-shared-data-store
- 停止AEM实例。
- 在
crx-quickstart/install/org.apache.jackrabbit.oak.segment.SegmentNodeStoreService.config文件中添加blobTrackSnapshotIntervalInSecs=L"0"参数。 此参数需要Oak 1.12.0、1.10.2或更高版本。 - 重新启动AEM实例。
使用较新版本的AEM,数据存储垃圾收集还可以在多个存储库共享的数据存储上运行。 要在共享数据存储上运行数据存储垃圾收集,请执行以下步骤:
-
确保在共享数据存储的所有存储库实例上禁用为数据存储垃圾收集配置的任何维护任务。
-
对共享数据存储的 所有 存储库实例分别运行二进制垃圾回收中提到的步骤。 但是,请确保在单击“调用”按钮之前为
markOnly参数输入true:
-
在所有实例上完成上述过程后,从 任意 个实例中再次运行数据存储垃圾收集:
- 转到JMX控制台,然后选择Repository Manager Mbean。
- 单击 Click startDataStoreGC(boolean markOnly) 链接。
- 在下面的对话框中,再次输入
markOnly参数的false。
使用之前使用的标记阶段整理找到的所有文件,并从数据存储中删除未使用的其余文件。