本指南通过使用Mesh开发一个名为weathermapweb的服务,并将其接入到weathermap应用,以此介绍Mesh的使用流程。Mesh全称为Service Mesh,中文名为服务网格,是一种基础设施层服务。2快速体验CSE微服务能力
工具/原料
1
weathermap应用已经在正常运行。
2
已获取AK/SK。
环境准备
1
访问https://registry.cn-north-1.huaweicloud.com/swr/v2/domains/hwcse/namespaces/hwcse/repositories/cse-tools/packages/Mesher/versions/1.0.5/file_paths/mesher-1.0.5-windows64.tar.gz下载mesher安装包。
2
解压mesher安装包。
修改配置
1
配置服务监听和服务发布地址。打开conf/chassis.yaml文件,修改地址。
2
配置AK/SK。打开conf/auth.yaml文件进行配置。
3
修改conf目录下的microservice.yaml文件,用于描述微服务信息。
配置验证
1
启动Mesh的start.bat。
2
进入前台“应用开发 > 微服务管理 > 服务目录”页面查看,可以看到名为weathermapweb微服务,其“所属应用”为weathermap 。
接入应用
1
停止正在运行的weathermapweb(在npm命令行窗口中按Ctrl+C)。
2
修改weathermap-1.0.0/weathermapweb/routes/目录下的weathermapweb.js文件。 1、修改端口号为Mesh监听端口。 2、将原来的IP:Port替换为fusionweather。 3、其他内容不作修改。
3
在weathermapweb目录下启动startup.bat。
验证成果
1
访问http://localhost:3000/,即可看到天气预报界面。
2
在“应用开发 > 微服务管理 > 服务治理”页面也可以看到weathermapweb与Fusionweather之间的调用关系。
注意事项
请在Windows系统下进行操作。
下一篇:无线中继怎么设置