Skip to content

Configure GSN Storage

ebiiii edited this page Oct 6, 2014 · 1 revision

GSN uses a database for processing (windows, user queries, etc.) and for storing/retrieving the processed data. When the initial GSN supported only one database for processing and storing the data, the latest version of GSN allows the flexible storage options described below.

##All-in-one

This is the standard mode for GSN where the processing and data storage is done in the same database. In order to use this mode, please configure the file "conf/gsn.xml" like the one below.

...
<!-- Main Storage Database, Mandatory -->
<storage user="root" password="" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/gsn" />
...

##Splitted Processing/Storage

This mode splits the processing and the storage in two different databases. With this mode, the performances can be improved either by setting, for the processing, either an in-memory database or a remote database running on a dedicated server (see ?). In order to use this mode, please configure the file "conf/gsn.xml" like the one below.

...
<!-- Main Storage Database, Mandatory -->
<storage user="root" password="" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/gsn" />
...
<!-- Processing Database, Optional. If not specified, the processing is implemented using the Main Storage Database specified above  -->
<sliding>
    <storage user="sa" password="" driver="org.h2.Driver" url="jdbc:h2:mem:sliding;DB_CLOSE_DELAY=-1" />
</sliding>
...

##Storage per Virtual Sensor

Where there is only one database for the processing, GSN let you setup a specific database for each virtual sensor. This can be applied with the All-in-one and the Splitted storage modes. In order to enable this for a virtual sensor, you only need to override the default Storage database setting in its XML description file.

The example below defines a specific database for storing the data of the memorymonitorvs, in the "memoryDataVS.xml" file.

...
</addressing>
<storage user="user" password="pwd" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://10.0.0.4/gsn" />
<streams>
...

This feature applied to in-memory database, let you build transient virtual sensors which would store the data only for the time they are loaded into the GSN container. This is useful for storing temporary results.

...
</addressing>
<storage user="sa" password="" driver="org.h2.Driver" url="jdbc:h2:mem:transcientmemorymonitorvs;DB_CLOSE_DELAY=-1" />
<streams>
...
Clone this wiki locally