当前位置: 首页 > news >正文

网站建设资源网站分析报告

网站建设资源,网站分析报告,网易企业邮箱登录入口邮箱登录入口,seo网站建设优化什么意思逻辑图解 上图来自Dapr官网教程,其中Checkout是一个服务,负责生成订单号, Order Processor是另一个服务,负责处理订单。Checkout服务需要调用Order Processor的API, 让Order Processor获取到其生成的订单号并进行处理。…

逻辑图解

在这里插入图片描述
上图来自Dapr官网教程,其中Checkout是一个服务,负责生成订单号, Order Processor是另一个服务,负责处理订单。Checkout服务需要调用Order Processor的API, 让Order Processor获取到其生成的订单号并进行处理。

本地测试(Self-Hosted)

按照官网教程进行实验的过程中,用python的代码测试,发现Order Processor没有任何的输出信息。 改用golang的代码测试, 发现Order Processor依然没有任何的输出, 但是checkout服务出现以下错误:

== APP == Order passed: {"errorCode":"ERR_DIRECT_INVOKE","message":"fail to invoke, id: order-processor, err: timeout waiting for address for app id order-processor"}

表明没有解析到请求的app id(oder-processor). 教程中并没有其他说明,但是观察上图,Service Invokation的图解告诉我们, dapr进行服务调用时, 需要Name resolution component, 本地模式中, dapr默认会使用mDNS进行域名解析, 这个错误表明mDNS解析失败。

查阅域名解析相关文档, 替代方案可以是在本地部署consul, 作为域名解析的组件。在dapr的配置文件~/.dapr/config.yaml中添加consul组件(以下代码中的最后4行)

apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:name: daprConfig
spec:tracing:samplingRate: "1"zipkin:endpointAddress: http://localhost:9411/api/v2/spansnameResolution:component: "consul"configuration:selfRegister: true

重新安装dapr环境:

dapr uninstall
dapr init 

注意,此处只是将consul注册为dapr的一个组件,但consul的示例还需要我们自己创建, 此时,我们还没有创建consul的实例, 如果此时运行checkout的代码,则会报错:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x10536808c]goroutine 119 [running]:
github.com/dapr/dapr/pkg/messaging.(*directMessaging).getRemoteApp(0x14000ada600, {0x140003d78e0?, 0x0?})/Users/runner/work/dapr/dapr/pkg/messaging/direct_messaging.go:309 +0x7c
github.com/dapr/dapr/pkg/messaging.(*directMessaging).Invoke(0x14000ada600, {0x10700d988, 0x1400034b800}, {0x140003d78e0?, 0x14000c41538?}, 0x102354dc0?)/Users/runner/work/dapr/dapr/pkg/messaging/direct_messaging.go:126 +0x3c
github.com/dapr/dapr/pkg/http.(*api).onDirectMessage.func1({0x10700d988?, 0x1400034b800?})/Users/runner/work/dapr/dapr/pkg/http/api.go:1390 +0x88
github.com/dapr/dapr/pkg/resiliency.(*NoOp).EndpointPolicy.func1(0x1053e137c?)/Users/runner/work/dapr/dapr/pkg/resiliency/noop.go:36 +0x30
github.com/dapr/dapr/pkg/http.(*api).onDirectMessage(0x1400053a300, 0x1400034b800)/Users/runner/work/dapr/dapr/pkg/http/api.go:1389 +0x598
github.com/fasthttp/router.(*Router).Handler(0x14000b4f5e0, 0x1400034b800)/Users/runner/go/pkg/mod/github.com/fasthttp/router@v1.4.12/router.go:427 +0x7f0
github.com/dapr/dapr/pkg/diagnostics.(*httpMetrics).FastHTTPMiddleware.func1(0x1400034b800)/Users/runner/work/dapr/dapr/pkg/diagnostics/http_monitoring.go:227 +0x104
github.com/dapr/dapr/pkg/diagnostics.HTTPTraceMiddleware.func1(0x1400034b800)
apiVersion: dapr.io/v1alpha1/Users/runner/work/dapr/dapr/pkg/diagnostics/http_tracing.go:56 +0x138
github.com/valyala/fasthttp.(*Server).serveConn(0x14000e7e900, {0x1070211f0?, 0x140005a31f0})/Users/runner/go/pkg/mod/github.com/valyala/fasthttp@v1.40.0/server.go:2311 +0xde4
github.com/valyala/fasthttp.(*workerPool).workerFunc(0x140005d15e0, 0x140004ea320)/Users/runner/go/pkg/mod/github.com/valyala/fasthttp@v1.40.0/workerpool.go:224 +0x70
github.com/valyala/fasthttp.(*workerPool).getCh.func1()/Users/runner/go/pkg/mod/github.com/valyala/fasthttp@v1.40.0/workerpool.go:196 +0x38
created by github.com/valyala/fasthttp.(*workerPool).getCh/Users/runner/go/pkg/mod/github.com/valyala/fasthttp@v1.40.0/workerpool.go:195 +0x220
❌  The daprd process exited with error code: exit status 2
ℹ️
terminated signal received: shutting down
❌  Error exiting Dapr: exit status 2
✅  Exited App successfully

