Single Node Mode Scaling
Description
The previously deployed single node mode now needs to be scaled to multiple servers. Here we use two servers as an example to explain how to scale. Assume there are two servers with the following information:
node1 is the originally deployed single node, now we want to scale to two servers, node2 is the newly added node.
The following file contents are set with assumed server IPs, just replace the corresponding IPs with your own.
Deploy WuKongIM on node2
1. Create Installation Directory
Create directory:2. Create docker-compose.yml File in Installation Directory
Content as follows (note to replace corresponding IPs with your own):Adjust node1’s Original docker-compose.yml Configuration
Add the following content under thewukongim1 service:
Deploy Load Balancer nginx
Add the following content to thedocker-compose.yml file on node1:
nginx.conf file in node1’s installation directory with the following content:
Include New Node in Monitoring prometheus.yml
Modify theprometheus.yml file on node1, complete content as follows:
Start and Stop
Execute the following commands in each node’s installation directory:Start
Stop
Port Configuration
External Network Ports
Internal Network Ports (nodes need to access each other)
Verification
Log into the management system, in node management you can see if the newly added node’s status is “Joined”. If so, scaling is successful.Multi-Node Scaling Mode
Description
Nodes originally deployed using multi-node deployment can expand cluster size by adding nodes. This document describes how to expand cluster size by adding nodes. Assume the newly added node information is as follows:Deploy WuKongIM on node4
1. Create Installation Directory
Create directory:2. Create docker-compose.yml File in Installation Directory
3. Configure Monitoring
In the originalnode1’s installation directory (~/wukongim), add the following content under scrape_configs in the prometheus.yml file:
4. Configure Load Balancer
In thegateway node’s installation directory (~/gateway), add the following content under all upstream sections in the nginx.conf file:
5. Restart Gateway
In the gateway node, enter the installation directory (~/gateway) and execute the following command:
6. Start node4
Innode4, enter the installation directory (~/wukongim) and execute the following command:
Verification
Log into the management system, in node management you can see if the newly added node’s status is “Joined”. If so, scaling is successful.Best Practices
Pre-scaling Checklist
- Resource Planning: Ensure new nodes have adequate CPU, memory, and storage
- Network Connectivity: Verify all nodes can communicate with each other
- Backup: Create backup of existing cluster before scaling
- Monitoring: Ensure monitoring is configured for new nodes
Post-scaling Verification
- Cluster Status: Check all nodes are in “Joined” state
- Load Distribution: Verify traffic is distributed across all nodes
- Performance: Monitor system performance after scaling
- Data Consistency: Verify data replication is working correctly
Troubleshooting
Common Issues
New node cannot join cluster:Next Steps
Performance Monitoring
Set up comprehensive monitoring for scaled cluster
Cluster Configuration
Advanced cluster configuration options
Best Practices
Backup strategies and cluster best practices
Load Testing
Test cluster performance under load

