Up to CoreMedia CMS 2006, the Content Server stored all blobs in one database table. This was sufficient for many cases, but there are scenarios where other solutions are preferable, for example:
Different access characteristics for different blobs
Very high volume of blobs
Requirements on upload and delivery speed
CoreMedia CMS now offers two methods to cope with different requirements for blob storage:
Configure the table space for blob data as described in Section 3.3.1, “Specifying Tablespaces for the Content Server”
Define different "media stores" for blobs, described in this section.
Media Stores for blobs
CoreMedia CMS supports different media stores for the storage of blobs, depending on some properties of the blob, such as
size,
MIME type
target property and content type.
The Media Store is only responsible for storing and retrieving the actual bytes. The MIME content type, garbage collection, and authentication is managed by the Content Server. CoreMedia CMS supports the following media stores:
Storing blobs in files
Storing blobs as ZIP files
Zip blobs and store them in the
blobstore
tableStoring blobs in different database tables
By default, blobs are still stored in the CoreMedia CMS.
File-based blob storage
As one option for a blob store, you can store blob contents on the file system reachable by the
Content Server. The Content Server takes
care that the number of files/subdirectories per directory does not grow too large. By default, files are stored
in the blobstore/file
directory below the Content Server
installation.
For consistent backup, suspend the server's blob collector with the property
sql.store.collector.suspend=true
in the sql.properties
file before starting the backup
process.
Caution | |
---|---|
This feature is not intended to manage existing file structures, and does not support file access that bypasses the Content Server. Also, a file structure may be accessed by only one Content Server at a time. |
Storing blobs as zipped files
You can compress blobs which are not compressed by themselves, such as text blobs, and store them in the file
system or in the database. By default, the zipped files are stored in the blobstore/zipfile
directory
below the Content Server installation directory or in the
blobstore
table of the database. Storing zipped files in the database requires a temporary directory
which is var/temp
by default.
Storing blobs in different database tables
You can configure multiple database tables, each with individual database-specific characteristics, to store the blobs in. The Content Server will not create the tables automatically, so you have to create them manually.
What happens to existing blobs
If you add a blob store for an existing Content Server chances are high that blobs are already stored in the database. These blobs will not automatically be moved to the newly configured blob store. On the Master Live Server, the blobs will be moved to the new store the next time when the content item containing the blob is published. On the Content Management Server you have to download the blob from the content item and upload it again it's not enough to create a new content item version.
Configuring blob store selectors
Note | |
---|---|
Not Mandatory: You only need to do this configuration, if you want to store your blobs in a location different from the default location in the CMS. |
Caution | |
---|---|
Configure the blob stores in the file:
Replace |
Take the blobstore-example.xml
file as an example and see the Javadoc of the
hox.corem.server.media
package for further details.
If you want to store blobs in different locations, depending on some properties of the blob, you can add media store selectors to the Content Server. A media-store selector defines under which conditions a specific blob store should be used. Example 3.5, “Example configuration” shows the configuration of two media store selectors. One for blobs larger than 1000000 bytes, which are stored in the file system, and one for images smaller than 8192 bytes, which are stored in a different database table.
<customize:prepend bean="blobstore" property="mediaStoreSelectors"> <description> Select a media store </description> <list> <!-- store big blobs in the file system. --> <bean class= "hox.corem.server.media.ConditionalMediaStoreSelector"> <property name="storeName" value="file"/> <property name="condition"> <bean class="hox.corem.server.media.MatchCondition"> <property name="minimumLength" value="1000000"/> </bean> </property> </bean> <!-- store images of a certain minimum size in a different database table --> <bean class="hox.corem.server.media.ConditionalMediaStoreSelector"> <property name="storeName" value="dbblob"/> <property name="condition"> <bean class="hox.corem.server.media.MatchCondition"> <property name="primaryType" value="image"/> <property name="maximumLength" value="8192"/> </bean> </property> </bean> </list> </customize:prepend>
Example 3.5. Example configuration
The following blob store names are predefined:
"file"
for storing blob contents in the file system"dbblob"
for storing blob contents in the database tableblobstore
. Consult the Javadoc ofhox.corem.server.media.BlobStore
for further details."zipfile"
for storing blob contents in the file system in zipped format"zipdbblob"
for storing blob contents in the database tableblobstore
, in zipped format.the empty string,
""
, for storing blob contents in the CMS tables as in previous releases.
Media store selectors are stored in the property mediaStoreSelectors
of the blobstore
bean. You can use the customizer tag <customize:prepend>
to prepend your media store selectors
to the list. The Content Server iterates over this list and the first matching
condition defines the blob store to use for the specific blob.
If you need to, you can use the full power of Spring for configuration. However, as an administrator, you only need the following beans and tags to construct your condition.
The ConditionalMediaStoreSelector
is the bean which chooses the blob store to use. It has a property
condition
which takes the condition.
<bean>
Child elements: <property>
Parent elements: <list>, <customize:prepend>, <customize:append>
The <bean>
element defines the bean which should be configured. In the context of the blob
storage media store class or condition bean, which should be configured.
Property | Description |
---|---|
class |
Defines the Bean class, which should be modified. In the context of the blob storage, these are media store beans or condition bean, which should be configured. |
Table 3.1. Attributes of the bean element
The following condition beans can be used.
Condition Name | Description |
---|---|
hox.corem.server.media.AndCondition
| A condition which takes a list of conditions in the conditions
property. You configure a list with the <list> element. It returns
"true" when all conditions are fulfilled. |
hox.corem.server.media.OrCondition
| A condition which takes a list of conditions in the conditions
property. You configure a list with the <list> element. It returns
"true" when at least one of the conditions is fulfilled. |
hox.corem.server.media.MatchCondition
|
A condition which takes some values defined with
It returns "true" when all values match. |
Table 3.2. Condition classes which could be used in the <bean> element.
<property>
Child elements: <bean>, <list>
Parent elements: <bean>
The <property>
element defines the property of a bean, which should be configured.
Attribute | Description |
---|---|
name | The name of the bean property, which should be configured. |
value | The value, which should be added to the bean property. |
Table 3.3. Attributes of the property element
<list>
Child elements: <bean>
Parent elements: <property>
The <list>
element groups conditions, which should be used in an AndCondition
or
OrCondition
. It has no attributes.
Proceed as follows to configure the ConditionalMediaStoreSelector
:
Take the
blobstore-example.xml
file as a template for your media store selector.Add a new
<bean class="hox.corem.server.media.ConditionalMediaStoreSelctor">
tag below the<list>
tag of the<customize:prepend bean="blobstore" property="mediaStoreSelectors">
tag or uncomment an existing configuration from the file.Add a
<property name="storeName" value="selectedMediaStore>"/>
below the<bean>
tag and replace "selectedMediaStore"
with the name of the media store where the blob should be stored.Construct your matching condition.
Configuring store locations for file storage
You can change the default locations for the storage of blobs in the file system.
Open the file
blobstore.properties
in theconfig/contentserver/spring/blobstore
directory.Uncomment the appropriate property and add your path:
For the location of blobs stored in the file system use the
cap.server.blobstore.file.rootdir
property.For the location of blobs zipped and stored in the file system use the
cap.server.blobstore.zipfile.rootdir
property.For the location of temporary files for blobs zipped and stored in the database use the
cap.server.blobstore.zipdbblob.tmpdir
property.