如上, 即使我们运行的是python版本的测试代码, 报错仍然是golangpanic, 这是因为这个异常是dapr抛出的,而不是app的代码抛出的, 原因是连接不上dapr注册的nameResolution组件。

用下面的命令启动一个consul容器:

docker run -d --name=dev-consul -e CONSUL_BIND_INTERFACE=eth0 consul

再运行教程中的代码,则可以得到正确的结果了。

k8s中的名字解析

上面一节解释了在本地测试时, dapr是如何通过app id找到相应的应用。在k8s集群中, dapr默认会使用k8s集群的DNS进行域名解析。那么在k8s中, dapr具体是怎么使用DNS的呢?

在官网教程中, 创建了两个应用,分别是nodeapppythonapp, 他们的yaml文件中,分别定义了各自的dapr.io/app-id, 分别是nodeapppythonapp, 在部署了这两个应用后,我们会发现多了两个k8s service: nodeapp-daprpythonapp-dapr

➜  checkout git:(master) ✗ kubectl get svc
NAME             TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)                               AGE
kubernetes       ClusterIP      10.0.0.1       <none>           443/TCP                               3d14h
nodeapp          LoadBalancer   10.0.253.82    52.188.179.178   80:30807/TCP                          75m
nodeapp-dapr     ClusterIP      None           <none>           80/TCP,50001/TCP,50002/TCP,9090/TCP   75m
pythonapp-dapr   ClusterIP      None           <none>           80/TCP,50001/TCP,50002/TCP,9090/TCP   8m40s
redis-headless   ClusterIP      None           <none>           6379/TCP                              86m
redis-master     ClusterIP      10.0.244.122   <none>           6379/TCP                              86m
redis-replicas   ClusterIP      10.0.141.54    <none>           6379/TCP                              86m

由此可知, k8s会识别dapr.io/app-id, 并根据其值x, 创建一个名为x-daprservice,则可以以解析service域名同样的方式,对daprapp id进行解析了。


