阿里云 EDAS-HSF 用户指南

针对 EDAS v2.3.0
©Alibaba EDAS 项目组
2015/8/19

1 前言
本文档旨在描述阿里云 EDAS 产品中应用服务化模块的基本概念,以及如何使用。

2 产品背景

HSF(High Speed Framework)是一个高可用、高性能、分布式的服务框架。HSF 可以被看作是人体的血管,
帮助应用轻松实现服务化解耦,是阿里内部各个系统通信的基础软件。

3 专业术语
  Agent
安装于用于 ECS,负责 EDAS 控制台与用户 ECS 之间的通信,以此来实现对应用的管理。
  HSF
EDAS 产品中分布式服务化子模块的名字,是一个高性能的服务化框架,全称 High Speed FrameWork。

4 HSF 安装

先了解下 HSF 应用的运行环境。如图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVsAAACzCAIAAACozSjhAAASM0lEQVR4nO3d6VtT16LH8XCQWjnP1XtP28fTU3vPeU57qr33tKeTvXa2aLWttnWqiEXFodVWBbRKrPPAICqCFhCZh8wTCDigFgERS2UICZFkh0w7YZ7Z/gH3RXqBixbFskiW+a3n80YIPDsJ+T5r7R2zeFUYGBgY/zd4rj4ADAwMNxooAgYGxuBAETAwMAbHfYpQUlkVUaxeXFA/U6WbIDDwBAwAuD8foWGmSre4oD6iWF1SOUZFCC7SPCnReyEEANTyEhiekuhDijS/qwgllVXv5/06KZieb1lV0XpA0yllOZXjDgC4PynL7dd0Bla0vpBv4QmYCQLD+3m6B5ks3LsIzhxMEjN8dYcMIQCglpTl+OqOSWJmgsDwQZ7uYYqwtUgzUWiYJGYSjb1KO3IAQDelnUsw9kwSM48LDcH3Wz4ML8K1yqq/SPVeAgNmBwCPDBnLhdV2eAkM06QNoytCeLF6ktAwPd+SY+13+d0AgLGSbemfnm/xFRkiitWjKMKXhfU+QsPKGy1iGyYIAI8OsY0LuNEyUWhYe1E7iiK8l6vzxpIB4JEjYzm+umOCwPB+7kjnF4cXYbJIzxMwmZY+l98BABhDSjuXYOz1EhieGfFUAooA4CkyzH08ATNFrEcRAABFAIAhUAQAGIQiAMAgFAEABqEIADA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oBx5qCk8r5B+I0iOEdwkeYJsd5LYHD5p0QBwMPxEhieFOtD7rdYeKAiOEdEsXpRQf0bSt0UEeoAQAEvgWGKSD9TqQu8oI0c8crCwxQBAwPDcwaKgIGBMThQBAwMjMHxv+ToWTi2ULB7AAAAAElFTkSuQmCC" alt="" />

首先,应用运行在潘多拉(Pandora)容器中,容器又通过 Ali-Tomcat 启动。

重要说明: 本地开发,才需要 4.1,4.2,4.3 的步骤.如果已经开发好,则只需要将应用发布到 EDAS 平台上,EDAS 平台
会自动初始化容器环境.

4.1 Tomcat 安装

下载并解压 Tomcat 即可(不可以下载其它 tomcat 包),我们做了定制
下载地址:  http://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/tomcat/taobao-tomcat-dev.gz

4.2 Pandora 安装

下载并解压 Pandora 到 Ali-Tomcat 的 deploy 目录即可。
下载地址:  http://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/pandora/unauth/taobao-hsf.tgz

4.3 环境配置

1.  绑定 jmenv.tbsite.net 域名到对应的地址服务器(没有域名解析的情况下)
在默认情况下,我们在公网有一个测试环境,您可以在本机绑定地址:
182.92.100.65 jmenv.tbsite.net
如果在您的本地安装有地址服务器环境,请绑定本地的地址
2. 可以安装 EdasStudio 开发插件,这样可以在 eclipse 中直接调试程序无需额外的打包
到此,HSF 的运行环境就安装完毕。

参考 EDAS-Studio(开发套件)用户使用指南

5 提供 HSF 服务

5.1 创建 Web 项目

