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:
Name
Internal IP
External IP
Description
node1(1001)
192.168.1.10
221.123.68.10
Master node (originally deployed single node)
node2(1002)
192.168.1.20
221.123.68.20
New node to be added
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 the node2 node. The process is the same as single node mode, so it won’t be repeated here. For details:Refer to the WuKongIM deployment tutorial Single Node Mode.
Modify the configuration file wk.yaml on node2, complete content as follows:
Copy
mode: "release"external: # Public network configuration ip: "221.123.68.20" # Node external IP, IP address that clients can access tcpAddr: "221.123.68.10:15100" # Long connection address for app access, note this is the load balancer server's IP and port, not local wsAddr: "ws://221.123.68.10:15200" # Long connection address for web access, note this is the load balancer server's IP and port, not localcluster: nodeId: 1002 # Node ID apiUrl: "http://192.168.1.20:5001" # Current node's internal API address serverAddr: "192.168.1.20:11110" # Current node's internal distributed communication address seed: "1001@192.168.1.10:11110" # Seed node, original node's address
Modify the configuration file wk.yaml on node1, complete content as follows:
Copy
mode: "release"external: # Public network configuration ip: "221.123.68.10" # Node external IP, IP address that clients can access tcpAddr: "221.123.68.10:15100" # Long connection address for app access, note this is the load balancer server's IP and port wsAddr: "ws://221.123.68.10:15200" # Long connection address for web access, note this is the load balancer server's IP and portcluster: nodeId: 1001 # Node ID apiUrl: "http://192.168.1.10:5001" # Current node's internal API address serverAddr: "192.168.1.10:11110" # Current node's internal distributed communication address
Nodes originally deployed using multi-node mode 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:
Create configuration file wk.yaml on node4 with the following content:
Copy
mode: "release"external: # Public network configuration ip: "222.222.222.4" # Node external IP, IP address that clients can access tcpAddr: "222.222.222.1:15100" # Long connection address for app access, note this is the load balancer server's IP and port, not local wsAddr: "ws://222.222.222.1:15200" # Long connection address for web access, note this is the load balancer server's IP and port, not localcluster: nodeId: 1004 # Node ID apiUrl: "http://192.168.12.4:5001" # Current node's internal API address serverAddr: "192.168.12.4:11110" # Current node's internal distributed communication address seed: "1001@192.168.12.1:11100" # Seed node, any node in original cluster can be seed node, here use node1 as seed