Giter Club home page Giter Club logo

hekate's Introduction

Hekate.io

Java Library for Distributed Services

build codecov Maven Central Javadocs

License

Open source Apache License v2.0

Features

  • Distributed Service Discovery

    • Decentralized Service Discovery (based on performance-optimized Gossip protocol)
    • Easy integration into existing infrastructure
      • Clouds (based on Apache JClouds)
        • Amazon EC2 and S3
        • Google Cloud Storage and Compute Engine
        • Azure Blob Storage
        • etc
      • Kubernetes
      • ZooKeeper
      • Etcd
      • Consul
      • IP Multicast
      • Shared Database (JDBC-based)
      • Shared File System
    • User-defined Service Properties and Roles
    • Cluster Event Listeners
    • Service Topology Views and Filtering APIs
    • Health Monitoring and Split-brain Detection
  • Messaging

    • Synchronous and Asynchronous Messaging (backed by Netty)
    • Cluster-aware Load Balancing and Routing
    • SSL/TLS Encryption of Network Communications (optional)
    • Back Pressure Policies
    • Error Retry Policies
    • Pluggable Serialization
      • Google Protocol Buffers (work in progress)
      • JDK Serialization
      • Manual Serialization
  • Remote Procedure Calls (RPC)

    • Type-safe Invocation of Remote Java Services
    • Automatic Discovery and Load Balancing
    • Synchronous and Asynchronous APIs
    • Multi-node Broadcasting and Aggregation of Results
    • Back Pressure Policies
    • Error Retry Policies
    • ...and everything from the "Messaging" section above:)
  • Cluster-wide Singleton Service (aka Leader Election )

    • Decentralized Leader Election
    • Followers are Aware of the Current Leader
    • Leader can Dynamically Yield Leadership
  • Distributed Locks

    • Synchronous and Asynchronous Reentrant Locks
    • Decentralized Lock Management
    • Configurable Lock Groups (aka Lock Regions)
  • Spring Boot/Framework Support (optional)

    • Spring Boot Auto-configurations and @Annotations
    • Spring-compliant Beans
    • Spring XML Schema
  • Metrics

  • Raft-based Replicated State Machines (work in progress)

Documentation

Code Examples

Quickstart for Standalone Java Application

public class MyApplication{
    public static void main(String[] args) throws Exception {
        Hekate hekate = new HekateBootstrap()
            .withNamespace("my-cluster")
            .withNodeName("my-node")
            .join();
        
        System.out.println("Cluster topology: " + hekate.cluster().topology());
    }
}

Quickstart for Spring Boot Application

@EnableHekate // <-- Enable Hekate integration.
@SpringBootApplication
public class MyApplication {
    @Autowired
    private Hekate hekate;

    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }
    
    @PostConstruct
    public void start(){
        System.out.println("Cluster topology: " + hekate.cluster().topology());
    }
}

More Examples:

Please see the hekate-io/hekate-examples project for more examples.

Maven artifacts

  • For projects based on Spring Boot:
<dependency>
    <groupId>io.hekate</groupId>
    <artifactId>hekate-spring-boot</artifactId>
    <version>4.1.3</version>
</dependency>
  • For projects based on Spring Framework:
<dependency>
    <groupId>io.hekate</groupId>
    <artifactId>hekate-spring</artifactId>
    <version>4.1.3</version>
</dependency>
  • For standalone applications:
<dependency>
    <groupId>io.hekate</groupId>
    <artifactId>hekate-core</artifactId>
    <version>4.1.3</version>
</dependency>

How to build

Software requirements:

  • Latest stable Java SDK (8, 11, 17)
  • Latest stable Docker (required for tests only)

Build (no tests):

  • cd to the project's root folder
  • run ./mvnw clean package -DskipTests=true

Build (with tests):

  • cd to the project's root folder
  • make a copy of test.properties file with name my_test.properties
  • edit my_test.properties according to your environment
  • run docker-compose up -d to prepare Docker-based testing infrastructure
  • run ./mvnw clean package

Release History

hekate's People

Contributors

syermakov avatar gzernov avatar yelis913 avatar dependabot[bot] avatar

Stargazers

 avatar Matt Bertolini avatar Andrew NS Yeow avatar Ineanto avatar Mocker avatar globb avatar Sergey K. avatar  avatar  avatar Pengcheng Huang avatar  avatar Carl Kittelberger avatar tesang avatar Hansen Tian avatar Vyacheslav Rogalchuk avatar Łukasz Kolek avatar  avatar Valerii Konchin avatar

Watchers

James Cloos avatar Hansen Tian avatar  avatar

Forkers

syermakov gzernov

hekate's Issues

Node fails to start due to unreachable seed node

I love this library, and have started to use it for our clustering need. Lately I noticed an issue that I couldn't find a workaround.

We are using JDBC as seed node provider. I understand each node adds itself to the database table cluster_node when it joins a cluster and removes itself from the table when it leaves the cluster. In addition, there is a cleanup-interval used by the coordinator node to remove inactive nodes.

Occasionally when all the nodes abruptly die together and fail to clean up the table, the table is left with dead nodes. If I start a new node, it tries to reach these dead "seed nodes" and falls into an infinite retry loop.

The exact sequence of events is non-trivial to reproduce, but the same situation can be easily simulated like the following.

Before start any node, manually add a fake node to the table to simulate a dead node.
image

This fake node is unreachable, now start a real node 192.168.86.129, and watch that it falls in an infinite loop trying to reach the unreachable node.

INFO  2022-05-09 23:38:56,956 main HekateNode 
      Hekate 4.0.0 (build: 20.03.2021, revision: 87b0f48e2d962d000b5c3108fec35e54e6c8b558).
INFO  2022-05-09 23:38:56,960 HekateSys-0-0 NettyNetworkService 
      Network address selected [address=/192.168.86.129, selector=any-ip4]
INFO  2022-05-09 23:38:56,961 HekateSys-0-0 NettyNetworkService 
      Binding network acceptor [port=10012]
INFO  2022-05-09 23:38:57,057 HekateNioAcceptor-2-0 NettyNetworkService 
      Couldn't bind on port 10012 ...will try next port [next-port=10013]
INFO  2022-05-09 23:38:57,061 HekateNioAcceptor-2-0 NettyNetworkService 
      Done binding [bind-address=/0:0:0:0:0:0:0:0:10013]
INFO  2022-05-09 23:38:57,083 HekateSys-0-0 NettyNetworkService 
      Started accepting network connections [address=/0:0:0:0:0:0:0:0:10013]
INFO  2022-05-09 23:38:57,085 HekateCluster-7-0 DefaultClusterService 
      Joining cluster [namespace=model-builder, local-node=/192.168.86.129:10013:f92ee540e26b405090441ebd39d81e75]
INFO  2022-05-09 23:38:57,086 HekateCluster-7-0 HikariDataSource 
      hekateDataSource - Starting...
INFO  2022-05-09 23:38:57,099 HekateCluster-7-0 HikariDataSource 
      hekateDataSource - Start completed.
INFO  2022-05-09 23:38:57,112 HekateClusterGossip-6-0 GossipSeedNodesSate 
      Discovered new seed node [address=SeedNodeState[address=/192.168.0.1:8080, status=NEW]]
INFO  2022-05-09 23:38:57,114 HekateClusterGossip-6-0 GossipSeedNodesSate 
      Discovered new seed node [address=SeedNodeState[address=/192.168.86.129:10012, status=NEW]]
INFO  2022-05-09 23:38:57,115 HekateClusterGossip-6-0 DefaultClusterService 
      Sending cluster join request [seed-node=/192.168.0.1:8080].
INFO  2022-05-09 23:38:58,118 HekateClusterGossip-6-0 DefaultClusterService 
      Sending cluster join request [seed-node=/192.168.86.129:10012].
INFO  2022-05-09 23:38:59,123 HekateClusterGossip-6-0 DefaultClusterService 
      Sending cluster join request [seed-node=/192.168.86.129:10012].
INFO  2022-05-09 23:39:00,130 HekateClusterGossip-6-0 DefaultClusterService 
      Sending cluster join request [seed-node=/192.168.86.129:10012].
WARN  2022-05-09 23:39:00,150 HekateClusterGossip-6-0 GossipSeedNodesSate 
      Seed node timeout ...will retry [address=/192.168.0.1:8080, cause=io.hekate.network.NetworkConnectTimeoutException: connection timed out: /192.168.0.1:8080]
WARN  2022-05-09 23:39:01,124 HekateClusterGossip-6-0 GossipSeedNodesSate 
      Seed node timeout ...will retry [address=/192.168.0.1:8080, cause=io.hekate.network.NetworkConnectTimeoutException: connection timed out: /192.168.0.1:8080]
INFO  2022-05-09 23:39:01,134 HekateClusterGossip-6-0 DefaultClusterService 
      Sending cluster join request [seed-node=/192.168.86.129:10012].
WARN  2022-05-09 23:39:02,128 HekateClusterGossip-6-0 GossipSeedNodesSate 
      Seed node timeout ...will retry [address=/192.168.0.1:8080, cause=io.hekate.network.NetworkConnectTimeoutException: connection timed out: /192.168.0.1:8080]
INFO  2022-05-09 23:39:02,169 HekateClusterGossip-6-0 DefaultClusterService 
      Sending cluster join request [seed-node=/192.168.0.1:8080].
WARN  2022-05-09 23:39:03,132 HekateClusterGossip-6-0 GossipSeedNodesSate 
      Seed node timeout ...will retry [address=/192.168.0.1:8080, cause=io.hekate.network.NetworkConnectTimeoutException: connection timed out: /192.168.0.1:8080]
WARN  2022-05-09 23:39:03,154 HekateClusterGossip-6-0 GossipSeedNodesSate 
      Seed node timeout ...will retry [address=/192.168.0.1:8080, cause=io.hekate.network.NetworkConnectTimeoutException: connection timed out: /192.168.0.1:8080]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.