以 eclipse 为例创建一个 maven web 项目。 File -> New -> Project -> Maven Project -> maven-archetype-webapp ->
输入 groupId、artifactId 连续 Next。项目目录结构如图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdsAAAEvCAIAAACCG/xsAAAeyklEQVR4nO3df2wU553H8b0/+r//qLjyR3WphIgjdPGdW9zrpsrdPxfcq9TmUiER6Rool+wVBSmphRqnDYEQIC7kmhEBwylAud7BmR8OENoNIFxDfLik9QU3KYlrx8Y/QnCN7awNxmsMmftjdmeemXlmdmzv7jyz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qal8JLK7oR6JDKDYopHI25+LG4n8WuPvv/PikfLV9d958YiRy9dH09ufi3scJ873ij+4Zi2smQffVO3S4vZdXRu8jyWRAeQSmUTuH8okshHE5ov+oRyJnEjIvtjz+WYvQCILiW7mPIkMYK6ikcgv13yzfyh94mLPpY4bV/rGTlzsudI3dqnjxomLPf1D6ZdrvulxHO2iAURJZBL56uDk1cG08E+rSGQApSEaifzCsw/7l8dxJDKAKIlGIgPAfEAiA4AqSGQAUAWJDACqIJEBQBUkMgCogkQGAFWQyACgChIZAFRBIgOAKkhkAFAFiQwAqiCRAUAVJDIAqIJEBgBVkMgAoAoSGQBUQSIDgCpIZABQBYkMAKogkQFAFSQyAKiCRAYAVZDIAKAKEhkAVEEiA4AqSGQAUAWJDACqIJEBQBUkMgCogkQGAFWQyACgChIZAFRBIgOAKkhkAFAFiQwAqiCRAUAVJDIAqIJEBgBVkMgAoAoSGQBUQSIDgCpIZABQBYkMAKogkQFAFSQyAKiCRAYAVZDIAKAKEhkAVEEiA4AqSGQAUAWJDACq+H+hkSw80akiCgAAAABJRU5ErkJggg==" alt="" />

5.2 添加 Maven 依赖

在项目 pom.xml 中添加如下依赖:

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>

5.3 编写需要发布的服务

创建需要发布的服务接口,com.taobao.edas.test.SampleService

SampleService 服务提供了一个 echo 的方法调用。编写实现类:com.taobao.edas.test.impl.SampleServiceImpl

public interface SampleService {
String echo(String str);
}
public class SampleServiceImpl implements SampleService {
@Override public String echo(String str) {
return str;
}
}

5.4 配置 Spring

在 web.xml 中配置 spring 的监听器:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

在 resources 目录下面添加 spring 配置文件:config/applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 3.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<import resource="classpath:config/providers-spring.xml"/>
</beans>

这里配置文件中包含了发布者的配置文件:config/providers-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 3.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="target" class="com.taobao.edas.test.impl.SampleServiceImpl"/>
<beanid="sampleServiceProvider"
class="com.taobao.hsf.app.spring.util.HSFSpringProviderBean" init-method="init">
<property name="serviceInterface" value="com.taobao.edas.test.SampleService"/>
<property name="serviceVersion" value="1.0.0"/>
<property name="serviceGroup" value="HSF"/>
<property name="target" ref="target"/>
</bean>
</beans>

到此发布者就编写好了,运行 Maven 打包,生成项目 war 包。部署到 ali-tomcat 的 deploy 目录下。运行
ali-tomcat/bin/startup.bat,就可以在 hsf 服务治理上查询到发布的服务了。

6 消费 HSF 服务

6.1 配置 Spring

在配置文件 config/applicationContext.xml 添加消费者配置:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 3.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<import resource="classpath:config/providers-spring.xml"/>
<import resource="classpath:config/consumers-spring.xml"/>
</beans>

consumers-spring.xml 配置:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 3.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="sampleService" class=
"com.taobao.hsf.app.spring.util.HSFSpringConsumerBean" init-method="init">
<property name="interfaceName" value="com.taobao.edas.test.SampleService"/>
<property name="version" value="1.0.0"/>
<property name="group" value="HSF"/>
</bean>
</beans>

6.2 编写测试代码

已经完成了消费者的定义,下面创建 servlet 来调用测试代码进行测试:com.taobao.edas.test. HsfServlet

public class HsfServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(
req.getServletContext());
SampleService sampleService = (SampleService) ctx.getBean("sampleService");
resp.getWriter().println(Long.toString(System.currentTimeMillis()));
}
}

在 web.xml 中添加

<servlet>
<servlet-name>hsf</servlet-name>
<servlet-class>com.taobao.edas.test.HsfServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hsf</servlet-name>
<url-pattern>/hsf.htm</url-pattern>
</servlet-mapping>

6.3 打包测试

Maven 打包,部署,启动 ali-tomcat,打开浏览器访问:localhost:8080/hsf.htm 。
注意:这里虽然消费成功,但是默认没有走远程调用。就是说,如果相同的 jvm 中提供了服务,默认是不会
走网络远程调用了。就是说,即使其他机器提供了相同的服务也永远不会调用。
编辑 ali-tomcat/bin/catalina.bat 添加如下参数:
set JAVA_OPTS=%JAVA_OPTS% -Dhsf.client.localcall=false
这个参数禁用掉了本机优先调用策略。
如果这里是使用 Ali-tomcat 插件,直接用插件运行,无需打包。并且,-Dhsf.client.localcall=false
把这个参数在 eclipse 中加到 JVM 参数中。

