Skip to content

Commit 817ddd0

Browse files
authored
[fit] 增加 nacos 插件的 readme 文件。 (#252)
1 parent 826ee21 commit 817ddd0

File tree

1 file changed

+88
-0
lines changed
  • framework/fit/java/fit-builtin/plugins/fit-service-coordination-nacos

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# FIT Service Coordination Nacos 插件
2+
3+
## 简介
4+
5+
FIT Service Coordination Nacos 插件是 FIT Framework 的服务协调插件,提供基于 Nacos 的服务注册与发现功能。该插件将 FIT 框架与 Alibaba Nacos 注册中心集成。
6+
7+
## 快速开始
8+
9+
### 1. Nacos 部署
10+
11+
#### 本地安装部署
12+
13+
1. 下载 Nacos Server
14+
15+
```bash
16+
# 下载 Nacos 2.3.0
17+
wget https://github.com/alibaba/nacos/releases/download/2.3.0/nacos-server-2.3.0.tar.gz
18+
19+
# 解压
20+
tar -xvf nacos-server-2.3.0.tar.gz
21+
cd nacos/bin
22+
```
23+
24+
2. 启动 Nacos
25+
26+
```bash
27+
# Linux/Mac
28+
sh startup.sh -m standalone
29+
30+
# Windows
31+
startup.cmd -m standalone
32+
```
33+
34+
访问控制台:http://localhost:8848/nacos (默认用户名/密码:nacos/nacos)
35+
36+
### 2. 插件配置
37+
38+
#### Maven 依赖
39+
40+
在你的 FIT 项目 `pom.xml` 中添加插件依赖:
41+
42+
```xml
43+
<dependency>
44+
<groupId>org.fitframework.plugin</groupId>
45+
<artifactId>fit-service-coordination-nacos</artifactId>
46+
</dependency>
47+
```
48+
49+
#### 配置文件
50+
51+
`application.yml` 中配置 Nacos 连接信息:
52+
53+
```yaml
54+
# Matata 服务配置
55+
matata:
56+
registry:
57+
# Nacos 服务器地址
58+
host: 'localhost'
59+
port: 8848
60+
# 注册中心连接模式
61+
mode: 'PROXY'
62+
# 环境命名空间
63+
environment: local
64+
```
65+
66+
## 配置参数说明
67+
68+
### 基础配置
69+
70+
| 参数 | 类型 | 必需 | 默认值 | 说明 |
71+
| ----------------------------- | ------- | ---- | ------ | ---------------------------------------------------------------------- |
72+
| `matata.registry.host` | String | 是 | - | Nacos 服务器地址 |
73+
| `matata.registry.port` | Integer | 是 | - | Nacos 服务器端口 |
74+
| `matata.registry.environment` | String | 否 | - | 命名空间,用于环境隔离 |
75+
| `matata.registry.mode` | String | 是 | - | 注册中心连接模式,这里使用 PROXY 表示使用本地插件代理与 nacos 连接通信 |
76+
77+
### Nacos 特定配置
78+
79+
| 参数 | 类型 | 必需 | 默认值 | 说明 |
80+
| ----------------------------------------- | ------- | ---- | ------ | ---------------- |
81+
| `matata.registry.nacos.username` | String | 否 | - | Nacos 用户名 |
82+
| `matata.registry.nacos.password` | String | 否 | - | Nacos 密码 |
83+
| `matata.registry.nacos.accessKey` | String | 否 | - | 访问密钥 |
84+
| `matata.registry.nacos.secretKey` | String | 否 | - | 秘密密钥 |
85+
| `matata.registry.nacos.weight` | Float | 否 | 1.0 | 服务权重 |
86+
| `matata.registry.nacos.isEphemeral` | Boolean | 否 | true | 是否为临时实例 |
87+
| `matata.registry.nacos.heartbeatInterval` | Long | 否 | 5000 | 心跳间隔(毫秒) |
88+
| `matata.registry.nacos.heartbeatTimeout` | Long | 否 | 15000 | 心跳超时(毫秒) |

0 commit comments

Comments
 (0)