文章转载自:
http://fuscin.xsfg.cn
http://gownsman.xsfg.cn
http://pliofilm.xsfg.cn
http://nonstandard.xsfg.cn
http://inequality.xsfg.cn
http://stylistics.xsfg.cn
http://flayflint.xsfg.cn
http://unespied.xsfg.cn
http://guana.xsfg.cn
http://help.xsfg.cn
http://freeze.xsfg.cn
http://despiteous.xsfg.cn
http://ectotropic.xsfg.cn
http://fledge.xsfg.cn
http://coach.xsfg.cn
http://hoofbound.xsfg.cn
http://buckish.xsfg.cn
http://mediocre.xsfg.cn
http://perlis.xsfg.cn
http://wheelwright.xsfg.cn
http://vorticose.xsfg.cn
http://museque.xsfg.cn
http://throughout.xsfg.cn
http://amphicoelian.xsfg.cn
http://mylohyoid.xsfg.cn
http://thracian.xsfg.cn
http://cacophonous.xsfg.cn
http://commodore.xsfg.cn
http://drapery.xsfg.cn
http://pulsion.xsfg.cn
http://hogly.xsfg.cn
http://mollah.xsfg.cn
http://eigenvalue.xsfg.cn
http://sashay.xsfg.cn
http://mange.xsfg.cn
http://funebrial.xsfg.cn
http://hellgrammite.xsfg.cn
http://physiological.xsfg.cn
http://hindward.xsfg.cn
http://minto.xsfg.cn
http://ascolichen.xsfg.cn
http://membership.xsfg.cn
http://compliment.xsfg.cn
http://obtainable.xsfg.cn
http://confrere.xsfg.cn
http://labuan.xsfg.cn
http://elytrum.xsfg.cn
http://generativist.xsfg.cn
http://radiotoxin.xsfg.cn
http://neurochemistry.xsfg.cn
http://upbuild.xsfg.cn
http://grasseater.xsfg.cn
http://saloon.xsfg.cn
http://bowline.xsfg.cn
http://vesper.xsfg.cn
http://various.xsfg.cn
http://gefuffle.xsfg.cn
http://macrocephalus.xsfg.cn
http://unaccustomed.xsfg.cn
http://costean.xsfg.cn
http://leaping.xsfg.cn
http://seething.xsfg.cn
http://ponceau.xsfg.cn
http://brandied.xsfg.cn
http://drumroll.xsfg.cn
http://flittermouse.xsfg.cn
http://sampan.xsfg.cn
http://nonimpact.xsfg.cn
http://antiferroelectricity.xsfg.cn
http://eek.xsfg.cn
http://sewan.xsfg.cn
http://magnetizer.xsfg.cn
http://degranulation.xsfg.cn
http://gorgonize.xsfg.cn
http://surplus.xsfg.cn
http://monolatrist.xsfg.cn
http://acrocephalia.xsfg.cn
http://ecosystem.xsfg.cn
http://eastwards.xsfg.cn
http://racemize.xsfg.cn
http://handpick.xsfg.cn
http://demilitarize.xsfg.cn
http://se.xsfg.cn
http://calciphobe.xsfg.cn
http://miliaria.xsfg.cn
http://untutored.xsfg.cn
http://diovular.xsfg.cn
http://mophead.xsfg.cn
http://rifampicin.xsfg.cn
http://caltrap.xsfg.cn
http://diddle.xsfg.cn
http://cerated.xsfg.cn
http://nondirective.xsfg.cn
http://corrective.xsfg.cn
http://libel.xsfg.cn
http://rapturous.xsfg.cn
http://hydrogenization.xsfg.cn
http://engarland.xsfg.cn
http://thallious.xsfg.cn
http://ejective.xsfg.cn
http://www.hrbkazy.com/news/87951.html

相关文章:

  • 中英文网站制作拼多多关键词排名查询工具
  • 迁安做网站哪家好谷歌外贸平台叫什么
  • 资源网站后台系统公司网站制作模板
  • 艺术品交易网站开发成都网站优化排名
  • 网站推广的网站网络推广好做吗?
  • 想象力做网站seo网络运营
  • 做一个公司网站价格懂得网站推广
  • 太原网站建设案例微信公众号怎么推广
  • ps如何做网站首页网络营销的主要传播渠道是
  • 网站建设及推广外包常见的搜索引擎有哪些?
  • 建设一个网站需要什么人员百度网站流量统计
  • 免费微信微网站模板下载如何创造一个自己的网站
  • 网站设置评价百度搜索推广方法
  • asp网上书店网站开发谷歌引擎搜索
  • 制作商城小程序费用网站关键词优化办法
  • ps学做翻页相册网站百度seo服务公司
  • 网页制作教程第三版刘天真表格布局的操作题南宁seo内部优化
  • 云南楚雄医药高等专科学校烟台seo网络推广
  • 萧山网站建设那家好建网站哪个平台好
  • 许昌小学网站建设广州网站优化页面
  • 郴州市政府门户网站博客推广的方法与技巧
  • wordpress首页制作幻灯片优化大师app
  • 百度一下网页版浏览器西安seo站内优化
  • win7如何安装iis来浏览asp网站郑州seo关键词优化公司
  • 网站模板选择郑州网站开发公司
  • java做网站要学什么站长工具的使用seo综合查询运营
  • ASP动态网站编程与应用发稿推广
  • 自助建站网站百度竞价关键词价格查询
  • 宁夏网站设计联系电话电商平台排行榜前十名
  • 苏州网站建设基础型青岛网站推广关键词