diff --git a/README.md b/README.md index 3287c08d..16733b89 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,13 @@ $ yarn global add @huolala-tech/page-spy-api $ npm install -g @huolala-tech/page-spy-api ``` -安装完成之后你可以在命令行中直接执行 `page-spy-api` 启动服务。该命令会在运行目录下面生成配置文件 config.json,修改配置文件可以修改运行端口: +安装完成之后你可以在命令行中直接执行 `page-spy-api` 启动服务。部署完成后浏览器访问 `:6752`,页面顶部会出现 `接入 SDK` 菜单,点击菜单查看如何在业务项目中配置并集成。 + +### 如何修改 API 服务配置 + +#### 修改端口 + +命令行中直接执行 `page-spy-api` 命令会在运行目录下面生成配置文件 config.json,修改配置文件可以修改运行端口: ```json { @@ -62,7 +68,27 @@ $ npm install -g @huolala-tech/page-spy-api } ``` -部署完成后浏览器访问 `:6752`,页面顶部会出现 `接入 SDK` 菜单,点击菜单查看如何在业务项目中配置并集成。 +#### 多实例部署(需要升级到 1.5.0 版本以上才可以使用) + +`rpcAddress` 配置是多实例部署配置,其中 ip 和 port 是多个机器 ip 以及 rpc 端口,多个实例通过 rpc 来通信,程序会根据机器 ip 来启动 rpc 服务,所以得保证 ip 不会重复,不然可能会出现消息错乱丢失问题。 + +```json +{ + "port": "6752", + "rpcAddress": [ + { + "ip": "192.168.123.1", + "port": "20008" + }, + { + "ip": "192.168.123.2", + "port": "20008" + } + ] +} +``` + +### 如何修改 API 服务配置 ## 技术支持 diff --git a/README_EN.md b/README_EN.md index dd79de55..3fce0ac5 100644 --- a/README_EN.md +++ b/README_EN.md @@ -52,8 +52,13 @@ $ yarn global add @huolala-tech/page-spy-api $ npm install -g @huolala-tech/page-spy-api ``` -After the download is complete, you can directly execute `page-spy-api` in the command line to start the service. -It will also generate a configuration file called config.json in the running directory, and modifying this file allows you to change the running port. +After the download is complete, you can directly execute `page-spy-api` in the command line to start the service. Once the deployment is successful, you can open the browser and access `:6752`, the `Inject SDK` menu will be at the top, and you can find how to configure and integrate in the business project by click the menu. + +### How to Modify API Service Configuration + +#### Modifying the Port + +Executing the page-spy-api command directly in the command line will generate a configuration file named config.json in the working directory. You can modify the running port by modifying this configuration file: ```json { @@ -61,7 +66,25 @@ It will also generate a configuration file called config.json in the running dir } ``` -Once the deployment is successful, you can open the browser and access `:6752`, the `Inject SDK` menu will be at the top, and you can find how to configure and integrate in the business project by click the menu. +#### Multi-instance Deployment (Requires upgrading to version 1.5.0 or above) + +The rpcAddress configuration is used for multi-instance deployment, where IP and port represent the IP addresses and RPC ports of multiple machines. Multiple instances communicate with each other through RPC, and the program starts the RPC service based on the machine's IP. Therefore, it is important to ensure that IP addresses are unique to avoid potential issues of message confusion or loss. + +```json +{ + "port": "6752", + "rpcAddress": [ + { + "ip": "192.168.123.1", + "port": "20008" + }, + { + "ip": "192.168.123.2", + "port": "20008" + } + ] +} +``` ## Roadmap