- Index

< Previous |  |

# LiveView Metadata Store

## Overview

Multiple LiveView servers can be configured to share metadata resources when they use the same metadata store and are in the same cluster.

LiveView supports the following metadata store types:

Store Type | Supports Resource Sharing? | Store Default?
--- | --- | ---
H2 | No | Yes
transactional memory | Yes | No
JDBC | Yes | No

Resource sharing requires:

- Configuring a common metadata store for LiveView servers participating in the same cluster. The metadata store must be a JDBC database or transactional memory; the default H2 store does not support this capability.

- Enabling user privileges to allow importing and exporting of resources between LiveView servers.

- Using LiveView lv-client commands to import and export resources between LiveView servers.

### Resources Shared

Shared resources between LiveView servers include:

- LiveView alerts in JSON format, for backup purposes.

- LiveView workspaces in JSON format, for backup purposes.

- LiveView Web resources. For supported resources, refer to the LiveView Web documentation.

## Required Configuration Files

Setting up a common metadata store requires the following configuration files of HOCON type. Place these configuration files in the `src/main/configurations` folder of your LiveView project.

LiveView Engine

  Use to set the `storeType` property for the LiveView nodes in the cluster.

EventFlow JDBC Data Source Group

  Use to define the JDBC data store type when the LiveView Engine configuration file's `storeType` property is set for JDBC.

Role to Privileges Mappings

  Use to map a user role to the necessary privileges to allow importing and exporting resources between LiveView servers.

### Engine Configuration

You must configure each server with the same `storeType` type in a LiveView Engine configuration file.

The example below defines the `storeType` property with a value of JDBC and uses the `jdbcDataSource` property to define a source called `myJDBCSource`. If you define a JDBC data source in the engine configuration file, you must use the same JDBC data source value in a JDBC configuration file of HOCON type (see below).

Unlike the JDBC case, setting the `storeType` to TRANSACTIONAL_MEMORY does not require additional metadata store configuration.

    name = "myldmengine"
    version = "1.0.0"
    type = "com.tibco.ep.ldm.configuration.ldmengine"
    configuration = {
      LDMEngine = {
        metadataStore = {
          storeType = "JDBC"
          jdbcDataSource = "myJDBCSource"
          jdbcMetadataTableNamePrefix = "LV_CLUSTER1_"
          }
        }
    }

### JDBC Configuration

Configure a EventFlow JDBC Data Source Group configuration file when the LiveView engine configuration file defines a JDBC `storeType` (see above).

A JDBC configuration file can define multiple JDBC data sources. To enable resource sharing between LiveView servers, your JDBC configuration file must contain at least one data source, and the value must match the value defined in the engine configuration file. This example defines one JDBC source called `myJDBCSource`.

    name = "mydatasource"
    version = "1.0.0"
    type = "com.tibco.ep.streambase.configuration.jdbcdatasource"
    configuration = {
      JDBCDataSourceGroup = {
        associatedWithEngines = [ "javaengine", "otherengine[0-9]" ]
        jdbcDataSources = {
          myJDBCSource = {

### Privileges Configuration

The Role to Privileges Mappings configuration file is required to allow importing and exporting resources between LiveView nodes. Your configuration file must define a user that includes the following privileges:

LiveViewMetadataImport

  Enables importing data using lv-client into the LiveView server.

LiveViewMetadataExport

  Enables exporting data using lv-client from the LiveView server.

In practice you often define users with multiple LiveView privileges, depending on user role. The following example defines a user with all LiveView privileges, which includes both privileges described above.

    name = "my-role-mappings"
    version = "1.0.0"
    type = "com.tibco.ep.dtm.configuration.security"
    configuration = {

      RoleToPrivilegeMappings = {
        privileges = {
          admin = [
            {
              privilege = "LiveViewAll"
            }
          ]
        }
      }
    }

## Required Commands

Two lv-client commands are required to import and export resources between LiveView nodes in the same cluster:

importmetadata

  Imports resources to a LiveView server.

exportmetadata

  Exports resources from a LiveView server.

## Restrictions

The transactional memory metadata store type is only supported on `homogeneous` Live Datamart clusters (meaning the cluster cannot contain a mix of LiveView and StreamBase fragments when using a transactional memory metadata store). TIBCO recommends using either the JDBC or H2 metadata store type when your cluster contains both LiveView and StreamBase fragments.