低代码应用在TSF实现服务治理的解决方案是什么
低代码应用在TSF实现服务治理的解决方案是什么,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
成都创新互联公司是一家企业级云计算解决方案提供商,超15年IDC数据中心运营经验。主营GPU显卡服务器,站群服务器,四川雅安电信机房,海外高防服务器,服务器机柜,动态拨号VPS,海外云手机,海外云服务器,海外服务器租用托管等。
当企业有大型应用需要拆分成多个微服务的需求时,Mendix在不依赖任何云平台,如Mendix Cloud、Openshift、K8S等情况下,无法满足服务治理所有的功能,对于Private Cloud环境的运行更是如此。即便是在开源的上如K8S、Openshift、Mesos、Rancher、Docker-swarm容器平台等也不具备较强的服务治理能力。对于代码侵入式较高的服务治理框架,SpringCloud、Dubbo等对于Mendix应用的开发难度较高(对于Mendix应用目前可以通过javaAction方式自定义代码,对于Springcloud,自定义代码的权限远远不够),固不适用;而对于专业的无代码侵入式Service Mesh服务治理框架,如Istio,Linkerd、Nginmesh、Maistra等却需要有专业的团队去维护, 时间成本,运维成本都大大增加项目预算,因此在Private Cloud环境下需要一套快速实现服务治理的一套解决方案。
拥有可以用低代码的方式创建一个基于微服务集群的大型企业级应用,帮助企业快速应用最新的互联网技术,加速企业创新更好的支持敏捷快速迭代开发,提升整体IT管理能力。
使用腾讯云微服务平台TSF来实现Mendix应用之间的服务治理。
如服务路由、服务限流、服务鉴权规则。用户可以通过配置、权重标签的形式进行细粒度的流量控制,实现灰度发布、就近路由、流量限制、访问权限控制等功能 。
Mesh 微服务平台(Tencent Service Mesh Framework,简称 TSF Mesh),基于 Service Mesh 的理念,为应用提供服务自动注册与发现、服务路由、鉴权、限流、熔断等服务治理能力,且应用无需对源代码进行侵入式改造,即可与该服务框架进行集成。了解TSF Mesh更多信息点击此处请查看《腾讯云中间件团队在Service Mesh中的实践与探索》。
服务 线上管理 ,实现 服务可视化全生命周期管理。 业务自定义标签,应用于用户自定义服务鉴权与服务路由规则。 API列表与调试,方便用户API接口信息查看及远程调试。 服务统计,提供服务运营监控数据,用于快速定位服务异常,发现系统瓶颈。 服务鉴权,防止服务非法调用。 服务限流 ,保护自身服务,防止流量击穿导致系统异常。 服务路由,灰度发布,金丝雀发布,蓝绿发布。 服务熔断,当下游的服务因为某种原因导致服务不可用或响应过慢时,上游服务为了保证自己整体服务的可用性,不再 继续调用目标服务,直接返回。 当下游服务恢复后,上游服务会恢复调用。 日志告警,快速发现系统异 常。 实时日志,检测服务启动日志。 日志检索,快速发现系统异常。 服务依赖拓扑,展示应用服务全景图,用于快速定位服务异常,发现系统瓶颈。 调用链查询及详情,以接口维度 快速定位服务异常,发现系统瓶颈。 弹性伸缩,保障服务高可用,减少人工操作,节约系统资源。 全链路灰度发布。 分布式事务,跨多个库数据一致性保障。 微服务网关,全局服务的鉴权,服务路由,服务管理。
登录腾讯云控制台,注册并实名认证后,登录腾讯云账号:
https://cloud.tencent.com。确认腾讯云账户余额大于100元。 若使用主账号进行登录,则默认已有所有资源的访问权限;若使用子账号进行登录,则需要提前授予相关权限,可前往下面链接查看如何使用CAM策略进行授权:
https://cloud.tencent.com/document/product/598/10600。一台可以访问公网的机器(可在腾讯云CVM页面进行购买),用于上传Mendix应用镜像。 容器服务TKE。
如ilink.mpk、native.mpk项目包,两者相互调用彼此提供的服务。
传统的Rest API调用:http://ip:port

改造后的Rest API调用, http://service-name/,使用服务名字实现服务之间的相互调用。

2. 构建镜像
(1)下载相关的脚本文件
git clone https://github.com/mendix/docker-mendix-buildpack.git
(2)文件目录结构
├── Dockerfile
├── Dockerfile.rootfs.bionic
├── Dockerfile.rootfs.trusty
├── LICENSE
├── Makefile
├── README.md
├── scripts
│ ├── cleanupjdk
│ ├── compilation
│ ├── git
│ ├── startup
│ └── vcap_application.json
└── tests
├── docker-compose-azuresql.yml
├── docker-compose-k8s.yml
├── docker-compose-MySQL.yml
├── docker-compose-postgres.yml
├── docker-compose-sqlserver.yml
├── stop.sh
└── test-generic.sh
(3)将开发好的MPK包放到与docker-mendix-buildpack同级目录

ilink.mpk和native.mpk为Mendix所开发的两个微服务。docker-mendix-buildpack-ilink和docker-mendix-buildpack-native是这两个app镜像构建,容器部署相关的脚本,主要文件包括Dockerfile、Makefile、startup启动文件。
(4)Makefile文件修改


├── apis
│ └── native.yaml
├── logs
└── spec.yaml
##Spec.yaml文件主要是定义服务及健康检查相关的内容:
apiVersion: v1
kind: Application
spec:
services:
- name: native
ports:
- targetPort: 8080
protocol: http
healthCheck:
path: /
##native.yaml主要定义相关的api,不做强求,内容如下:
openapi: 3.0.0
info:
version: "1.0.0"
title: native service
paths:
/api/v6/user/create:
get:
responses:
'200':
description: OK
'401':
description: Unauthorized
'402':
description: Forbidden
'403':
description: Not Found
/api/v6/user/account/query:
get:
responses:
'200':
description: OK
'401':
description: Unauthorized
'402':
description: Forbidden
'403':
description: Not Found
/health:
get:
responses:
'200':
description: OK
'401':
description: Unauthorized
'402':
description: Forbidden
'403':
description: Not Found
nativeService.tar.gz文件所处的位置如下所示:

文件目录:
├── apis
│ └── native.yaml
├── logs
└── spec.yaml
##Spec.yaml文件主要是定义服务及健康检查相关的内容:
apiVersion: v1
kind: Application
spec:
services:
- name: ilink
ports:
- targetPort: 8080
protocol: http
healthCheck:
path: /
(7)修改Dockerfile文件
修改后的内容如下:


(8)修改script目录下的startup文件
os.system('mkdir -p /opt/tsf/app_config/apis')
os.system('cp /opt/app/nativeService/spec.yaml /opt/tsf/app_config/')
os.system('cp -r /opt/app/nativeService/apis /opt/tsf/app_config/')

(9)镜像构建
##make get-sample 相当于解压文件到build文件夹
##make build-image 构建镜像并指定相应的镜像的tag


当出现以下内容则构建成功

3. 腾讯云镜像仓库功能存储构建的镜像
使用说明:
https://cloud.tencent.com/document/product/457/9118



(1)具体的创建过程请参考:https://cloud.tencent.com/document/product/213/2936


(3)添加相应的安全规则

参考:
https://cloud.tencent.com/document/product/213/12452(1)打开控制面板,搜索TSF

(2)进入腾讯微服务平台TSF



(3)集群信息如下图所示,包括两台云主机:



同理



(2)添加发布规则


(1)新建部署,编辑相关信息:



8. 创建后端数据库服务
(1)打开容器服务平台

(2)可以看到刚才在微服务平台创建好的集群,点击集群id


MYSQL_USER=mendix
MYSQL_PASSWORD=mendix
MYSQL_DATABASE=mendix
MYSQL_ROOT_PASSWORD=root




(5)Pod管理

(6)为mysql再创建一个数据库实例



create database mxIlink;
GRANT ALL ON *.* TO 'mendix'@'%';
flush privileges ;
9. 为微服务应用添加环境变量
(1)编辑yaml文件

为其中一个添加内容:

- name: ADMIN_PASSWORD
value: Password1!
- name: DATABASE_URL
value: mysql://mendix:mendix@ilink-mysql:3306/mendix
##另外一个添加内容:
- name: ADMIN_PASSWORD
value: Password1!
- name: DATABASE_URL
value: mysql://mendix:mendix@ilink-mysql:3306/mxIlink
##两者数据库实例不同即可
(2)当pod的数量和期望一致时,则应用部署完成


另外一个微服务平台接收到的Task数据

在构建镜像的时候提到了Rest API,传统的方式是ip+port,现在可以直接使用service-name的方式调用。传统方式:

现在的方式:

同理相互调用。TSF提供服务注册、服务发现等服务治理相关的功能。


目前我们部署的服务都是一个实例,可通过容器服务平台进行弹性伸缩。






TraceId追踪



服务健康状况:

延时状态码统计:

由于之前已经创建了日志配置项,因此可以通过TSF的日志服务可以对日志进行检索。

通过通过多种查询方式如基本查询、Lucene语法、正则表达式。如下所示:


关于低代码应用在TSF实现服务治理的解决方案是什么问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。
分享标题:低代码应用在TSF实现服务治理的解决方案是什么
标题来源:http://azwzsj.com/article/ghshgh.html