From 8f7c3b5a7cd83fb632f337bf686264526388bab6 Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Mon, 11 Dec 2023 18:30:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4nacos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 20896519c2664bfc3b1f8a9a7a694134a0b09848 --- api/etc/pcm.yaml | 114 +++++++++++++++++++++++++++++++++++++------ api/pcm.go | 21 +------- rpc/etc/pcmcore.yaml | 38 +++++++++------ rpc/pcmcore.go | 22 +-------- 4 files changed, 124 insertions(+), 71 deletions(-) diff --git a/api/etc/pcm.yaml b/api/etc/pcm.yaml index 84d70409..a8ff97f9 100644 --- a/api/etc/pcm.yaml +++ b/api/etc/pcm.yaml @@ -1,15 +1,99 @@ -NacosConfig: - DataId: pcm-core-api.yaml - Group: DEFAULT_GROUP - ServerConfigs: - # - IpAddr: 127.0.0.1 - # Port: 8848 - - IpAddr: nacos.jcce.dev - Port: 8848 - ClientConfig: - NamespaceId: test - TimeoutMs: 5000 - NotLoadCacheAtStart: true - LogDir: - CacheDir: - LogLevel: debug \ No newline at end of file +Name: pcm.core.api +Host: 0.0.0.0 +Port: 8999 + +Timeout: 50000 + +DB: + DataSource: root:uJpLd6u-J?HC1@(119.45.100.73:3306)/pcm?parseTime=true&loc=Local + +Redis: + Host: 10.206.0.12:6379 + Pass: redisPW123 + +Cache: + - Host: 10.206.0.12:6379 + Pass: redisPW123 + +# k8s rpc +K8sNativeConf: + # target: nacos://10.206.0.12:8848/pcm.kubenative.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + Endpoints: + - pcm-participant-kubernetes-service:2003 + NonBlock: true + +#rpc +THRpcConf: + target: nacos://10.206.0.12:8848/pcm.th.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + +#rpc +ModelArtsRpcConf: + target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + +#rpc +ModelArtsImgRpcConf: + target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + +#rpc +ACRpcConf: + target: nacos://10.206.0.12:8848/pcm.ac.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +#rpc +CephRpcConf: + target: nacos://10.206.0.12:8848/pcm.ceph.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 50000 + +OctopusRpcConf: + target: nacos://10.206.0.12:8848/pcm.octopus.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +OpenstackRpcConf: + target: nacos://10.206.0.12:8848/pcm.openstack.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +# core rpc +PcmCoreRpcConf: + target: nacos://10.206.0.12:8848/pcm.core.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +NexusUrl: http://10.101.15.175:8081 + +JccScheduleUrl: http://jcce-schedule-service:8082 + + +MinioConf: + Secret: minio_xnu122@_ + AccessKey: minioadmin + Endpoint: http://121.89.220.60:9000 + +RegistryConf: + Username: jointcloudNudt + Password: Nudt@123 + +SnowflakeConf: + MachineId: 1 \ No newline at end of file diff --git a/api/pcm.go b/api/pcm.go index 463f2a42..2b499b8f 100644 --- a/api/pcm.go +++ b/api/pcm.go @@ -26,7 +26,6 @@ import ( "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/mqs" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" - commonConfig "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/helper/nacos" ) var configFile = flag.String("f", "api/etc/pcm.yaml", "the config file") @@ -34,26 +33,8 @@ var configFile = flag.String("f", "api/etc/pcm.yaml", "the config file") func main() { flag.Parse() - var bootstrapConfig commonConfig.BootstrapConfig - conf.MustLoad(*configFile, &bootstrapConfig) - - //解析业务配置 var c config.Config - - nacosConfig := bootstrapConfig.NacosConfig - serviceConfigContent := nacosConfig.InitConfig(func(data string) { - err := conf.LoadFromYamlBytes([]byte(data), &c) - if err != nil { - panic(err) - } - }) - err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c) - if err != nil { - panic(err) - } - - // 注册到nacos - nacosConfig.DiscoveryRest(&c.RestConf) + conf.MustLoad(*configFile, &c) serviceGroup := service.NewServiceGroup() defer serviceGroup.Stop() diff --git a/rpc/etc/pcmcore.yaml b/rpc/etc/pcmcore.yaml index 65c58022..7be42380 100644 --- a/rpc/etc/pcmcore.yaml +++ b/rpc/etc/pcmcore.yaml @@ -1,15 +1,23 @@ -NacosConfig: - DataId: pcm-core-rpc.yaml - Group: DEFAULT_GROUP - ServerConfigs: -# - IpAddr: 127.0.0.1 -# Port: 8848 - - IpAddr: nacos.jcce.dev - Port: 8848 - ClientConfig: - NamespaceId: test - TimeoutMs: 5000 - NotLoadCacheAtStart: true - LogDir: - CacheDir: - LogLevel: info \ No newline at end of file +Name: pcm.core.rpc +ListenOn: 0.0.0.0:2004 + +Timeout: 15000 # 15s,设置rpc服务的响应的超时时间,若超过15s还未返回则结束请求 + +DB: + DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true + +#链路追踪 +# Telemetry: +# Name: pcm-core-rpc +# Endpoint: http://jaeger-collector.observability:14268/api/traces +# Sampler: 1.0 +# Batcher: jaeger + +SnowflakeConf: + MachineId: 1 + +RedisConf: + Host: 10.206.0.7:6379 + Pass: redisPW123 + Type: node + Tls: false \ No newline at end of file diff --git a/rpc/pcmcore.go b/rpc/pcmcore.go index 3819616c..a36f0d95 100644 --- a/rpc/pcmcore.go +++ b/rpc/pcmcore.go @@ -21,7 +21,6 @@ import ( "github.com/zeromicro/go-zero/core/service" "github.com/zeromicro/go-zero/zrpc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/helper/interceptor/rpcserver" - commonConfig "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/helper/nacos" "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/config" participantserviceServer "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/server/participantservice" pcmcoreServer "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/server/pcmcore" @@ -37,27 +36,8 @@ func main() { flag.Parse() - var bootstrapConfig commonConfig.BootstrapConfig - conf.MustLoad(*configFile, &bootstrapConfig) - - //解析业务配置 var c config.Config - nacosConfig := bootstrapConfig.NacosConfig - - serviceConfigContent := nacosConfig.InitConfig(func(data string) { - err := conf.LoadFromYamlBytes([]byte(data), &c) - if err != nil { - panic(err) - } - }) - err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c) - if err != nil { - panic(err) - } - // start log component - logx.MustSetup(c.LogConf) - // 注册到nacos - nacosConfig.Discovery(&c.RpcServerConf) + conf.MustLoad(*configFile, &c) ctx := svc.NewServiceContext(c)