Insert into model (id, name, model, soc, memory_mb, ethernet, release_year) values (1, 'Raspberry Pi', 'B', 'BCM2835', 256, TRUE, 2012) The rpi-store-dml.sqlscript will create three rows in the model table: The rpi-store-ddl.sql script will run the following SQL commands to create the model table which will be used to load keys and values into the Data Grid cache: Note that the user needs to be postgres to create a new user. Run_sql_script $START_DIR/rpi-store-role.sql Run_sql_script $START_DIR/rpi-store-dml.sql Run_sql_script $START_DIR/rpi-store-ddl.sql START_DIR="$APP_DATA/src/postgresql-start" The load_db.sh script populates the table used to load the Data Grid cache and creates the user infinispan with privileges to SELECT from the model table: RUN chmod 774 /opt/app-root/src/postgresql-start/*.sh LABEL description="This is a custom PostgreSQL container image which loads the database schema definitions and the data into the model and inventory tables "ĬOPY db/load_db.sh /opt/app-root/src/postgresql-start/ĬOPY db/rpi-store-ddl.sql /opt/app-root/src/postgresql-start/ĬOPY db/rpi-store-dml.sql /opt/app-root/src/postgresql-start/ĬOPY db/rpi-store-role.sql /opt/app-root/src/postgresql-start/ To deploy PostgreSQL in Red Hat OpenShift, we will use a modified image that initializes the database with a table and a Data Grid user with granted privileges to read from the table.įROM /rhel8/postgresql-12 We will use PostgreSQL to contain the table that will be loaded by Data Grid. All source code for this tutorial can be found on GitHub. It is also possible to use SQL queries to load entries from single or multiple database tables.įor more details, refer to SQL cache stores. In the following example, Data Grid will load entries from a single database table. Data Grid offers two types of SQL cache stores: table and query. SQL cache stores let you load Red Hat Data Grid caches from existing database tables. How to deploy PostgreSQL with a custom image Data Grid will automatically load new entries added to the database table, however modified rows will require reloading using a server task, as shown in the following example. In this article, we will deploy a Java class that will evict and reload the cache in order to pick up modified entries in the original database table from which we loaded the cache. Tasks can be implemented as custom Java classes or as scripts in languages such as JavaScript. Custom server tasks can be deployed to the Red Hat Data Grid server for remote execution from the command line interface (CLI) and Hot Rod or REST clients.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |