diff --git a/README.md b/README.md index 59a98c4..3700d3f 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,12 @@ Check [the complete schedule](https://www.gridgain.com/products/services/trainin ## Setting Up Environment -* Java Developer Kit, version 11, 17 or 21 -* Apache Maven 3.0 or later -* Docker -* Your favorite IDE, such as IntelliJ IDEA, or Eclipse, or a simple text editor. +* GridGain license file. Instructions will be emailed when you register, but, in short, grab your key [here](https://www.gridgain.com/tryfree) +* Docker and Docker Compose installed on your system +* Basic familiarity with command-line operations +* Java 11, 17 or 21 (for connecting to the cluster) +* Maven +* (An IDE such as IntelliJ will make things a lot easier but is not strictly necessary) ## Clone The Project @@ -42,15 +44,15 @@ Start a two-node Ignite cluster: 4. Start your nodes using Docker Compose: ```bash - docker compose -f docker-compose.yml up + docker compose up -d ``` -5. Switch back to your browser and select `Attach Apache Ignite` +5. Switch back to your browser and select `Attach GridGain` 6. In the "Connector" dropdown, select `Ignite Essentials` 7. The `URL of the REST API` is `http://node1:10300` 8. Click `Continue` 9. Click `Attach` -10. Initialise the cluster by clicking the `Initialise` button at the top-right of the screen +10. Initialize the cluster by clicking the `Initialize` button at the top-right of the screen. Drop in your license file as suggested ## Creating Media Store Schema and Loading Data @@ -62,7 +64,7 @@ Now you need to create a Media Store schema and load the cluster with sample dat a. Start the Command Line Interface (CLI) ```bash - docker run -v ./config/media_store.sql:/opt/ignite/downloads/media_store.sql --rm --network ignite3_default -it apacheignite/ignite:3.1.0 cli + docker run -v ./config/media_store.sql:/opt/gridgain/downloads/media_store.sql --rm --network ignite3_default -it gridgain/gridgain9:9.1.8 cli ``` b. Connect to the cluster. @@ -74,7 +76,7 @@ Now you need to create a Media Store schema and load the cluster with sample dat c. Execute SQL command to load the sample data. ```bash - sql --file=/opt/ignite/downloads/media_store.sql + sql --file=/opt/gridgain/downloads/media_store.sql ``` Keep the connection open as you'll use it for following exercises. @@ -181,7 +183,7 @@ merges partial results. a. Start the CLI. ```bash - docker run -v ./target/ignite-essentials-developer-training-1.0-SNAPSHOT.jar:/opt/ignite/downloads/ignite-essentials-developer-training-1.0-SNAPSHOT.jar --rm --network ignite3_default -it apacheignite/ignite:3.1.0 cli + docker run -v ./target/ignite-essentials-developer-training-1.0-SNAPSHOT.jar:/opt/gridgain/downloads/ignite-essentials-developer-training-1.0-SNAPSHOT.jar --rm --network ignite3_default -it gridgain/gridgain9:9.1.8 cli ``` b. Connect to the cluster. @@ -193,8 +195,10 @@ merges partial results. c. Deploy the code to the cluster. ```bash - cluster unit deploy --version 1.0.0 --path=/opt/ignite/downloads/ignite-essentials-developer-training-1.0-SNAPSHOT.jar essentialsCompute + cluster unit deploy --version 1.0.0 --path=/opt/gridgain/downloads/ignite-essentials-developer-training-1.0-SNAPSHOT.jar essentialsCompute ``` + + It's also possible to use Control Center to deploy your code if you prefer. Study the "Deployment" tab to find out more. 3. Execute the `ComputeApp` program with the following command: ```shell @@ -202,3 +206,13 @@ mvn exec:java ``` Or run directly from your preferred IDE. + +4. Edit `ComputeApp` and change the number of customers to return from 5 to 10. There's no need to redeploy the compute job because only the caller needs to change. + +## Tidying up + +When you've finished with the exercises, you can shut down the cluster and clean up with the following command: + +```shell +docker compose down +``` diff --git a/docker-compose.yml b/docker-compose.yml index 21c470d..11b4785 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,13 +17,13 @@ name: ignite3 x-ignite-def: &ignite-def - image: apacheignite/ignite:3.1.0 + image: gridgain/gridgain9:9.1.8-openjdk21 environment: - JVM_MAX_MEM=3g - JVM_MIN_MEM=3g configs: - source: node_config - target: /opt/ignite/etc/ignite-config.conf + target: /opt/gridgain/etc/gridgain-config.conf services: node1: @@ -38,14 +38,14 @@ services: ports: - 10301:10300 - 10801:10800 -# node3: -# << : *ignite-def -# command: --node-name node3 -# ports: -# - 10302:10300 -# - 10802:10800 + node3: + << : *ignite-def + command: --node-name node3 + ports: + - 10302:10300 + - 10802:10800 cccc: - image: gridgain/cloud-connector:2025-10-17 + image: gridgain/cloud-connector:2026-02-26 volumes: - ./src/main/resources/controlcenter.conf:/opt/gridgain-cloud-connector/application.properties diff --git a/pom.xml b/pom.xml index 0c20fe5..ec96b27 100644 --- a/pom.xml +++ b/pom.xml @@ -11,12 +11,19 @@ 11 11 - org.apache.ignite - 3.1.0 + org.gridgain + 9.1.8 UTF-8 false + + + GridGain External Repository + https://www.gridgainsystems.com/nexus/content/repositories/external + + + ${ignite.project} diff --git a/src/main/java/training/ComputeApp.java b/src/main/java/training/ComputeApp.java index 63be13a..0446c67 100644 --- a/src/main/java/training/ComputeApp.java +++ b/src/main/java/training/ComputeApp.java @@ -33,6 +33,7 @@ import org.apache.ignite.marshalling.Marshaller; import org.apache.ignite.table.Tuple; import org.apache.ignite.Ignite; +import org.apache.ignite.tx.Transaction; import training.model.CustomerPrice; import training.model.TopCustomer; @@ -126,7 +127,7 @@ public CompletableFuture executeAsync(JobExecutionContext jobEx customerCount = parameters.intValue("count"); - try (var results = jobExecutionContext.ignite().sql().execute(null, sql, parameters.intValue("partition"))) { + try (var results = jobExecutionContext.ignite().sql().execute((Transaction) null, sql, parameters.intValue("partition"))) { while (results.hasNext()) { var row = results.next(); customerPurchases.merge(row.intValue("customerId"), row.value("price"), BigDecimal::add);