On 28.02.2019 12:50, Damiano Albani wrote:
Hello,
I have looked at the Oak documentation / code and googled quite a lot but I
couldn't find instructions on how to configure Oak to use an
RDBDocumentStore in an OSGi environment.
I have written a Spring Boot application based on the example available at
https://github.com/apache/jackrabbit-oak/tree/trunk/oak-examples/standalone,
and it works fine with MongoDB.
Well, actually, I see quite a lof of disk I/O from MongoDB when adding lots
of JCR nodes.
That's why I wanted to have a try with an relational database (PostgreSQL)
and see how it compares.
I'm an OSGi newbie so it's probably obvious for someone with more
experience, but here's what I tried in my repository JSON configuration
file:
...
"org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService": {
"customBlobStore": true,
"documentStoreType": "rdb"
},
...
I see the following in the logs at startup:
...
o.a.j.o.p.d.DocumentNodeStoreService : Initializing DocumentNodeStore
with BlobStore [DataStore backed BlobStore
[org.apache.jackrabbit.oak.blob.cloud.gcs.GcsDataStore]]
o.a.j.o.p.d.DocumentNodeStoreService : DataSource use enabled.
DocumentNodeStoreService would be initialized when DataSource would be
available (currently available: nodes: null, blobs: null)
...
I suppose Oak is waiting for a *javax.sql.DataSource* to be "available",
but how am I supposed to define one?
Do I need to use a library like OPS4J Pax JDBC??
I've tried adding the following to the repository JSON config:
"org.ops4j.datasource": {
"osgi.jdbc.driver.class": "org.postgresql.Driver",
"dataSourceName": "PostgreSQL,",
"user": "sa",
"password": "sa"
},
And I also had to modify the *REPOSITORY_BUNDLE_FILTER* property to add
"(Bundle-SymbolicName=org.ops4j.pax*)".
I now see activity related to Pax in the logs, but Oak still refuses to
startup properly.
What am I missing? Thanks for your help!
You can use
<https://sling.apache.org/documentation/bundles/datasource-providers.html>
as datasource provider.
That said: don't expect this to perform better than MongoDB - the
RDBDocumentStore essentially emulates the JSON storage of MongoDB inside
a relational database.
Best regards, Julian