[英]How to store Apache Sling content in MongoDB?
I am new to Java and Apache Sling as well. 我也是Java和Apache Sling的新手。 I've been trying to link Sling with MongoDB and these are what I've done so far: 我一直在尝试将Sling与MongoDB链接,这是我到目前为止所做的:
NoSQL MongoDB Resource Provider
in Sling console: 我在Sling控制台中配置了NoSQL MongoDB Resource Provider
: Oak Document Node Store Service
: 然后, Oak Document Node Store Service
: java -Dsling.run.modes=oak_mongo -jar org.apache .sling.launchpad-9.jar -c sling -f -
to run the sling launchpad in mongodb mode. 最后,我运行了java -Dsling.run.modes=oak_mongo -jar org.apache .sling.launchpad-9.jar -c sling -f -
在mongodb模式下运行sling启动板。 This was the results: 结果是: As a result, a database named "sling" was created in MongoDB which I could see via Robo-3T (a MongoDB management tool): 结果,在MongoDB中创建了一个名为“ sling”的数据库,我可以通过Robo-3T(一种MongoDB管理工具)看到该数据库:
After creating some content through my maven application using the below plugin and deploying it on Sling, I was able to see my newly created nodes and resources in the Sling browser ( http://localhost:8080/bin/browser.html ): 在使用以下插件通过我的maven应用程序创建了一些内容并将其部署在Sling上之后,我能够在Sling浏览器( http:// localhost:8080 / bin / browser.html )中看到新创建的节点和资源:
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>3.3.0</version>
<configuration>
<instructions>
<Sling-Nodetypes>
SLING-INF/nodetypes/nodetypes.cnd
</Sling-Nodetypes>
<Sling-Initial-Content>
SLING-INF/scripts;overwrite:=true;uninstall:=true;path:=/apps/test1/nodes,
SLING-INF/content;overwrite:=true;uninstall:=true;path:=/content/test1
</Sling-Initial-Content>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
However, I need to to store everything inside the MongoDB database but currently, nothing stored in the database. 但是,我需要将所有内容都存储在MongoDB数据库中,但目前没有任何内容存储在数据库中。 How can I achieve this? 我该如何实现?
The simplest way is to start the Sling Launchpad with the following argument: -Dsling.run.modes=oak-mongo
. 最简单的方法是使用以下参数启动Sling Launchpad: -Dsling.run.modes=oak-mongo
。 This will ensure that the Oak is configured to use Mongo. 这将确保将Oak配置为使用Mongo。 You must remove the sling
directory, otherwise the run modes will not be changes. 您必须删除sling
目录,否则运行模式将不会更改。
What you've done with your attempts is to: 您所做的尝试是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.