Skip to content

Discovery protocol for JGroups using AWS S3 buckets as cluster information store

License

Notifications You must be signed in to change notification settings

jgroups-extras/jgroups-aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JGroups AWS – S3_PING

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.

Maven Coordinates

<dependency>
    <groupId>org.jgroups.aws</groupId>
    <artifactId>jgroups-aws</artifactId>
    <version>3.0.1.Final</version>
</dependency>

Protocol Configuration

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.

Configurations Properties

Attribute Name
System Property
Environment variable
Default Description

region_name
System property: jgroups.aws.s3.region_name
Environment variable: JGROUPS_AWS_S3_REGION_NAME

required

The AWS region with which to communicate.

bucket_name
System property: jgroups.aws.s3.bucket_name
Environment variable: JGROUPS_AWS_S3_BUCKET_NAME

required

The AWS S3 bucket name to use.

bucket_prefix
System property: jgroups.aws.s3.bucket_prefix
Environment variable: JGROUPS_AWS_S3_BUCKET_PREFIX

The prefix to prefix all AWS S3 paths with, e.g. jgroups/.

check_if_bucket_exists
System property: jgroups.aws.s3.check_if_bucket_exists
Environment variable: JGROUPS_AWS_S3_CHECK_IF_BUCKET_EXISTS

true

Whether to check if the bucket exists in AWS S3 and create a new one if it does not exist yet.

endpoint
System property: jgroups.aws.s3.endpoint
Environment variable: JGROUPS_AWS_S3_ENDPOINT

The AWS endpoint with which to communicate.

path_style_access_enabled
System property: jgroups.aws.s3.path_style_access_enabled
Environment variable: JGROUPS_AWS_S3_PATH_STYLE_ACCESS_ENABLED

false

Forces the AWS S3 client to use path-style addressing for buckets.

kms_key_id
System property: jgroups.aws.s3.kms_key_id
Environment variable: JGROUPS_AWS_S3_KMS_KEY_ID

KMS key to use for enabling KMS server-side encryption (SSE-KMS) for AWS S3.

acl_grant_bucket_owner_full_control
System property: jgroups.aws.s3.acl_grant_bucket_owner_full_control
Environment variable: JGROUPS_AWS_S3_ACL_GRANT_BUCKET_OWNER_FULL_CONTROL

false

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.

Example Stack

<!--
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>

Testing

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.

Reporting Issues

Project JGroups AWS uses GitHub Issues for tracking:

Support Matrix

Version (branch) JGroups version AWS SDK

3.x (main)

5.2.x - 5.3.x

2.x

2.x

5.2.x

1.x

1.x

4.2.x

1.x

About

Discovery protocol for JGroups using AWS S3 buckets as cluster information store

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages