mirror of
https://github.com/WuKongIM/WuKongIMDocs
synced 2025-06-03 07:42:48 +00:00
docs: update
This commit is contained in:
parent
eb926fe8e7
commit
d7994fb52a
@ -26,7 +26,7 @@ export const navbar: DefaultTheme.NavItem[] = [
|
||||
{ text: "Flutter", link: "/sdk/flutter" },
|
||||
{ text: "Uniapp", link: "/sdk/uniapp" },
|
||||
{ text: "微信小程序", link: "/sdk/smallprogram" },
|
||||
{ text: "harmonyOS", link: "/sdk/harmonyos" },
|
||||
{ text: "HarmonyOS", link: "/sdk/harmonyos" },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -42,9 +42,9 @@ export const navbar: DefaultTheme.NavItem[] = [
|
||||
// link: "https://gitee.com/WuKongDev/WuKongIM/releases",
|
||||
// },
|
||||
{
|
||||
"text": "v2.0.1 (beta)",
|
||||
"text": "v2 (beta)",
|
||||
items: [
|
||||
{text: "v1.2.5 (stable)", link: "https://v1.githubim.com"},
|
||||
{text: "v1 (stable)", link: "https://v1.githubim.com/guide/guide.html"},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -131,6 +131,7 @@ export const sidebar: DefaultTheme.Sidebar = {
|
||||
{ text: "概述", link: "/sdk/" },
|
||||
{ text: "iOS", link: "/sdk/ios" },
|
||||
{ text: "Android", link: "/sdk/android" },
|
||||
{ text: "Harmonyos", link: "/sdk/harmonyos" },
|
||||
{
|
||||
text: "Javascript",
|
||||
collapsed: true,
|
||||
|
@ -28,6 +28,7 @@ title: 介绍
|
||||
| WuKongIMJSSDK | [Github](https://github.com/WuKongIM/WuKongIMJSSDK) | [Example](https://github.com/WuKongIM/WuKongIMJSSDK/tree/main/examples) | [文档](https://githubim.com/sdk/javascript.html) | WuKongIM的 JS SDK |
|
||||
| WuKongIMFlutterSDK | [Github](https://github.com/WuKongIM/WuKongIMFlutterSDK) | [Example](https://github.com/WuKongIM/WuKongIMFlutterSDK/tree/master/example) |[文档](https://githubim.com/sdk/flutter.html) | WuKongIM的 Flutter SDK |
|
||||
| WuKongIMReactNativeDemo | [Github](https://github.com/wengqianshan/WuKongIMReactNative) | 无 | 无 | WuKongIM的 React Native Demo(由贡献者 [wengqianshan](https://github.com/wengqianshan) 提供) |
|
||||
| WuKongIMHarmonyOSSDK | [Github](https://github.com/WuKongIM/WuKongIMHarmonyOSSDK) | [Example](https://github.com/WuKongIM/WuKongIMHarmonyOSSDK/tree/main/entry) | [文档](https://githubim.com/sdk/harmonyos.html) | WuKongIM的纯血鸿蒙OS SDK |
|
||||
|
||||
有需要加微信群交流:
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
0⃣️ **易用性**
|
||||
|
||||
不依然任何第三方中间件,部署简单,一条命令即可启动。
|
||||
不依赖任何第三方中间件,部署简单,一条命令即可启动。
|
||||
|
||||
采用频道订阅发布的设计理念,容易理解,容易上手。
|
||||
|
||||
|
@ -35,7 +35,7 @@ cd ~/wukongim
|
||||
version: '3.7'
|
||||
services:
|
||||
wukongim: # WuKongIM服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.1-beta-20240715
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.4-beta-20240904
|
||||
environment:
|
||||
- "WK_CLUSTER_NODEID=1004"
|
||||
- "WK_CLUSTER_APIURL=http://10.206.0.6:5001" # 节点内部通信api url地址,这里ip换成自己节点实际node2的内网ip
|
||||
|
@ -12,7 +12,7 @@ WuKongIM集群符合 `2n+1` 原则,n表示宕机数量,比如允许1台机
|
||||
|
||||
## 环境要求
|
||||
|
||||
- 机器数量:3台或以上
|
||||
- 机器数量:4台或以上
|
||||
|
||||
- Linux系统(推荐Ubuntu)(推荐配置 2核4G或4核8G)
|
||||
|
||||
@ -20,14 +20,203 @@ WuKongIM集群符合 `2n+1` 原则,n表示宕机数量,比如允许1台机
|
||||
|
||||
假设三台服务器,信息如下
|
||||
|
||||
| 名称 | 内网IP | 外网IP |
|
||||
| --- | --- | --- |
|
||||
| node1(1001) | 10.206.0.13 | 119.45.229.172 |
|
||||
| node2(1002) | 10.206.0.14 | 129.211.213.76 |
|
||||
| node3(1003) | 10.206.0.8 | 1.13.191.138 |
|
||||
| 角色 | 说明 | 内网IP | 外网IP |
|
||||
| --- | --- | --- | --- |
|
||||
| 负载均衡和监控 | gateway | 10.206.0.2 | 119.45.33.109 |
|
||||
| WuKongIM节点 |node1(ID: 1) | 10.206.0.10 | 146.56.249.208 |
|
||||
| WuKongIM节点 |node2(ID: 2) | 10.206.0.12 | 129.211.171.99 |
|
||||
| WuKongIM节点 |node3(ID: 3) | 10.206.0.5 | 119.45.175.82 |
|
||||
|
||||
|
||||
## 安装
|
||||
## 安装负载均衡和监控
|
||||
|
||||
#### 1. 创建安装目录(`gateway`)
|
||||
|
||||
在`gateway`节点创建目录
|
||||
|
||||
```bash
|
||||
mkdir ~/gateway
|
||||
```
|
||||
|
||||
#### 2. 在安装目录创建docker-compose.yml文件
|
||||
|
||||
在`gateway`节点的安装目录(`~/gateway`)里创建`docker-compose.yml`文件,内容如下:
|
||||
|
||||
```yaml
|
||||
|
||||
version: '3.7'
|
||||
services:
|
||||
prometheus: # 监控服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/prometheus:v2.53.1
|
||||
volumes:
|
||||
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
|
||||
ports:
|
||||
- "9090:9090"
|
||||
nginx: # 负载均衡
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/nginx:1.27.0
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
ports:
|
||||
- "15001:15001"
|
||||
- "15100:15100"
|
||||
- "15200:15200"
|
||||
- "15300:15300"
|
||||
- "15172:15172"
|
||||
|
||||
|
||||
```
|
||||
|
||||
#### 3. 配置负载均衡
|
||||
|
||||
在`gateway`节点的安装目录(`~/gateway`)里创建`nginx.conf`文件,内容如下:
|
||||
|
||||
```nginx
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# api负载均衡
|
||||
upstream wukongimapi {
|
||||
server 10.206.0.10:5001;
|
||||
server 10.206.0.12:5001;
|
||||
server 10.206.0.5:5001;
|
||||
}
|
||||
# demo负载均衡
|
||||
upstream wukongimdemo {
|
||||
server 10.206.0.10:5172;
|
||||
server 10.206.0.12:5172;
|
||||
server 10.206.0.5:5172;
|
||||
}
|
||||
# manager负载均衡
|
||||
upstream wukongimanager {
|
||||
server 10.206.0.10:5300;
|
||||
server 10.206.0.12:5300;
|
||||
server 10.206.0.5:5300;
|
||||
}
|
||||
# ws负载均衡
|
||||
upstream wukongimws {
|
||||
server 10.206.0.10:5200;
|
||||
server 10.206.0.12:5200;
|
||||
server 10.206.0.5:5200;
|
||||
}
|
||||
# http api转发
|
||||
server {
|
||||
listen 15001;
|
||||
location / {
|
||||
proxy_pass http://wukongimapi;
|
||||
proxy_connect_timeout 20s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
# demo
|
||||
server {
|
||||
listen 15172;
|
||||
location / {
|
||||
proxy_pass http://wukongimdemo;
|
||||
proxy_connect_timeout 20s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
location /login {
|
||||
rewrite ^ /chatdemo?apiurl=http://119.45.33.109:15001;
|
||||
proxy_pass http://wukongimdemo;
|
||||
proxy_connect_timeout 20s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
# manager
|
||||
server {
|
||||
listen 15300;
|
||||
location / {
|
||||
proxy_pass http://wukongimanager;
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
# ws
|
||||
server {
|
||||
listen 15200;
|
||||
location / {
|
||||
proxy_pass http://wukongimws;
|
||||
proxy_redirect off;
|
||||
proxy_http_version 1.1;
|
||||
# nginx接收upstream server数据超时, 默认120s, 如果连续的120s内没有收到1个字节, 连接关闭
|
||||
proxy_read_timeout 120s;
|
||||
# nginx发送数据至upstream server超时, 默认120s, 如果连续的120s内没有发送1个字节, 连接关闭
|
||||
proxy_send_timeout 120s;
|
||||
# nginx与upstream server的连接超时时间
|
||||
proxy_connect_timeout 4s;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# tcp
|
||||
stream {
|
||||
# tcp负载均衡
|
||||
upstream wukongimtcp {
|
||||
server 10.206.0.10:5100;
|
||||
server 10.206.0.12:5100;
|
||||
server 10.206.0.5:5100;
|
||||
}
|
||||
server {
|
||||
listen 15100;
|
||||
proxy_connect_timeout 4s;
|
||||
proxy_timeout 120s;
|
||||
proxy_pass wukongimtcp;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### 4. 配置监控
|
||||
|
||||
在`gateway`节点的安装目录(`~/gateway`)里创建`prometheus.yml`文件,内容如下:
|
||||
|
||||
```yaml
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
scrape_configs:
|
||||
- job_name: wukongim1-trace-metrics
|
||||
static_configs:
|
||||
- targets: ['10.206.0.10:5300']
|
||||
labels:
|
||||
id: "1"
|
||||
- job_name: wukongim2-trace-metrics
|
||||
static_configs:
|
||||
- targets: ['10.206.0.12:5300']
|
||||
labels:
|
||||
id: "2"
|
||||
- job_name: wukongim3-trace-metrics
|
||||
static_configs:
|
||||
- targets: ['10.206.0.5:5300']
|
||||
labels:
|
||||
id: "3"
|
||||
|
||||
```
|
||||
|
||||
|
||||
## 安装WuKongIM节点
|
||||
|
||||
#### 1. 创建安装目录(`所有节点`)
|
||||
|
||||
@ -39,8 +228,6 @@ mkdir ~/wukongim
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
#### 2. 在安装目录创建docker-compose.yml文件
|
||||
|
||||
在`node1`节点上的安装目录(`~/wukongim`)里创建`docker-compose.yml`文件,内容如下:
|
||||
@ -49,17 +236,17 @@ mkdir ~/wukongim
|
||||
version: '3.7'
|
||||
services:
|
||||
wukongim: # WuKongIM服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.1-beta-20240715
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.4-beta-20240904
|
||||
environment:
|
||||
- "WK_MODE=release" # release模式
|
||||
- "WK_CLUSTER_NODEID=1001"
|
||||
- "WK_EXTERNAL_IP=119.45.229.172" # 当前节点外网ip
|
||||
- "WK_CLUSTER_APIURL=http://10.206.0.13:5001" # 节点内部通信api url地址,这里ip换成自己节点实际node2的内网ip
|
||||
- "WK_CLUSTER_SERVERADDR=10.206.0.13:11110" # 节点内部通信请求地址
|
||||
- "WK_EXTERNAL_WSADDR=ws://119.45.229.172:15200" # web端访问的ws长连接地址,这里设置负载均衡的地址即可,这样让负载均衡来分配WuKongIM
|
||||
- "WK_EXTERNAL_TCPADDR=119.45.229.172:15100" # app端访问的tcp长连接地址,这里设置负载均衡的地址即可,这样让负载均衡来分配WuKongIM
|
||||
- "WK_TRACE_PROMETHEUSAPIURL=http://10.206.0.13:9090" # 监控地址
|
||||
- "WK_CLUSTER_INITNODES=1001@10.206.0.13 1002@10.206.0.14 1003@10.206.0.8" # 集群节点列表
|
||||
- "WK_CLUSTER_NODEID=1" # 节点id不能大于等于1024
|
||||
- "WK_EXTERNAL_IP=146.56.249.208" # 当前节点外网ip
|
||||
- "WK_CLUSTER_APIURL=http://10.206.0.10:5001" # 节点内部通信api url地址,这里ip换成自己节点实际的内网ip
|
||||
- "WK_CLUSTER_SERVERADDR=10.206.0.10:11110" # 节点内部通信请求地址
|
||||
- "WK_EXTERNAL_WSADDR=ws://119.45.33.109:15200" # web端访问的ws长连接地址,这里设置负载均衡的地址即可,这样让负载均衡来分配WuKongIM节点
|
||||
- "WK_EXTERNAL_TCPADDR=119.45.33.109:15100" # app端访问的tcp长连接地址,这里设置负载均衡的地址即可,这样让负载均衡来分配WuKongIM节点
|
||||
- "WK_TRACE_PROMETHEUSAPIURL=http://10.206.0.2:9090" # 监控内网地址
|
||||
- "WK_CLUSTER_INITNODES=1@10.206.0.10 2@10.206.0.12 3@10.206.0.5" # 集群初始节点列表
|
||||
healthcheck:
|
||||
test: "wget -q -Y off -O /dev/null http://localhost:5001/health > /dev/null 2>&1"
|
||||
interval: 10s
|
||||
@ -75,22 +262,6 @@ services:
|
||||
- 5200:5200 # websocket端口
|
||||
- 5300:5300 # 管理端端口
|
||||
- 5172:5172 # demo端口
|
||||
prometheus: # 监控服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/prometheus:v2.53.1
|
||||
volumes:
|
||||
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
|
||||
ports:
|
||||
- "9090:9090"
|
||||
nginx: # 负载均衡
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/nginx:1.27.0
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
ports:
|
||||
- "15001:5001"
|
||||
- "15100:5100"
|
||||
- "15200:5200"
|
||||
- "15300:5300"
|
||||
- "15172:5172"
|
||||
|
||||
```
|
||||
|
||||
@ -102,17 +273,17 @@ services:
|
||||
version: '3.7'
|
||||
services:
|
||||
wukongim: # WuKongIM服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.1-beta-20240715
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.4-beta-20240904
|
||||
environment:
|
||||
- "WK_MODE=release" # release模式
|
||||
- "WK_CLUSTER_NODEID=1002"
|
||||
- "WK_EXTERNAL_IP=129.211.213.76" # 当前节点外网ip
|
||||
- "WK_CLUSTER_APIURL=http://10.206.0.14:5001" # 节点内部通信api url地址,这里ip换成自己节点实际node2的内网ip
|
||||
- "WK_CLUSTER_SERVERADDR=10.206.0.14:11110" # 节点内部通信请求地址
|
||||
- "WK_EXTERNAL_WSADDR=ws://119.45.229.172:15200" # web端访问的ws长连接地址
|
||||
- "WK_EXTERNAL_TCPADDR=119.45.229.172:15100" # app端访问的tcp长连接地址
|
||||
- "WK_TRACE_PROMETHEUSAPIURL=http://10.206.0.13:9090" # 监控地址
|
||||
- "WK_CLUSTER_INITNODES=1001@10.206.0.13 1002@10.206.0.14 1003@10.206.0.8" # 集群节点列表
|
||||
- "WK_MODE=release"
|
||||
- "WK_CLUSTER_NODEID=2"
|
||||
- "WK_EXTERNAL_IP=129.211.171.99"
|
||||
- "WK_CLUSTER_APIURL=http://10.206.0.12:5001"
|
||||
- "WK_CLUSTER_SERVERADDR=10.206.0.12:11110"
|
||||
- "WK_EXTERNAL_WSADDR=ws://119.45.33.109:15200"
|
||||
- "WK_EXTERNAL_TCPADDR=119.45.33.109:15100"
|
||||
- "WK_TRACE_PROMETHEUSAPIURL=http://10.206.0.2:9090"
|
||||
- "WK_CLUSTER_INITNODES=1@10.206.0.10 2@10.206.0.12 3@10.206.0.5" # 集群节点列表
|
||||
healthcheck:
|
||||
test: "wget -q -Y off -O /dev/null http://localhost:5001/health > /dev/null 2>&1"
|
||||
interval: 10s
|
||||
@ -140,17 +311,17 @@ services:
|
||||
version: '3.7'
|
||||
services:
|
||||
wukongim: # WuKongIM服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.1-beta-20240715
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.4-beta-20240904
|
||||
environment:
|
||||
- "WK_MODE=release" # release模式
|
||||
- "WK_CLUSTER_NODEID=1003"
|
||||
- "WK_EXTERNAL_IP=1.13.191.138" # 当前节点外网ip
|
||||
- "WK_CLUSTER_APIURL=http://10.206.0.8:5001" # 节点内部通信api url地址,这里ip换成自己节点实际node2的内网ip
|
||||
- "WK_CLUSTER_SERVERADDR=10.206.0.8:11110" # 节点内部通信请求地址
|
||||
- "WK_EXTERNAL_WSADDR=ws://119.45.229.172:15200" # web端访问的ws长连接地址
|
||||
- "WK_EXTERNAL_TCPADDR=119.45.229.172:15100" # app端访问的tcp长连接地址
|
||||
- "WK_TRACE_PROMETHEUSAPIURL=http://10.206.0.13:9090" # 监控地址
|
||||
- "WK_CLUSTER_INITNODES=1001@10.206.0.13 1002@10.206.0.14 1003@10.206.0.8" # 集群节点列表
|
||||
- "WK_MODE=release"
|
||||
- "WK_CLUSTER_NODEID=3"
|
||||
- "WK_EXTERNAL_IP=119.45.175.82"
|
||||
- "WK_CLUSTER_APIURL=http://10.206.0.5:5001"
|
||||
- "WK_CLUSTER_SERVERADDR=10.206.0.5:11110"
|
||||
- "WK_EXTERNAL_WSADDR=ws://119.45.33.109:15200"
|
||||
- "WK_EXTERNAL_TCPADDR=119.45.33.109:15100"
|
||||
- "WK_TRACE_PROMETHEUSAPIURL=http://10.206.0.2:9090"
|
||||
- "WK_CLUSTER_INITNODES=1@10.206.0.10 2@10.206.0.12 3@10.206.0.5"
|
||||
healthcheck:
|
||||
test: "wget -q -Y off -O /dev/null http://localhost:5001/health > /dev/null 2>&1"
|
||||
interval: 10s
|
||||
@ -169,168 +340,10 @@ services:
|
||||
|
||||
```
|
||||
|
||||
#### 3. 配置监控(`node1`节点)
|
||||
|
||||
在node1节点上的安装目录(`~/wukongim`)里创建`prometheus.yml`文件,内容如下:
|
||||
|
||||
```yaml
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
scrape_configs:
|
||||
- job_name: wukongim1-trace-metrics
|
||||
static_configs:
|
||||
- targets: ['10.206.0.13:5300']
|
||||
labels:
|
||||
id: "1001"
|
||||
- job_name: wukongim2-trace-metrics
|
||||
static_configs:
|
||||
- targets: ['10.206.0.14:5300']
|
||||
labels:
|
||||
id: "1002"
|
||||
- job_name: wukongim3-trace-metrics
|
||||
static_configs:
|
||||
- targets: ['10.206.0.8:5300']
|
||||
labels:
|
||||
id: "1003"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 4. 配置负载均衡(`node1`节点)
|
||||
|
||||
在node1节点上的安装目录(`~/wukongim`)里创建`nginx.conf`文件,内容如下:
|
||||
|
||||
```nginx
|
||||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
|
||||
# api负载均衡
|
||||
upstream wukongimapi {
|
||||
server 10.206.0.13:5001;
|
||||
server 10.206.0.14:5001;
|
||||
server 10.206.0.8:5001;
|
||||
}
|
||||
# demo负载均衡
|
||||
upstream wukongimdemo {
|
||||
server 10.206.0.13:5172;
|
||||
server 10.206.0.14:5172;
|
||||
server 10.206.0.8:5172;
|
||||
}
|
||||
# manager负载均衡
|
||||
upstream wukongimanager {
|
||||
server 10.206.0.13:5300;
|
||||
server 10.206.0.14:5300;
|
||||
server 10.206.0.8:5300;
|
||||
}
|
||||
# ws负载均衡
|
||||
upstream wukongimws {
|
||||
server 10.206.0.13:5200;
|
||||
server 10.206.0.14:5200;
|
||||
server 10.206.0.8:5200;
|
||||
}
|
||||
# http api转发
|
||||
server {
|
||||
listen 5001;
|
||||
location / {
|
||||
proxy_pass http://wukongimapi;
|
||||
proxy_connect_timeout 20s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
# demo
|
||||
server {
|
||||
listen 5172;
|
||||
location / {
|
||||
proxy_pass http://wukongimdemo;
|
||||
proxy_connect_timeout 20s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
location /login {
|
||||
rewrite ^ /chatdemo?apiurl=http://119.45.229.172:15001;
|
||||
proxy_pass http://wukongimdemo;
|
||||
proxy_connect_timeout 20s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
# manager
|
||||
server {
|
||||
listen 5300;
|
||||
location / {
|
||||
proxy_pass http://wukongimanager;
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
# ws
|
||||
server {
|
||||
listen 5200;
|
||||
location / {
|
||||
proxy_pass http://wukongimws;
|
||||
proxy_redirect off;
|
||||
proxy_http_version 1.1;
|
||||
# nginx接收upstream server数据超时, 默认120s, 如果连续的120s内没有收到1个字节, 连接关闭
|
||||
proxy_read_timeout 120s;
|
||||
# nginx发送数据至upstream server超时, 默认120s, 如果连续的120s内没有发送1个字节, 连接关闭
|
||||
proxy_send_timeout 120s;
|
||||
# nginx与upstream server的连接超时时间
|
||||
proxy_connect_timeout 4s;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# tcp
|
||||
stream {
|
||||
# tcp负载均衡
|
||||
upstream wukongimtcp {
|
||||
server 10.206.0.13:5100;
|
||||
server 10.206.0.14:5100;
|
||||
server 10.206.0.8:5100;
|
||||
}
|
||||
server {
|
||||
listen 5100;
|
||||
proxy_connect_timeout 4s;
|
||||
proxy_timeout 120s;
|
||||
proxy_pass wukongimtcp;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## 启动
|
||||
|
||||
在所有节点下执行如下命令
|
||||
在所有`WuKongIM`节点和`gateway`的安装目录下执行如下命令启动服务
|
||||
|
||||
```bash
|
||||
sudo docker-compose up -d
|
||||
@ -360,6 +373,6 @@ sudo docker-compose up -d
|
||||
|
||||
## 验证
|
||||
|
||||
1. 访问`http://119.45.229.172:15172/login`,随便输入用户名和密码,登录后可以聊天,说明部署成功。
|
||||
1. 访问`http://119.45.33.109:15172/login`,随便输入用户名和密码,登录后可以聊天,说明部署成功。
|
||||
|
||||
2. 访问 ` http://119.45.229.172:15300/web` 可以进入后台管理系统 默认系统内置的guest只有读权限,如果需要操作权限,请看[授权的配置](/server/config/auth) 。
|
||||
2. 访问 ` http://119.45.33.109:15300/web` 可以进入后台管理系统 默认系统内置的guest只有读权限,如果需要操作权限,请看[授权的配置](/server/config/auth) 。
|
@ -46,7 +46,7 @@ cd ~/wukongim
|
||||
version: '3.7'
|
||||
services:
|
||||
wukongim: # WuKongIM服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.1-beta-20240715
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.4-beta-20240904
|
||||
environment:
|
||||
- "WK_MODE=release" # release模式
|
||||
- "WK_CLUSTER_NODEID=1002"
|
||||
|
@ -46,7 +46,7 @@ cd ~/wukongim
|
||||
version: '3.7'
|
||||
services:
|
||||
wukongim: # WuKongIM服务
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.1-beta-20240715
|
||||
image: registry.cn-shanghai.aliyuncs.com/wukongim/wukongim:v2.0.4-beta-20240904
|
||||
environment:
|
||||
- "WK_CLUSTER_NODEID=1001"
|
||||
- "WK_CLUSTER_SERVERADDR=xx.xx.xx.xx:11110" # 节点内部通信请求地址
|
||||
|
@ -22,11 +22,11 @@
|
||||
::: code-group
|
||||
|
||||
``` bash [amd64]
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.1-beta-20240715/wukongim-linux-amd64
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.4-beta-20240904/wukongim-linux-amd64
|
||||
```
|
||||
|
||||
``` bash [arm64]
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.1-beta-20240715/wukongim-linux-arm64
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.4-beta-20240904/wukongim-linux-arm64
|
||||
```
|
||||
|
||||
:::
|
||||
|
@ -39,11 +39,11 @@ WuKongIM集群符合 `2n+1` 原则,n表示宕机数量,比如允许1台机
|
||||
::: code-group
|
||||
|
||||
``` bash [amd64]
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.1-beta-20240715/wukongim-linux-amd64
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.4-beta-20240904/wukongim-linux-amd64
|
||||
```
|
||||
|
||||
``` bash [arm64]
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.1-beta-20240715/wukongim-linux-arm64
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.4-beta-20240904/wukongim-linux-arm64
|
||||
```
|
||||
|
||||
:::
|
||||
|
@ -20,11 +20,11 @@
|
||||
::: code-group
|
||||
|
||||
``` bash [amd64]
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.1-beta-20240715/wukongim-linux-amd64
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.4-beta-20240904/wukongim-linux-amd64
|
||||
```
|
||||
|
||||
``` bash [arm64]
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.1-beta-20240715/wukongim-linux-arm64
|
||||
curl -L -o wukongim https://github.com/WuKongIM/WuKongIM/releases/download/v2.0.4-beta-20240904/wukongim-linux-arm64
|
||||
```
|
||||
|
||||
:::
|
||||
|
@ -19,9 +19,8 @@ order: 200
|
||||
{
|
||||
"channel_id": "xxxx", // 频道的唯一ID,如果是群聊频道,建议使用群聊ID
|
||||
"channel_type": 2, // 频道的类型 1.个人频道 2.群聊频道(个人与个人聊天不需要创建频道,系统将自动创建)
|
||||
"large": 0, // 是否是超大群,0.否 1.是 (一般建议500成员以上设置为超大群,注意:超大群不会维护最近会话数据。)
|
||||
"ban": 0, // 是否封禁此频道,0.否 1.是 (被封后 任何人都不能发消息,包括创建者)
|
||||
"subscribers": [uid1,uid2,...], // 订阅者集合
|
||||
"subscribers": ["uid1","uid2",...], // 订阅者集合
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -19,7 +19,7 @@ whitelistOffOfPerson: true # 是否关闭个人白名单 默认为true表示关
|
||||
ginMode: "release" # gin框架的模式 debug 调试 release 正式 test 测试
|
||||
external: # 公网配置
|
||||
ip: "" # 节点外网IP,客户端能够访问到的IP地址,如果客户端是内网使用,这里也可以填写内网IP
|
||||
tcpAddr: "" # 默认自动获取, 节点的TCP地址 对外公开,APP端长连接通讯 格式: ip:port (支持域名配置)
|
||||
tcpAddr: "" # 默认自动获取, 节点的TCP地址 对外公开,APP端长连接通讯 格式: ip:port
|
||||
wsAddr: "" # 默认自动获取, 节点的wsAdd地址 对外公开 WEB端长连接通讯 格式: ws://ip:port (支持域名配置)
|
||||
wssAddr: "" # 对外的wssAddr地址,也就是客户端真正连接的地址 格式:wss://ip:port (支持域名配置)
|
||||
monitorAddr: "" # 默认自动获取, 节点的monitor地址 对外公开 监控服务 格式: ip:port
|
||||
|
Loading…
x
Reference in New Issue
Block a user