阿里云 EDAS-HSF 用户指南的更多相关文章

  1. 杂项-分布式-EDAS:深度解析阿里云EDAS服务

    ylbtech-杂项-分布式-EDAS:深度解析阿里云EDAS服务 1.返回顶部 1. 深度解析阿里云EDAS服务 弹性伸缩 摘要: 第一种只适用于业务较少的情况,而在新业务不断增加的情况下,增加新应 ...

  2. 阿里云EDAS在本地CentOS7.5 系统搭建测试环境,部署配置中心以及部署多个war包

    参考阿里云的EDAS开发文档: 使用 Ali-Tomcat 开发应用 我们自己在内网搭建CentOS7 的测试环境,需要的资源如下: Ali-Tomcat Pandora 容器 EDAS 配置中心安装 ...

  3. 阿里云EDAS功能简介

    尊敬的 EDAS 用户: 您好!为了给您带来更好的服务和使用体验,EDAS 产品团队将对 EDAS 标准版(含按量付费和包年包月)进行一轮调整,包括按量付费标准版价格和免费额度的更新,以及标准版套餐的 ...

  4. 服务化改造的云上利器 | 阿里云 EDAS 重大升级发布

    11月22日,广东云栖大会企业级互联网架构专场上,阿里云发布了全新版本的企业级分布式应用服务EDAS. 新版本增强了对主流微服务框架的原生支持,实现SpringCloud & Dubbo用户代 ...

  5. 抛弃阿里云,中国用户购买海外VPS的五个理由

    王掌柜在过去的五年多时间里,折腾过不少vps品牌,最开始玩的是一年一百多块钱的香港虚拟主机,后来业务量大了,开始折腾国内的小鸟云.阿里云.腾讯云.电信云.百度云主机,国外的linode\interse ...

  6. ubuntu server 系统,更换阿里云源(用户更新源)

    Ubuntu安装完毕后,默认使用的是官方的源,在国内访问速度很慢,这里介绍更换为阿里云的源方法. 步骤如下: 1.备份源配置文件 sudo cp /etc/apt/sources.list /etc/ ...

  7. 阿里云新老用户购买 2核8G云服务器5M带宽

    这次阿里云活动的力度还是很大的,2核8G云服务器5M带宽 3年才2070 ,还是很值的购买的. 也放一个我的团战队连接,欢迎大家一起拼低价 https://m.aliyun.com/act/team1 ...

  8. 阿里云轻应用服务器配置Ubuntu的JDK、Tmocat、Mysql和Redis

    1.与服务器建立连接(达到效果:XShell和Xftp均可连接到服务器)   阿里云管理控制台提供的三种建立服务器连接方式: 使用浏览器发起安全连接(推荐) 客户端使用密钥进行连接 客户端使用账号密码 ...

  9. 阿里云API网关(7)开发指南-API参考

    网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...

随机推荐

  1. open_clientfd(char* hostname,int port)和open_listenfd(int port)

    #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h&g ...

  2. Linux 下添加普通用户,登陆并删除

    adduser 命令.LINUX创建用户的命令useradd -g test -d /home/test1 -s /etc/bash -m test1注解:-g 所属组 -d 家目录 -s 所用的SH ...

  3. NSS_01 开始

    工作中一直使用asp.net webform, 最近有一个新的小项目, 决定用asp.net mvc3, 边学习边工作吧,记录一下开发过程中的问题,因为工作嘛,只记录问题,可能不会很详细. 准备使用a ...

  4. linux与windows共享剪贴板(clipboard)

    linux与windows共享剪贴板(clipboard)的方法 先说两句废话,其实linux和windows之间不需要共享剪贴板,直接在putty中,按住SHIFT+鼠标选择就可以了. 但是作为一种 ...

  5. AVA取整以及四舍五入

    AVA取整以及四舍五入 import java.math.BigDecimal; public class Test { public static void main(String[] args) ...

  6. KnockoutJS(2)-监控属性

    本节主要涉及到3个内容: 1. 监控属性 Observables (这个用的比较多,但是其本身使用比较简单,唯一需要注意就是,它监控的对象是一个方法,所以取值和设置值的时候容易混淆) 2. 计算属性  ...

  7. Android 核心组件 Activity 之下

    创建新的Activity的方式: 1. 在相应的文件下 Ctrl + N  (Eclipse, Android中不知道是不是) 2. 创建类,继承自Activity或者Activity的子孙类, 并在 ...

  8. php获取客户端ip地址

    本文介绍一个,php获取客户端的IP地址的实例代码,有需要的朋友参考下吧. 获取客户端IP地址的代码,如下: 复制代码代码示例: <?php//取得客户端IP的函数function get_cl ...

  9. Centos7搭建集中式日志系统

    在CentOS7中,Rsyslong是一个集中式的日志收集系统,可以运行在TCP或者UDP的514端口上.   目录 开始之前 配置接收日志的主机 配置发送日志的主机 日志回滚 附件:创建日志接收模板 ...

  10. JavaScript之this,new,delete,call,apply

    OS:Window 8.1 关键字:JavaScript,HTML,this,new,delete,call,apply. 1.this 一般而言,在Javascript中,this指向函数执行时的当 ...