From 4adce7d5362b3165a93539ac32b1d10e3788d041 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 30 May 2022 10:54:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=B5=8B=E8=AF=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 17 +++++++++++++++-- bin/conf/{gate.yaml => gate_1.yaml} | 0 bin/conf/gate_2.yaml | 22 ++++++++++++++++++++++ bin/log/gate_1.log | 14 +++++++------- 4 files changed, 44 insertions(+), 9 deletions(-) rename bin/conf/{gate.yaml => gate_1.yaml} (100%) create mode 100644 bin/conf/gate_2.yaml diff --git a/.vscode/launch.json b/.vscode/launch.json index cdeb3832b..868a03586 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,12 +5,25 @@ "version": "0.2.0", "configurations": [ { - "name": "gate", + "name": "gate_1", "type": "go", "request": "launch", "mode": "debug", "program": "${workspaceFolder}/services/gate", //配置Go项目启动文件路径,即main函数所在的.go文件的路径,${workspaceRoot}代表项目的根目录,也就是 /bin /pkg /src这三个文件夹所在的目录 - "args": ["-conf","./conf/gate.yaml"], + "args": ["-conf","./conf/gate_1.yaml"], + "cwd": "${workspaceFolder}/bin", //设置工作目录 + "internalConsoleOptions": "openOnSessionStart", + "output": "${workspaceFolder}/bin/vsdebug_gate", //设置vscode调试时生成文件的路径 + "showGlobalVariables": true, + "env": {}, //可以用来配置调试启动时所用的环境变量参数,比如gopath临时设置为某个参数就可以在这里指定,如果有多个gopath,用英文冒号:来连接多个gopath + }, + { + "name": "gate_2", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/services/gate", //配置Go项目启动文件路径,即main函数所在的.go文件的路径,${workspaceRoot}代表项目的根目录,也就是 /bin /pkg /src这三个文件夹所在的目录 + "args": ["-conf","./conf/gate_2.yaml"], "cwd": "${workspaceFolder}/bin", //设置工作目录 "internalConsoleOptions": "openOnSessionStart", "output": "${workspaceFolder}/bin/vsdebug_gate", //设置vscode调试时生成文件的路径 diff --git a/bin/conf/gate.yaml b/bin/conf/gate_1.yaml similarity index 100% rename from bin/conf/gate.yaml rename to bin/conf/gate_1.yaml diff --git a/bin/conf/gate_2.yaml b/bin/conf/gate_2.yaml new file mode 100644 index 000000000..d4252d85d --- /dev/null +++ b/bin/conf/gate_2.yaml @@ -0,0 +1,22 @@ +id : "gate_1" #服务的唯一id 在集群服务下不能重复即可 建议配置文件名与服务id一致 +ip : "172.0.0.1" #运行主机Ip 集群通信中 按ip节点通行的查询字段 此字段可以注释掉 注释后取当前运行主机公网ip地址 +tag : "demo" #服务集群标签 相同标签 且sys.registry 和 sys.rpc 配置一致 即可互相发现和通信 +type : "console" #服务类型 相同服务类型相同 如 多个login 服务 相同服务多开 服务类型一致 +category : "BusinessService" #服务类别 例如 网关服务器 或者 游戏服务器 以及普通业务服务器 +version : 1.0 #服务版本 多服务器相同的服务类型 高版本比低版本拥有更高的访问优先级 使用场景 热更新机制 + +#系统配置 +sys: + log: + FileName: "./log/gate_1.log" #日志文件存放地址 + Loglevel: 0 #日志文件输出级别 + LogMaxSize: 128 #日志文件最大Size + LogMaxAge: 7 #日志文件最多保留天数 + cache: + Redis_Addr: ["10.0.0.9:9001","10.0.0.9:9002","10.0.0.9:9003","10.0.1.45:9004","10.0.1.45:9005","10.0.1.45:9006"] + Redis_Password: "" + +#模块配置 +modules: + SM_GateModule: + WSAddr: ":7891" diff --git a/bin/log/gate_1.log b/bin/log/gate_1.log index cca0fef39..f2b92fed8 100644 --- a/bin/log/gate_1.log +++ b/bin/log/gate_1.log @@ -1,7 +1,7 @@ -2022/05/30 10:33:39.990 info single/service.go:44 init sys.log success! -2022/05/30 10:33:40.007 info single/service.go:49 init sys.event success! -2022/05/30 10:33:42.708 info services/servicebase.go:20 init sys.cache success! -2022/05/30 10:33:42.708 info cbase/servicebase.go:58 服务[gate_1] 初始化完成! -2022/05/30 10:33:42.708 info cbase/servicebase.go:80 服务[gate_1:1.0.0.0] 启动完成! -2022/05/30 10:33:42.708 debug gate/module.go:32 Module.Gate Init -2022/05/30 10:33:42.708 debug gate/module.go:38 Module.Gate Start +2022/05/30 10:36:15.600 info single/service.go:44 init sys.log success! +2022/05/30 10:36:15.617 info single/service.go:49 init sys.event success! +2022/05/30 10:36:15.622 info services/servicebase.go:20 init sys.cache success! +2022/05/30 10:36:15.622 info cbase/servicebase.go:58 服务[gate_1] 初始化完成! +2022/05/30 10:36:15.622 info cbase/servicebase.go:80 服务[gate_1:1.0.0.0] 启动完成! +2022/05/30 10:36:15.622 debug gate/module.go:32 Module.Gate Init +2022/05/30 10:36:15.622 debug gate/module.go:38 Module.Gate Start