Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 3. Tutorials


3.1. Prerequisite

Before undertaking these tutorials, you must configure your environment correctly.

See the OpenShift Primer for instructions.

Use this workflow to create and deploy a project. As an example, the tutorial uses the dynamicvdb-datafederation quickstart which combines data from a relational source (H2) and a Microsoft Excel file. After deploying it, you will learn how to switch data sources.

  1. Create a new project:

    $ oc new-project jdv-app-demo
    Copy to Clipboard Toggle word wrap
  2. Create a service account to be used for the Red Hat JBoss Data Virtualization for OpenShift deployment:

    $ oc create serviceaccount datavirt-service-account
    Copy to Clipboard Toggle word wrap
  3. Add the view role to the service account:

    $ oc policy add-role-to-user view system:serviceaccount:jdv-app-demo:datavirt-service-account
    Copy to Clipboard Toggle word wrap
  4. The Red Hat JBoss Data Virtualization for OpenShift template requires SSL and JGroups keystores.
    (These keystores are required even if the application will not use https.)
    The following commands will prompt you for passwords:

    1. Generate a secure key for the SSL keystore:

      $ keytool -genkeypair -alias https -storetype JKS -keystore keystore.jks
      Copy to Clipboard Toggle word wrap
    2. Generate a secure key for the JGroups keystore:

      $ keytool -genseckey -alias jgroups -storetype JCEKS -keystore jgroups.jceks
      Copy to Clipboard Toggle word wrap
  5. Use the SSL and JGroup keystore files to create the keystore secret for the project:

    $ oc secret new datavirt-app-secret keystore.jks jgroups.jceks
    Copy to Clipboard Toggle word wrap
  6. Create a secret with the datasources.env file:

    git clone https://github.com/jboss-openshift/openshift-quickstarts/blob/master/datavirt/dynamicvdb-datafederation/datasources.env
    Copy to Clipboard Toggle word wrap
    $ oc secrets new datavirt-app-config datasources.env
    Copy to Clipboard Toggle word wrap
  7. Link the keystore and environment secrets to the service account:

    $ oc secrets link datavirt-service-account datavirt-app-secret datavirt-app-config
    Copy to Clipboard Toggle word wrap
  8. Log in to the OpenShift Web Console: https://127.0.0.1:8443
  9. Click jdv-app-demo.
  10. Click Add to Project.
  11. Click Browse Catalog.
  12. Enter datavirt in the Filter by keyword search bar.
  13. Click basic-s2i.
  14. Enter these parameters:
    Git Repository URL: https://github.com/jboss-openshift/openshift-quickstarts
    Git Reference: master
    CONTEXT_DIR: datavirt64/dynamicvdb-datafederation/app
  15. Click Deploy.
  16. Switch to using a MySQL data source instead of H2:

    $ oc env dc/datavirt-app QS_DB_TYPE=mysql5
    Copy to Clipboard Toggle word wrap

3.3. How to use a cache as a materialization target

Having deployed the dynamicvdb-datafederation quickstart, you can now deploy a Red Hat JBoss Data Grid instance. This allows you to quickly query the cache for data, without having to go back to the original sources.

You can use any of the Red Hat JBoss Data Grid for OpenShift templates, but it is better to use non-persistent templates as these provide you with clustering and high availability functionality. To obtain them, click here: https://github.com/jboss-container-images/jboss-datavirt-6-openshift-image/tree/datavirt64/resources/openshift/templates

  1. Enter the jdv-app-demo project:

    $ oc project jdv-app-demo
    Copy to Clipboard Toggle word wrap
  2. Create a service account for JDG for OpenShift:

    $ oc create serviceaccount datagrid-service-account
    Copy to Clipboard Toggle word wrap
  3. Add view role permissions to the service account:

    $ oc policy add-role-to-user view system:serviceaccount:jdv-app-demo:datagrid-service-account
    Copy to Clipboard Toggle word wrap
  4. Create the keystore secret for the project:

    $ oc secret new datagrid-app-secret jgroups.jceks
    Copy to Clipboard Toggle word wrap
  5. Link the keystore secret to the service account:

    $ oc secrets link datagrid-service-account datagrid-app-secret
    Copy to Clipboard Toggle word wrap
  6. Log in to the OpenShift Web Console.
  7. Click the jdv-app-demo project space.
  8. Click Add to Project.
  9. Enter datagrid in the Filter by keyword search bar.
  10. Click the datagrid71-https template.
  11. In the DATAVIRT_CACHE_NAMES environment variable field, enter stockCache.
  12. In the CACHE_TYPE_DEFAULT environment variable field, enter replicated.
  13. Enter these parameters:
    USERNAME: jdg
    PASSWORD: JBoss.123
    JDG User Roles/Groups (ADMIN_GROUP): admin,___schema_manager
    HOTROD_AUTHENTICATION: true
    CONTAINERSECURITYROLE_MAPPER: identity-role-mapper
    CONTAINER_SECURITY_ROLES:"admin=ALL,jdg=ALL"
  14. Click Deploy.
  15. Set JDG as the materialization target:
$ oc env bc/datavirt-app DATAGRID_MATERIALIZATION=true
Copy to Clipboard Toggle word wrap
Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat