LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Local Cluster

In most situations, the light-scheduler will be running in a cluster mode. For developers, chances are you need to run the local application in cluster mode to test some use cases. To do that, we will give you the option to start three nodes from a docker-compose in the command line.

Note: we cannot run multiple instances of the light-scheduler in the command line as these instances are not allowed use with the same local store.

Confluent Platform

You have to start the Confluent Platform with the docker-compose in kafka-sidecar repository.

Create Topics

Create light-scheduler and controller-health-check topics with three partitions from the Control Center.

Docker Compose

In the light-scheduler folder, start the three-node cluster with docker-compose.

cd ~/networknt/light-scheduler
docker-compose up

Test

Query node1, 2, 3 and see the empty response.


curl -k https://localhost:8401/schedulers
curl -k https://localhost:8402/schedulers
curl -k https://localhost:8403/schedulers

The response should be empty.

[]

Create a new task definition on node1

curl -k --location --request POST 'https://localhost:8401/schedulers' --header 'Content-Type: application/json' --data-raw '{
  "host": "lightapi.net",
  "name": "com.networknt.petstore-3.0.1|dev:https:172.17.0.1:8443",
  "action": "INSERT",
  "frequency": {
    "timeUnit": "SECONDS",
    "time": 10
  },
  "topic": "controller-health-check",
  "start": 1633813345308,
  "data": {
    "tlsSkipVerify": "true",
    "address": "172.17.0.1",
    "lastExecuteTimestamp": "0",
    "executeInterval": "0",
    "lastFailedTimestamp": "0",
    "protocol": "https",
    "port": "8443",
    "interval": "10000",
    "id": "com.networknt.petstore-3.0.1|dev:https:172.17.0.1:8443",
    "deregisterCriticalServiceAfter": "120000",
    "healthPath": "/health/",
    "tag": "dev",
    "serviceId": "com.networknt.petstore-3.0.1"
  }
}'

Query the get endpoints on node1, 2, 3, and you will see the same response.

curl -k https://localhost:8401/schedulers
curl -k https://localhost:8402/schedulers
curl -k https://localhost:8403/schedulers

From the docker-compose terminal, you can see the task is triggered every 10 seconds on node1.

Let’s stop node1 from another terminal and see what happens.

cd ~/networknt/light-scheduler
docker-compose stop scheduler-node1

You will see that node2 or node3 takes over the task scheduling and triggers the task every 10 seconds. Also, you will see some Kafka streams rebalancing in the log.

Let’s restart node1 in the same terminal.

docker-compose start scheduler-node1

You will see the rebalancing messages again, and chances are the node1 will take back the scheduling task.

The above demonstrates the high availability and fault tolerance of the light-scheduler.

Video Tutorial

  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“Local Cluster” was last updated: October 12, 2021: fixes #301 add docs for light-scheduler and light-controller (31f7a7e)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute