Skip to content

Web Cluster Deployment ​

Web Cluster Deployment ​

This page describes a two-server Web cluster deployment model. Adjust IP addresses, passwords, SSL certificates, JVM parameters, and storage paths according to the production environment.

Server Role Planning ​

RoleServer AServer B
Nginx load balancingNo, single point on BYes, main load balancer
Spring Boot applicationYes, FastBee with Ignite nodeYes, FastBee with Ignite node
DatabaseMySQL + TDenginePrimary-replica mode to be implemented
CacheRedis single node with persistencePrimary-replica mode to be implemented

1. Prepare Both Servers ​

Install Docker and Docker Compose on both servers:

bash
curl -fsSL https://get.docker.com | sh
systemctl start docker && systemctl enable docker

curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

2. Deploy Server A ​

Assume the public IPs are 123.0.0.1 and 124.0.0.2, and the internal IPs are 10.1.1.10 and 20.2.2.20.

Before deployment:

  • Package the backend as fastbee-admin.jar.
  • Build the frontend dist package.
  • Prepare the license file, upload directory, logs directory, and database initialization files.

Key configuration items in docker-compose.yml:

yml
java:
  image: openjdk:8-jre
  container_name: java
  ports:
    - 8080:8080
    - 47500-47509:47500-47509
    - 47101:47101
    - 11211:11211
    - 10800:10800
    - 48500:48500
    - 48880:48880
  environment:
    WORKER_HOST: 123.0.0.1
    IGNITE_LOCAL_IP: 10.1.1.10
    IGNITE_CLUSTER_NODES: 10.1.1.10,20.2.2.20
  network_mode: host
  volumes:
    - /var/data/java/fastbee-admin.jar:/server.jar
    - /var/data/java/license:/license
    - /var/data/java/uploadPath:/uploadPath
    - /var/data/java/logs:/logs
    - /etc/localtime:/etc/localtime

Tune JVM and Ignite parameters based on server resources. For a 4-core 8 GB server, start from conservative heap and off-heap settings, then adjust after benchmarking.

3. Deploy Server B ​

Server B runs Nginx load balancing and a Spring Boot application instance. The Nginx upstream should point to the internal IPs of Server A and Server B:

nginx
upstream backend {
    server 10.1.1.10:8080 max_fails=1 fail_timeout=10s;
    server 20.2.2.20:8080 max_fails=1 fail_timeout=10s;
    keepalive 60;
    least_conn;
}

server {
    listen 80;
    listen 443 ssl;
    server_name localhost;

    ssl_certificate /usr/share/nginx/ssl/fastbee.crt;
    ssl_certificate_key /usr/share/nginx/ssl/fastbee.key;

    location /prod-api/ {
        proxy_pass http://backend/;
    }
}

Verification ​

  1. Confirm both Spring Boot instances are registered and healthy.
  2. Access the platform through Nginx and verify login, device list, product list, and common APIs.
  3. Verify WebSocket, file upload, video callback, and static resource paths.
  4. Simulate node restart and confirm Nginx routes traffic to the remaining healthy node.

FastBee | fastbee.cn