Skip to main content

Multi-Node Mode

Description

Applicable scenarios: Applications with high data security requirements, large applications. Advantages: High availability, strong disaster recovery, supports online scaling, real-time automatic backup between multiple replicas, load balancing, etc. Disadvantages: Slightly complex deployment, requires multiple machines. WuKongIM cluster follows the 2n+1 principle, where n represents the number of allowed failures. For example, to allow 1 machine to fail without affecting normal service operation requires 2×1+1=3 machines in the cluster; to allow 2 machines to fail without affecting normal service operation requires 2×2+1=5 machines in the cluster, and so on.

Environment Requirements

  • Number of machines: 3 or more
  • Operating System: Linux (Ubuntu recommended) (Recommended configuration: 2 cores 4GB or 4 cores 8GB)
  • Load Balancer: nginx (recommended version 1.27.0 or above)
Assume three servers with the following information:

Preparation

You need to deploy nginx (recommended version 1.27.0) on the node1 node for load balancing.

Installation

1. Download Executable File

Scope: All nodes

2. Modify Executable File Permissions

Scope: All nodes

Configuration

Configure WuKongIM

On node1, create configuration file wk.yaml with the following content:
On node2, create configuration file wk.yaml with the following content:
On node3, create configuration file wk.yaml with the following content:

Configure nginx

Create nginx configuration file with the following content:
Remember to restart nginx for the configuration to take effect:

Start or Stop

Start WuKongIM on all nodes:

Port Configuration

External Network Ports

Internal Network Ports (nodes need to access each other)

Make sure to open the required ports in your firewall:

Verification

  1. Access http://119.45.229.172:15172/login, enter any username and password, after login you can chat, indicating successful deployment.
  2. Access http://119.45.229.172:15300/web to enter the management system. The default built-in guest has read-only permissions. If you need operation permissions, please see Authorization Configuration.

Next Steps

Server Configuration

Configure authentication and performance optimization

Monitoring Setup

Set up monitoring and alerting

Single Node Deployment

Learn about single node deployment

API Documentation

Start using WuKongIM API