Projects JGroups AWS provides an implementation of S3_PING
discovery protocol using AWS S3 buckets as cluster information store.
It is based on the original code written by Tobias Sarnowski at Zalando.
[1]
[2]
It uses the official AWS SDK [3] and does not implement the HTTP protocol on its own. The benefit is a more stable connection as well as usage of IAM server profiles and AWS standardized credential distribution.
<dependency>
<groupId>org.jgroups.aws</groupId>
<artifactId>jgroups-aws</artifactId>
<version>3.0.1.Final</version>
</dependency>
This library implements a JGroups discovery protocol which replaces protocols like MPING
or TCPPING
.
<aws.S3_PING region_name="us-east-1a"
bucket_name="jgroups-s3-test"/>
The aws.S3_PING
automatically registers itself to JGroups with the magic number 789
.
You can overwrite this by setting the system property s3ping.magic_number
to different number, e.g. -Ds3ping.magic_number=123
.
Attribute Name System Property Environment variable |
Default | Description |
---|---|---|
|
required |
The AWS region with which to communicate. |
|
required |
The AWS S3 bucket name to use. |
|
The prefix to prefix all AWS S3 paths with, e.g. |
|
|
|
Whether to check if the bucket exists in AWS S3 and create a new one if it does not exist yet. |
|
The AWS endpoint with which to communicate. |
|
|
|
Forces the AWS S3 client to use path-style addressing for buckets. |
|
KMS key to use for enabling KMS server-side encryption (SSE-KMS) for AWS S3. |
|
|
|
Whether to grant the bucket owner full control over the bucket on each update. This is useful in multi-region deployments where each region exists in its own AWS account. |
Note
|
System properties are supported since JGroups AWS release version 3.0.1.Final.
To use properties in the previous version, the property must be explicitly defined in the configuration, e.g. <aws.S3_PING region_name="eu-central-1" … />" .
|
Note
|
Be mindful of how JGroups resolves values at runtime when using system properties or environment variables.
For example, consider the configuration <aws.S3_PING bucket_name="${my.bucket.property:myBucketDefaultValue}" … /> .
JGroups will first attempt to resolve the my.bucket.property property.
If it is not defined, the default value myBucketDefaultValue will be used.
If no default value is specified, JGroups will then attempt to resolve jgroups.aws.s3.bucket_name system property,
followed by the environment variable JGROUPS_AWS_S3_BUCKET_NAME .
|
<!--
Based on standard tcp.xml with discovery replaced with aws.S3_PING.
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:org:jgroups"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<TCP bind_addr="${jgroups.bind_addr:site_local}"
bind_port="${jgroups.bind_port:7800}"
external_addr="${jgroups.external_addr}"
external_port="${jgroups.external_port}"
thread_pool.min_threads="0"
thread_pool.max_threads="200"
thread_pool.keep_alive_time="30000"
diag.enabled="false"/>
<NON_BLOCKING_SENDS/>
<aws.S3_PING/>
<MERGE3 min_interval="10s"
max_interval="30s"/>
<FD_SOCK2/>
<FD_ALL3 timeout="40s"
interval="5s"/>
<VERIFY_SUSPECT2 timeout="1.5s"/>
<BARRIER/>
<pbcast.NAKACK2 use_mcast_xmit="false"/>
<UNICAST3/>
<pbcast.STABLE desired_avg_gossip="50s"
max_bytes="4M"/>
<pbcast.GMS print_local_addr="true"
join_timeout="2s"/>
<MFC max_credits="10M"
min_threshold="0.4"/>
<UFC max_credits="10M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K"/>
<pbcast.STATE_TRANSFER/>
</config>
Running the automated tests requires having AWS credentials setup with appropriate permissions along with setting the region name and a bucket name.
declare -x AWS_ACCESS_KEY_ID="qF7ujVAaYUp3Tx7m"
declare -x AWS_SECRET_ACCESS_KEY="WzbG3R2KGtx5rsHQUx2PKQPS2f6WzMtf"
declare -x JGROUPS_AWS_S3_REGION_NAME="eu-central-1"
declare -x JGROUPS_AWS_S3_BUCKET_NAME="jgroups"
mvn verify
If the required AWS credentials are not specified, testing with AWS S3 will be skipped (uses org.junit.Assume
).
In case credentials are not provided and running on Linux, tests will be run against mock containerized S3 instance. These require a functioning podman or Docker environment.
Project JGroups AWS uses GitHub Issues for tracking:
Version (branch) | JGroups version | AWS SDK |
---|---|---|
|
5.2.x - 5.3.x |
2.x |
|
5.2.x |
1.x |
|
4.2.x |
1.x |