Cluster Configuration Guide
Overview
The InfoConnect Hub for AWS is a self-contained Amazon Machine Image (AMI) that runs on a single node and surfaces IBM i programs, commands and messages as REST APIs. To handle higher transaction volumes and improve resilience, you can run several nodes ("workers") as a cluster. Each node processes Admin API and Functional API requests, and configuration changes are propagated to all nodes in near real time.
This guide describes an example cluster of two AWS instances. Configure the cluster in two parts:
- Create an H2 database cluster.
- Configure a load balancer in front of the nodes.
Note
A newer alternative is available. The Hub can synchronize several instances through a shared external metadata database (MySQL or IBM i) by setting db.sync.enabled=true. See Distribution archive and Multiple Hub replicas.
H2 cluster configuration
Note
The steps below show the layout of the AWS Marketplace instance. In the distribution archive, the H2 JAR is info-connect-hub/executable-jars/h2-2.2.220.jar, the database is ./info-connect-hub/config-db, the database credentials are spring.datasource.username and spring.datasource.password in info-connect-hub/config/application.properties, and JVM options go to extraOpts in the [jvm.hub] section of start-scripts/config/modules.manifest.ini.
H2 is the embedded database in which the Hub stores its metadata. Perform steps 1, 2, 4 and 5 on both instances. Run step 3 on one instance only.
-
Connect to the instance and open the
<project-folder>/executable-jarsdirectory.<project-folder>is/opt/info-connect-hubon an AWS Marketplace instance.
-
Start the H2 server in the background.
<h2-port>is the port on which the H2 server runs on the instance.sudo java -cp h2-1.4.199.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort <h2-port> -ifNotExists &Then detach the server from your shell:
-
Create the H2 cluster. Run the following command on any one instance:
java -cp h2-1.4.199.jar org.h2.tools.CreateCluster -urlSource jdbc:h2:tcp://<first-instance-ip>:<h2-port>/./src/main/resources/connections -urlTarget jdbc:h2:tcp://<second-instance-ip>:<h2-port>/./src/main/resources/connections -user h2db -password password -serverList <first-instance-ip>:<h2-port>,<second-instance-ip>:<h2-port>On both instances, the
src/main/resourcesfolder now contains a newconnections.mv.dbfile with the same creation date and time.

-
Change the datasource URL in
application.propertiesin the<project-folder>/configfolder:
-
Add the JVM parameter
-Dh2.clustering.enabled=trueto theas400-common-api-1.0.0.conffile in the<project-folder>/executable-jars/folder:
For more information, see H2 clustering.
Load balancer configuration
This configuration is an example only. Your AWS environment can have different requirements, standards and services.
To create a load balancer in the AWS Management Console, configure a target group first, then the load balancer and its listener.
Configuring the target group
A target group registers the EC2 instances to which the load balancer distributes client requests.
- In the navigation pane, open Target Groups and choose Create target group.
- In Basic configuration, do the following:
- For Choose target type, select Instances to register targets by instance ID.
- Enter a name in Target group name.
- For Protocol, choose TCP, and enter 8080 as Port (the default port of the Hub).
- Choose Next.
- In Register targets, select one or more instances and choose Include as pending below.
- Choose Create target group.
Configuring the load balancer and listener
- In the navigation pane, open Load Balancers, choose Create Load Balancer, and under Network Load Balancer choose Create.
- In Basic configuration, do the following:
- Enter a name for the load balancer.
- For Scheme, choose Internet-facing to route client requests to the targets over the internet.
- For IP address type, choose IPv4 if your clients use IPv4 addresses. Choose Dualstack if your clients use both IPv4 and IPv6 addresses.
- In Network mapping, do the following:
- For VPC, select the VPC that your instances use.
- For Mappings, select one or more zones where the instances run.
- In Listeners and routing, do the following:
- For Listeners, change the port of the default listener (TCP, port 80) to 8080.
- For Default action, choose the target group that you created.
- Choose Create load balancer.
Testing the load balancer
- In the Load Balancers pane, select the new load balancer.
- Copy its DNS name, for example
my-load-balancer-1234567890abcdef.elb.us-east-2.amazonaws.com. -
Paste the DNS name into the address field of a browser, and add the listener port and
/admin/connections:
The browser shows an authorization dialog. Enter the Admin API user name and password. The browser then shows the list of available connections.
For more information, see Creating a Network Load Balancer.