搜索​​​​

清除过滤器
文章
Louis Lu · 四月 15, 2021

第 4 天:使用 InterSystems Objects 和 SQL 进行开发

我正在参加 Joel Solon 讲授的“使用 InterSystems Objects 和 SQL 进行开发”课程。 课程非常好,我将在这里分享一些从培训中总结的提示。 第 4 天的提示: 1. 所有数据都存储在global中,global名称以 ^ 开头。 global示例:^animal。 global可以有多个数据位置(“子数据”)。 示例:^animal("大象","吃草")。 2. 可从任意系统范围(命名空间)访问 ^%* global。 3. global使 IRIS 能够支持多模型数据(对象、关系、文档、多维等)。 4. 要查看global,请转到 Management Portal > Explorer > Globals > Select Global > View,或者在终端中输入 do ^%G 或 zwrite ^global。 5. 在持久类和 SQL 表之间有自动对应关系: 包对应于是 SQL Schema; 类是Table; 属性是列; 方法是存储过程(使用 sqlProc 时); 类之间的关系是 SQL 外键约束(必须为双向)。 对象是行。 6. 一个表可以对应多个类,但序列类serial是持久类表的一部分(没有特定的表)。 7. 一个类可以对应多个表。 8. 我们有一些类类型: Non-registered:不是类对象(仅限方法的容器); Registered:瞬态对象; Persistent:类似于SQL表中持久化保存; Serial:嵌入主持久化表中的持久表(Serial为嵌入式); Datatype:非类对象用于执行新的验证和转换为基础数据类型。 9. 类的组成可包括: 属性; 方法; Class queries:SQL Select 语句; Parameters:配置类行为的用户常量或系统常量; 外键:参照完整性; 索引:提高性能并创建独特值; 触发器:触发与持久性事件关联的方法; XData:与该类关联的 XML 或 JSON 定义; 存储:数据存储的描述。 10. 按照惯例,类的首字母大写。 示例:CountryOrigin。 参数均为大写。 示例:COLORNUMBER。 11. 类特性限定/配置一个类。 示例 [SqlTableName = Animal] 可设置SQL表名。 [Final] 不允许继承。 [Private] 不允许为非子类调用方法或使用属性。 12. IRIS 在内部生成 Get 和 Set 属性,这些属性不可见,但可以通过声明改变行为。 13. 可以重写超类的方法,为此,请重复类名、参数。 可以增加参数的数量,不可减少。 14. 使用 ##super() 调用基类方法。 15. 要创建抽象类,请使用 [Abstract] 并防止实例化。 16. 可以继承多个类。 例如,Class Person extends (%Persistent, %Animal)。 (Persistent 必须是 extends 中的第一个类,参见评论中 joel 的提示) 17. REST 是表述性状态转移。 它基于 HTTP 协议。 使用 HTTP 谓词:GET(选择)、POST(插入)、PUT(更新)和 DELETE(删除)。 18. 要将您的类作为 REST 资源公开,请从 %CSP.REST 扩展。 19. 在 XData 块中使用 URLMap 配置 REST 服务的路由。 使用门户,创建一个 Web 应用程序,启用 REST 并指定 Dispatch 类。 20. %JSONAdaptor 提供了对象与 JSON 之间的转换。 使用 obj.%JSONImport(jsonObj) 将 DynamicObject 分配到对象。 使用 obj.%JSONExportToString(.jsonString) 将 JSON 字符串写入对象。 21. %JSON.Formatter 格式化 JSON 字符串以便人类阅读。
文章
Louis Lu · 四月 15, 2021

第 2 天:使用 InterSystems Objects 和 SQL 进行开发

原文在这里 原作者YURI MARX GOMES 我正在参加 Joel Solon 讲授的“使用 InterSystems Objects 和 SQL 进行开发”课程。 课程非常好,我将在这里分享一些从培训中总结的提示。 第 2 天的提示: 1. 您可以创建持久类(在数据库中具有对应表的类,用于保持类属性)。 2. 持久类示例: Class dc.Person extends (%Persistent) { Property Name As %String; Property BirthDate As %Date; } 3. 扩展 %Persistent 时,您将获得 %New() 以在内存中创建新实例,获得 %Save() 以保存到数据库,获得 %Id() 以获取该实例在数据库中的唯一 ID,以及获得 %OpenId() 以使用数据库值加载实例。 4. 持久类允许您调用 %Deleteid() 以从数据库中删除一个实例,调用 %DeleteExtent() 以删除所有保存的对象(没有 where 时删除!),调用 %ValidateObject() 以验证保存前传递的数据(验证是否必需、大小等)。 5. 持久类具有 %IsModified() 和 %Reload(),前者用于检查内存中的数据变化(参见评论中 joel 的提示),后者用于获取这些变化。 6. 要在尝试 %Save() 或 %Delete() 时获得可能的错误,请执行:set status = person.%Save(), write status。 如果保存成功,将返回 1。 7. 我们可以使用 do $system.Status.DisplayError(status) 查看错误详细信息。 8. 要调用持久类方法,请执行:##class(dc.Person).%Save()。 9. 要调用持久实例方法,执行:..Method()。 引用属性也一样,请执行:write ..Name。 10. 要从程序或终端内存中移除对象或变量,请使用 kill person 或 set person = ""。 如果仅使用 kill,将从内存中移除所有引用(不是从数据库中移除,在数据库中使用 killextent)。 11. 如果要通过实用工具方法填充测试数据,请使用 %Populate 扩展持久类,然后调用 Populate(行数)方法。 12. 您可以通过继承%SerialObject(不具有 ID 的持久类,因为它必须与另一个持久类相连)创建嵌入式类。 示例: Class dc.Contact Extends %SerialObject { Property Phone As %String; Property Email As %String; } 13. 此序列将成为您的持久类的一个属性: Class dc.Person extends (%Persistent) { Property Name As %String; Property BirthDate As %Date; Property Contact As dc.Contact; } 14. 在 IRIS 数据库中,将仅创建一个具有 Contact 属性的Person表。 15. 您可以创建索引来获得唯一性或调整查询。 示例:Index NameIndex On Name [Unique]。 16. 创建索引时,如果表不为空,则需要在管理门户中重建索引。 17. 要创建构造函数方法,请重写 %OnNew()。 这是在调用 %New() 时调用的回调方法。 还有其他回调方法。 18. IRIS 对 JSON 有很好的支持。 您可以通过调用 set name = {}.%FromJSON("{""Name"":""Yuri""}") 将 JSON 加载到对象。 19. 您可以从对象执行编写 JSON:name.%ToJSON()。 20. IRIS 和 Caché 中存在 JSON 数组(感谢 @Robertcc.Cemper 提醒),但是只在 IRIS 中我们才有 JSON 的格式化程序和zwrite 写入 JSON。 明天我会发布第 3 天的总结。 PS:这是一份总结,课程中实际教授了更多内容。
文章
Louis Lu · 四月 15, 2021

第 3 天:使用 InterSystems Objects 和 SQL 进行开发

我正在参加 Joel Solon 讲授的“使用 InterSystems Objects 和 SQL 进行开发”课程。 课程非常好,我将在这里分享一些从培训中总结的提示。 第 3 天的提示: 1. 您可以使用 %Dictionary 类查看类目录,并在 INFORMATION_SCHEMA 表中查看 sql 对象。 2. 可以在 ObjectScript 方法中以动态 SQL 或嵌入式 SQL 使用 SQL。 3. 您可以使用 ?(例如:where country = ?)将参数传递到动态 SQL 字符串, 使用冒号(例如:where country = :variable)将参数传递到嵌入式 SQL。 4. 动态 SQL 示例(来自 Intersystems 文档): SET tStatement = ##class(%SQL.Statement).%New(,"Sample") SET myquery = 3 SET myquery(1) = "SELECT TOP ? Name,DOB,Home_State" SET myquery(2) = "FROM Person" SET myquery(3) = "WHERE Age > 60 AND Age < 65" SET qStatus = tStatement.%Prepare(.myquery) IF qStatus'=1 {WRITE "%Prepare failed:" DO $System.Status.DisplayError(qStatus) QUIT} DO tStatement.%Display() WRITE !,"End of %Prepare display" 5. 嵌入式 SQL 示例(来自 Intersystems 文档): #SQLCompile Select=Display &sql(SELECT DOB INTO :a FROM Sample.Person) IF SQLCODE<0 {WRITE "SQLCODE error ",SQLCODE," ",%msg QUIT} ELSEIF SQLCODE=100 {WRITE "Query returns no results" QUIT} WRITE "1st date of birth is ",a,! DO $SYSTEM.SQL.Util.SetOption("SelectMode",1) WRITE "changed select mode to: ",$SYSTEM.SQL.Util.GetOption("SelectMode"),! &sql(SELECT DOB INTO :b FROM Sample.Person) WRITE "2nd date of birth is ",b 6. 嵌入式 SQL 示例 - 插入: &sql(INSERT INTO Sample.Person (Name, Age, Phone) VALUES (:name, :age, :phone) 7. 如果您需要使用 SQL 批量处理数据,处理单个记录,请使用 Persistent Object API。 8. 您可以创建 SQLQuery 方法,如果在方法中使用 [SqlProc],将在 SQL 端中创建一个 SQL 存储过程。 9. 从终端可以进入 SQL Shell,要从终端进入 SQL 命令,请执行 do $system.SQL.Shell()。 10. 持久类具有系统生成的 ID,如果需要由您控制的 ID,您可以使用具有一个或多个属性的 IDKEY 索引。 例如,SocialNumber [IdKey, PrimaryKey, Unique] 上的索引键。 11. 当两个或多个进程同时尝试处理相同数据时,有两种控制并发的策略:悲观型和乐观型。 12. 要获取悲观控制,请使用 %OpenId(ID, 4) 锁定对象,其中 4 会将表锁定为互斥访问。 在进程运行后,可以释放锁定。 13. 要进行乐观控制(针对 Web 应用),在您的持久类中创建 Parameter VERSIONPROPERTY = "Version"; Property Version as %Integer [ InitialExpression = 1 ]。 IRIS 会在每次实例更新时递增属性版本,这样可以协调更新顺序,而不是锁定表。 14. 当您有更新、插入或删除数据的方法时,请使用事务保持数据一致。 示例: Transfer(from,to,amount) // Transfer funds from one account to another { TSTART &SQL(UPDATE A.Account SET A.Account.Balance = A.Account.Balance - :amount WHERE A.Account.AccountNum = :from) If SQLCODE TRollBack Quit "Cannot withdraw, SQLCODE = "_SQLCODE &SQL(UPDATE A.Account SET A.Account.Balance = A.Account.Balance + :amount WHERE A.Account.AccountNum = :to) If SQLCODE TROLLBACK QUIT "Cannot deposit, SQLCODE = "_SQLCODE TCOMMIT QUIT "Transfer succeeded" } 15. InterSystems IRIS 的架构基于命名空间(数据库的逻辑组)和数据库。 16. 要在数据库中保存的数据有两种类型:数据(global)和代码(源代码 - 过程)。 17. 您可以使用 ECP(企业缓存协议)对数据库进行水平处理扩展,这样可以在同一命名空间访问查看多个服务器中不同的数据库。 18. 您可以使用Sharding(仅限 IRIS)进行水平数据量扩展(分布式数据库分区),这样可以将数据分区到分布式节点(如 MongoDB)。 19. 数据库的最大容量是 32TB。 20. 要从一个命名空间更改为另一个命名空间,请执行 zn "Namespace" 或 set $namespace = "Namespace"。 PS 1:课程详细展示了如何进行事务控制,这非常重要。 明天我会发布第 4 天的总结。
文章
Claire Zheng · 九月 12, 2021

InterSystems发布InterSystems IRIS医疗版互联互通套件,加速医院互联互通平台建设

2021年9月13日,中国 北京—— 致力于帮助客户解决最关键的可扩展性、互操作性和速度问题的创新数据技术提供商InterSystems今日宣布在中国推出InterSystems IRIS医疗版互联互通套件,以满足医院信息化建设的标准化要求,促进业务协同,助力公立医院高效建设互联互通平台。 中国医院信息互联互通标准化成熟度测评工作自2012年启动以来,已成为医院信息化建设的重要抓手。2020年发布的最新版测评方案(《国家医疗健康信息医院信息互联互通标准化成熟度测评方案(2020年版)》)结合医疗健康信息化建设新需求、新技术应用情况,强化了分级管理机构职责,修订了测评流程,补充完善了测评指标,提升了测评方案的科学性和指导性。 凭借多年来深耕医疗信息化建设领域的丰富经验和强大的医疗数据平台,InterSystems结合新版测评标准,及时推出InterSystems IRIS医疗版互联互通套件,从安全管理、监控、数据管理、互联互通文档、互联互通服务、集成与交换六大方面入手,在满足测评标准化组件的基础上,提供最新版医院互联互通标准化成熟度测评规定的文档、监控、服务、Schema等组件,充分满足医院快速落地互联互通标准化成熟度测评涉及到的标准化改造需求。通过内置的模块化服务,InterSystems IRIS医疗版互联互通套件将有效缩短实施周期,加快互联互通平台建设。 InterSystems IRIS医疗版互联互通套件兼备高性能与稳定性,连续多年支持数百家大型公立医院海量数据稳定运行。 主流 PC 服务器单实例下,支持日消息吞吐量可高达27.64亿。截至2021年,InterSystems技术已助力一百余家医院通过四级及以上医院信息互联互通标准化成熟度评级。目前获评医院互联互通成熟度五级乙等评级的32家医院中,有10家均采用了InterSystems的技术和产品,某大型三甲医院日均处理数据在千万量级。 InterSystems IRIS医疗版互联互通套件包含先进的互操作技术,同时具备强大的创新功能,包括数据库管理、敏捷开发、 API 管理、FHIR资源仓库、分布式扩展、一体化机器学习、自适应分析等,全面支持医院持续开展数字化创新与应用。 InterSystems亚太区总经理卢侠亮表示:“作为一家服务中国医疗信息化市场超过20年的创新数据提供商,InterSystems致力于为中国用户提供卓越服务,此次发布的InterSystems IRIS医疗版互联互通套件专为中国用户打造,将更高效地为医疗机构标准化互联互通和信息共享提供技术保障。接下来,我们会一如既往地与本土合作伙伴和医疗机构紧密合作,将全球领先的医疗信息平台解决方案与中国市场需求相结合,为更多的医院数字化转型提供强大支持。” InterSystems将于2021年9月17日举办“InterSystems IRIS医疗版互联互通套件”线上发布会,会议详情如下,欢迎点击“此处”或扫描下方二维码报名。 目前已经可以回放,节前错过的小伙伴可以继续注册观看啦
文章
Jingwei Wang · 十二月 22, 2021

使用内置REST API监控InterSystems IRIS

IRIS 2019.4 预览版中发布了/api/monitor服务,以Prometheus格式展示IRIS指标,但没有正式公布。对于任何想要使用IRIS指标作为其监控和警报解决方案的一部分的人来说,这是一个大新闻。该API是新的IRIS 系统警报和监控(SAM)解决方案的一个组成部分,将在IRIS的一个即将到来的版本中发布。 然而,你不必等待SAM开始规划和试用这个API来监控你的IRIS实例。在未来的文章中,我将深入挖掘可用的指标和它们的含义,并提供交互式仪表盘的例子。但首先,让我从一些背景和一些问题和答案开始。 IRIS(和Caché)总是在收集关于它自己和它所运行的平台的几十个指标。一直以来都有多种收集这些指标的方法来监控Caché和IRIS。我发现,很少有安装使用IRIS和Caché内置的解决方案。例如,History Monitor仪表盘作为性能和系统使用指标的历史数据库已经存在很长时间了。然而,没有明显的方法来展现这些指标,并实时监测系统。 IRIS平台的解决方案正在从运行在几个企业内部的实例上的单体应用程序,转向分布式解决方案部署在 "任何地方"。对于许多用例,现有的IRIS监控选项并不适合这些新的模式。InterSystems没有使用陈旧的方法,而是寻找当前流行的、经过验证的开源解决方案进行监控和警报。 普罗米修斯? 普罗米修斯是一个著名的、广泛部署的、技术成熟的开源监控系统。它有各种各样的插件,且能在云环境中很好地工作,对本地部署也同样有用。其插件包括操作系统、网络服务器(如Apache)和许多其他应用程序。普罗米修斯通常与可视化工具一起使用,例如,Grafana。 Grafana? Grafana也是开源的。随着这一系列文章的进行,我将提供常见场景的监控仪表盘的样本模板。你可以把这些样本作为基础,为你所关心的事情设计仪表盘。当你把IRIS的指标与你整个解决方案堆栈的指标结合起来时,真正的力量就来了。从平台组件、操作系统、IRIS,特别是当你从你的应用程序中添加仪器时。 以前没有使用过吗? 用Prometheus和Grafana监控IRIS和Caché并不新鲜。几年来,我一直在使用这些应用程序来监控我的开发和测试系统。如果你在开发者社区搜索 "Prometheus",你会发现其他的帖子(例如,Mikhail Khomenko的一些优秀帖子),显示如何暴露Caché指标供Prometheus使用。 现在版本的区别是,/api/monitor API被包括在版本内,并且默认启用。不需要编码你自己的类来暴露度量。 普罗米修斯入门 这里是对Prometheus和一些术语的快速介绍。我希望你能看到高层次的东西,帮你考虑如何可视化或使用metrics打下一些基础。 普罗米修斯的工作方式是刮取或拉取从HTTP端点(API,如IRIS /api/monitor)的应用程序中暴露的时序数据。Exporters和客户端库存在于许多语言、框架和开源应用程序,例如,网络服务器Apache、操作系统、docker、Kubernetes、数据库以及现在的IRIS。 Exporters被用来检测应用程序和服务,并在一个端点上展示相关的指标,以便进行数据拉取。核心exporters支持网络服务器、数据库等标准组件。许多其他开源exporters可从Prometheus社区获得。 普罗米修斯术语 有几个关键术语是需要了解。 Targets是服务所在的目标,如主机或应用程序或Apache或IRIS等服务或你自己的应用程序。 普罗米修斯通过HTTP对目标进行抓取,收集时间序列数据的指标。 时间序列数据是由应用程序暴露的,例如IRIS或通过exporters。 Exporters可用于你无法控制的东西,如Linux内核指标。 由此产生的时间序列数据被储存在Prometheus服务器的本地数据库中。 时间序列数据库可以使用优化的查询语言(PromQL)进行查询。例如,创建警报或由客户应用程序(如Grafana)在仪表板上显示指标。 然而,对Prometheus数据库的访问--在IRIS上--是透明的,Grafana等应用程序不知道也不关心。 Spoiler Alert:出于安全、扩展、高可用性和其他一些运行效率的考虑,对于新的SAM解决方案,用于Prometheus时间序列数据的数据库是IRIS!这也是为什么我们要把Prometheus数据库的访问权放在IRIS上。然而,对Prometheus数据库的访问在IRIS上是透明的,Grafana等应用程序不知道也不关心。 普罗米修斯数据模型 由API返回的metrics是Prometheus格式的。普罗米修斯使用一种简单的基于文本的指标格式,每行有一个指标,格式是。 <identifier> [ (time n, value n), ....] 衡量标准使用标签(键,值)对。标签是一种强大的作为维度的方式来过滤度量。例如,检测IRIS /api/monitor返回的单一指标:日志的可用空间。 iris_jrn_free_space{id="WIJ",dir=”/fast/wij/"} 401562.83 标识符告诉你该指标是什么。 iris_jrn_free_space 多个标签可以用来修饰指标,用来过滤和查询。在这个例子中,可以看到 WIJ 和存储 WIJ 的目录。 id="WIJ",dir="/fast/wij/" 和值: 401562.83 (MB). What IRIS metrics are available? The preview documentation has a list of metrics. However, be aware there may be changes. You can also simply query the /api/monitor/metrics endpoint and see the list. I use Postman which I will demonstrate in the next community post. 可以用哪些IRIS指标? 预览文档有一个metrics的列表。请注意可能会有变化。你也可以简单地查询/api/monitor/metrics端点并查看该列表。我将在下一篇社区文章中演示使用Postman调用这个端点。 应该监控什么? 当你考虑如何监控你的系统和应用程序时,请牢记这些要点。 对影响用户的关键指标进行检测。 用户并不关心你的一台机器的CPU是否不足。 用户关心的是服务是否缓慢或有错误。 对于你的主要仪表盘来说,重点是直接影响用户的高级指标。 对于你的仪表盘来说,要避免一整面墙的图表。 人类无法同时处理太多的数据。 例如,每个服务拥有一个仪表板。 考虑服务,而不是机器。 一旦你把问题隔离到一个服务上,那么你就可以深入研究,看看是否是一台机器的问题。 参考资料 文档下载:Prometheus 和 Grafana 我在InterSystems 2019年全球峰会上介绍了SAM(包括Prometheus和Grafana)的预发布概述,你可以找到InterSystems学习服务网站的链接。如果链接不起作用,请进入InterSystems学习服务网站并搜索。"系统警报和监控变得简单" 在社区中搜索 "Prometheus "和 "Grafana"。查看原帖 由 @Murray Oldfield 撰写
公告
Tingting Jiang · 六月 21, 2022

InterSystems热招职位(3):Technical Specialist(Product Support)

InterSystems正在招聘Technical Specialist(Product Support),欢迎您的自荐、推荐。 请将简历投递至Belinda.Glasson@intersystems.com,愿您的加入给我们带来新的活力,我们也将为您提供广阔的发展空间!(由于岗位职能要求,职位说明以英文形式发布。) Location:Beijing Job Title:Technical Specialist Department:Product Support Reporting to:China Support Supervisor What We Do Matters Why are we here? To ensure that our customers have reliable access to the right information at the right time—information they can share and use to draw insights, leading to better decisions. Job Summary The Technical Specialist will be required to perform custom development tasks and provide support for InterSystems TrakCare and related products. The Technical Specialist will be responsible for site specific software support and development activities and to ensure that the software satisfies project specifications and is delivered and deployed in line with project requirements. The Technical Specialist must be available to visit client sites (e.g. hospitals/laboratories) and implementation partners for technical support and/or to provide technical training. Some travel may be required. Key Responsibilities of the Role Provide immediate response to customer inquiries in accordance with service standards. Provide technical support for interfaces, reports, extracts, data migration scripts and conversions. Provide advice and best practices for technical areas such as networks, configurations, architectures etc. Provide technical support for troubleshooting and performance analysis for reports, stored procedures, interfaces, conversions, data migration scripts and user defined functions. Escalate Open (unresolved) problems in accordance with current policies and procedures. Production of training materials for technical courses such as system custom development or reporting. Production of technical documentation such as reference materials, installation instructions, user guides, knowledge-base articles. Continuously improve customer satisfaction by soliciting customer suggestions for product and service improvements and then escalating such suggestions to management. Improve response time to customer inquiries by continuously improving communication, analytical, and learning skills. Participate in on-site technical training if required. Participate in on-site technical implementations if required. Participate in the on call 24 hour roster service. Assistance in researching new development or report writing 3rd party products such as JReports. Experience and Qualifications BS or MS in Computer Science or equivalent. Knowledge of web oriented languages, including HTML, and Java script, SQL, data analysis and database methodologies. Knowledge of Linux is strongly desired, VMWare is a plus. Knowledge of programming languages – ideally Java or C++. Personal Specifications Information Technology or Science Degree
文章
Michael Lei · 八月 9, 2022

社区文章汇总--跟着社区学习InterSystems 技术

在这篇文章中,你可以访问InterSystems开发者社区中与学习InterSystems IRIS最相关主题的文章库。找到按机器学习、嵌入式Python、JSON、API和REST应用、管理和配置InterSystems环境、Docker和云、VSCode、SQL、分析/BI、全局、安全、DevOps、互操作性、Native API排列的顶级发表的文章。快来享受学习的乐趣吧! 机器学习 机器学习是建立先进的数据分析和自动化人工活动的一种必要的技术,具有很好的效率。它可以创建认知模型,从现有的数据中学习,并根据其自我调整的算法进行预测、概率计算、分类、识别和 "非创造性 "的人类活动的自动化。 在所有情况下,InterSystems IRIS作为一个数据平台和环境来创建、执行、提供和使用这些机器学习模型。IRIS能够从SQL命令(IntegratedML)中使用ML,使用嵌入式Python和PMML(预测模型标记语言)来执行ML。你可以在以下文章中查看它的功能: 标题 描述 地址URL 一体化机器学习动手实验 一体化机器学习概览ML https://cn.community.intersystems.com/node/517656 AI Robotization with InterSystems IRIS Data Platform(英文) AI on IRIS productions https://community.intersystems.com/post/ai-robotization-intersystems-iris-data-platform 利用IRIS 一体化机器学习IntegratedML来预测糖尿病的Web 应用 一体化机器学习示例 https://cn.community.intersystems.com/node/519381 Predict Maternal Health Risks(英文) 一体化机器学习示例 https://community.intersystems.com/post/predict-maternal-health-risks Using Machine Learning to Organize the Community – 1(英文) Using Python ML libraries https://community.intersystems.com/post/using-machine-learning-organize-community-1 ObjectScript 语言 ObjectScript是InterSystems的官方编程语言。它简单、灵活,在创建后台、集成和分析应用程序方面非常强大。请查阅以下文章以了解更多信息: 标题 描述 地址URL InterSystems ObjectScript 101++ (英文) Video series to learn ObjectScript https://community.intersystems.com/post/intersystems-objectscript-101-en On $Sequence function(英文) Create sequences of numbers https://community.intersystems.com/post/sequence-function Writing better-performing loops in Caché ObjectScript(英文) Do loops https://community.intersystems.com/post/writing-better-performing-loops-cach%C3%A9-objectscript 数据匿名化 IRIS-Disguise 工具介绍 学习如何定制化 ObjectScript 持久化类和属性 https://cn.community.intersystems.com/node/509271 ObjectScript 错误处理片段 异常处理 https://cn.community.intersystems.com/node/523756 Traditional Debugging in ObjectScript(英文) Debug技巧 https://community.intersystems.com/post/traditional-debugging-objectscript 在Caché中使用正则表达式 使用正则表达式 https://cn.community.intersystems.com/node/487941 Robust Error Handling and Cleanup in ObjectScript(英文) 高质量代码 https://community.intersystems.com/post/robust-error-handling-and-cleanup-objectscript SPOOL - the forgotten device(英文) 使用 Spool https://community.intersystems.com/post/spool-forgotten-device How we learned to stop worrying and love InterSystems Ensemble(英文) Processing JSON on Productions https://community.intersystems.com/post/how-we-learned-stop-worrying-and-love-intersystems-ensemble 一个更有用的 Object Dump 对象Dumping https://cn.community.intersystems.com/node/523761 Logging using macros in InterSystems IRIS(英文) Logging using macros https://community.intersystems.com/post/logging-using-macros-intersystems-iris SYSLOG - what it really is and what it means(英文) Debug information on Syslog https://community.intersystems.com/post/syslog-what-it-really-and-what-it-means Tips for debugging with %Status(英文) Debug using %Status https://community.intersystems.com/post/tips-debugging-status 发挥 $Query 的最大作用 使用 $Query 查找数据 https://cn.community.intersystems.com/node/519806 Multidimensional Property Persistence - Part 1 (Classic) (英文) Multidimensional persistent properties https://community.intersystems.com/post/multidimensional-property-persistence-part-1-classic The adopted Bitmap(英文) Bitmap indexes https://community.intersystems.com/post/adopted-bitmap 如何成为时间领主 - 诞生 日期和时间API https://cn.community.intersystems.com/node/513356 Importance and Collection of Exact Version Information ($zv / $zversion)(英文) Get IRIS version https://community.intersystems.com/post/importance-and-collection-exact-version-information-zv-zversion Date before Dec.1840 ? Negative $H(orolog) ?(英文) 日期为负 https://community.intersystems.com/post/date-dec1840-negative-horolog Creating a Custom Index Type in Caché (英文) 创建定制索引 https://community.intersystems.com/post/creating-custom-index-type-cach%C3%A9 $LIST string format and %DynamicArray and %DynamicObject classes(英文) Using $LIST, Dynamic Object, and Dynamic Arrays https://community.intersystems.com/post/list-string-format-and-dynamicarray-and-dynamicobject-classes SQL for ^ERROR Global(英文) Use SQL to see Error content https://community.intersystems.com/post/sql-error-global Add a default setting value by code (英文) 设置默认值 https://community.intersystems.com/post/add-default-setting-value-code Iterate over dynamic object(英文) Use Iterate https://community.intersystems.com/post/iterate-over-dynamic-object 列出类的所有属性 (我喜欢 ObjectScript 的原因) ObjectScript 属性详解 https://cn.community.intersystems.com/node/512981 Try catch block I usually use in InterSystems ObjectScript(英文) Try Catch 处理 https://community.intersystems.com/post/try-catch-block-i-usually-use-intersystems-objectscript 在ObjectScript中运行shell命令 Run shell commands https://cn.community.intersystems.com/node/523766 嵌入式 Python Python是世界上最流行和最常用的编程语言之一(https://www.tiobe.com/tiobe-index/)。InterSystems IRIS是一个对所有主要编程语言开放的数据平台。然而,说到Python,这种神奇的语言和它的库在IRIS中到处都可以使用:在类、SQL和集成/制作中。对于那些不知道或不想知道ObjectScript(InterSystems编程语言)的人来说,这是一个不错的选择。请看下面的文章,了解如何做到这一点: 标题 描述 URL地址 Let's fight against the machines(英文) Build a tic tac toe game using Embedded Python https://community.intersystems.com/post/lets-fight-against-machines InterSystems IRIS 2021.2+ Python 代码样例 (Embedded嵌入式Python, Native 原生APIs 和 Notebooks) 使用 Python notebook 和 IRIS https://cn.community.intersystems.com/node/508691 WebSocket Client with embedded Python(英文) Custom Socket sample https://community.intersystems.com/post/websocket-client-embedded-python IRIS Python Native API in AWS Lambda (英文) Python on AWS https://community.intersystems.com/post/iris-python-native-api-aws-lambda How I added ObjectScript to Jupyter Notebooks(英文) IRIS on notebooks https://community.intersystems.com/post/how-i-added-objectscript-jupyter-notebooks Welcome Django(英文) Create Python Django apps with IRIS as a database https://community.intersystems.com/post/welcome-django Geocoding with IRIS and Google Maps API (英文) Using Geocoding python library https://community.intersystems.com/post/geocoding-iris-and-google-maps-api 使用IRIS 和Python gTTS 实现文本转化声音的REST服务 使用 gTTS 的Python 案例 https://cn.community.intersystems.com/node/517551 使用 Python Flask Web 框架构建 IRIS 响应式仪表板 基于IRIS 的Flask web 应用 https://cn.community.intersystems.com/node/513086 JSON JSON 是市场上最广泛使用的发送和接收数据的互操作性格式之一。InterSystems IRIS以多种方式支持这种格式。可以让你的本地数据库使用JSON(DocDB),序列化和反序列化对象,用JSON处理请求和响应,特别是来自REST服务的请求和响应。回顾以下文章: 标题 描述 URL地址 Introducing new JSON capabilities in Caché 2016.1 (英文) Presenting ObjectScript JSON API https://community.intersystems.com/post/introducing-new-json-capabilities-cach%C3%A9-20161 JSON Enhancements(英文) JSON Adaptor API https://community.intersystems.com/post/json-enhancements API 和 REST 应用Applications 后台应用程序目前是以REST(Representational State Transfer)范式开发的,并以Web API的形式暴露。下面的文章将帮助你了解它是如何工作的: 标题 描述 URL地址 GraphQL for InterSystems Data Platforms (英文) Create REST API with GraphQL style https://community.intersystems.com/post/graphql-intersystems-data-platforms Introducing InterSystems API Manager (英文) API Management overview https://community.intersystems.com/post/introducing-intersystems-api-manager Advanced URL mapping for REST Mapping routes to your APIs https://community.intersystems.com/post/advanced-url-mapping-rest AppS.REST - a new REST framework for InterSystems IRIS Create REST apps easily https://community.intersystems.com/post/appsrest-new-rest-framework-intersystems-iris RESTForms - REST API for your classes Create REST API for CRUD applications https://community.intersystems.com/post/restforms-rest-api-your-classes 使用规范优先的方式开发REST API 以合同优先的方式开发API https://cn.community.intersystems.com/node/484341 ObjectScript REST API Cookbook(英文) REST API development tips https://community.intersystems.com/post/objectscript-rest-api-cookbook 从持久类和序列类生成 Swagger 规范 Contract First Approach to develop APIs https://cn.community.intersystems.com/node/484311 InterSystems IRIS REST Application Patterns Create API REST using IRIS https://community.intersystems.com/post/intersystems-iris-rest-application-patterns Let's create an FHIR profile using SUSHI Part 1(英文) Create custom FHIR profiles https://community.intersystems.com/post/lets-create-fhir-profile-using-sushi-part-1 IAM (InterSystems API Manager), Zero to Hero(英文) Manage your APIs with IAM https://community.intersystems.com/post/iam-intersystems-api-manager-zero-hero Using InterSystems API Management to Load Balance an API (英文) Use APIM to do API load balance https://community.intersystems.com/post/using-intersystems-api-management-load-balance-api IAM实践指南——OAuth 2.0下的API保卫战(第一部分) Secure your API using APIM https://cn.community.intersystems.com/node/487141 Getting an Angular UI for your InterSystems IRIS application in 5 minutes (英文) Full Stack app with IRIS and Angular https://community.intersystems.com/post/getting-angular-ui-your-intersystems-iris-application-5-minutes Upload into an InterSystems IRIS REST API (英文) Save files using REST API https://community.intersystems.com/post/upload-intersystems-iris-rest-api 管理和配置InterSystems环境 IRIS环境的良好管理和配置对用户使用的应用程序的性能、安全性、可用性和可靠性至关重要。这些文章可以给你很好的提示,告诉你如何做到这一点: 标题 描述 URL地址 InterSystems 数据平台的容量规划和性能系列文章 容量和性能规划提升 https://cn.community.intersystems.com/node/483921 Deploying Applications in InterSystems Cache with %Installer(英文) Using %Installer to create namespaces, databases, and applications configuration https://community.intersystems.com/post/deploying-applications-intersystems-cache-installer Horizontal Scalability with InterSystems IRIS(英文) Set IRIS instances for horizontal scalability https://community.intersystems.com/post/horizontal-scalability-intersystems-iris The InterSystems Iris Fhirserver running on a Raspberry Pi Raspberry running as a FHIRserver(英文) Run IRIS inside Raspberry PI https://community.intersystems.com/post/intersystems-iris-fhirserver-running-raspberry-pi-raspberry-running-fhirserver Database Mirroring without a Virtual IP Address(英文) Set mirrors using VIP https://community.intersystems.com/post/database-mirroring-without-virtual-ip-address Apache Web Gateway with Docker(英文) Configure SSL and Web Gateway for web applications https://community.intersystems.com/post/apache-web-gateway-docker Work with SAML in IRIS(英文) SAML to Web services https://community.intersystems.com/post/work-saml-iris 掌握 %SYSTEM.Encryption 加密类 Encrypt and decrypt using IRIS https://cn.community.intersystems.com/node/518191 Docker 和 Cloud 新的应用架构在容器Docker和云中工作,旨在实现弹性扩展,快速安装、配置和提供服务,并降低基础设施的复杂性和成本。学习这些文章,了解如何将IRIS带入云中: 题目 描述 URL地址 Highly available IRIS deployment on Kubernetes without mirroring(英文) IRIS on cloud clusters with Kubernetes https://community.intersystems.com/post/highly-available-iris-deployment-kubernetes-without-mirroring 面向 Amazon Web Services (AWS) 的 InterSystems IRIS 示例参考架构 基于AWS的IRIS https://cn.community.intersystems.com/node/484351 面向 Microsoft Azure Resource Manager (ARM) 的 InterSystems 示例参考架构 基于Azure 资源管理器(ARM)架构的IRIS https://cn.community.intersystems.com/node/484361 Dockerfile 和它的朋友们或者如何在 InterSystems IRIS 上运行和合作 ObjectScript 项目 Docker项目里的重要文件管理 https://cn.community.intersystems.com/node/484326 InterSystems IRIS Deployment Guide for AWS using CloudFormation template(英文) IRIS on AWS using CloudFormation https://community.intersystems.com/post/intersystems-iris-deployment%C2%A0guide-aws%C2%A0using-cloudformation-template 面向 Google Cloud Platform (GCP) 的 InterSystems IRIS 示例参考架构 IRIS on Google Cloud https://cn.community.intersystems.com/node/484056 Using AWS Glue with InterSystems IRIS(英文) Using IRIS and AWS Glue (AWS ETL tool) https://community.intersystems.com/post/using-aws-glue-intersystems-iris Amazon EKS, IRIS 高可用与备份 基于AWS的IRIS高可用 https://cn.community.intersystems.com/node/517536 Running InterSystems Reports in containers(英文) IRIS reports on Docker https://community.intersystems.com/post/running-intersystems-reports-containers Running InterSystems IRIS in a FaaS mode with Kubeless(英文) IRIS on Kubernetes https://community.intersystems.com/post/running-intersystems-iris-faas-mode-kubeless InterSystems Kubernetes Operator Deep Dive: Introduction to Kubernetes Operators(英文) IRIS on Kubernetes https://community.intersystems.com/post/intersystems-kubernetes-operator-deep-dive-introduction-kubernetes-operators Scaling Cloud Hosts and Reconfiguring InterSystems IRIS(英文) Scaling IRIS on AWS, Azure, or GCP https://community.intersystems.com/post/scaling-cloud-hosts-and-reconfiguring-intersystems-iris Deploying a Simple IRIS-Based Web Application Using Amazon EKS(英文) IRIS on AWS https://community.intersystems.com/post/deploying-simple-iris-based-web-application-using-amazon-eks VSCode VSCode是世界上最常用的开发IDE之一。IRIS完全支持这个IDE。请看以下文章: 标题 描述 URL地址 GitHub上的VSCode-ObjectScript 在网页版 Github VSCode上开发IRIS 应用 https://community.intersystems.com/post/vscode-objectscript-github GitHub Codespaces with IRIS(英文) Develop IRIS apps into Web Github https://community.intersystems.com/post/github-codespaces-iris VSCode Tips & Tricks - SOAP Wizard(英文) Create shortcut option on VSCode https://community.intersystems.com/post/vscode-tips-tricks-soap-wizard Adding your own snippets to VS Code(英文) Create snippets https://community.intersystems.com/post/adding-your-own-snippets-vs-code SQL SQL是处理关系型数据库的最常用语言之一。这些文章展示了如何进行查询和数据持久性: 标题 描述 URL地址 Free Text Search: The Way To Search Your Text Fields That SQL Developers Are Hiding From You!*(英文) Using Indexes to promote advanced search https://community.intersystems.com/post/free-text-search-way-search-your-text-fields-sql-developers-are-hiding-you 改善日期范围查询的SQL性能 使用日期进行SQL查询 https://cn.community.intersystems.com/node/523636 Static WHERE Conditions(英文) Where on Persistent Classes https://community.intersystems.com/post/static-where-conditions 2021.2 SQL Feature Spotlight - Run Time Plan Choice(英文) Select Runtime SQL Execution Plan https://community.intersystems.com/post/20212-sql-feature-spotlight-run-time-plan-choice New in 2020.1: the Universal Query Cache(英文) SQL Cache https://community.intersystems.com/post/new-20201-universal-query-cache Materialized Views(英文) Create views inside persistent classes https://community.intersystems.com/post/materialized-views SQL Debug 小技巧 Debug SQL commands https://cn.community.intersystems.com/node/518701 Using ClassQueries() as Tables(英文) Creating views https://community.intersystems.com/post/using-classqueries-tables M:N Relationship(英文) Mapping N to N relationships https://community.intersystems.com/post/mn-relationship Reading AWS S3 data on COVID as SQL table in IRIS (英文) Get CSV data from AWS S3 to IRIS table https://community.intersystems.com/post/reading-aws-s3-data-covid-sql-table-iris The One Query Performance Trick You NEED to Know? Tune Table! (英文) SQL tunning https://community.intersystems.com/post/one-query-performance-trick-you-need-know-tune-table Data Storage - Information You Must Know to Make Good Decisions When Developing (英文) Configure the data storage section on a persistent class to get more performance https://community.intersystems.com/post/data-storage-information-you-must-know-make-good-decisions-when-developing Improve SQL Performance for Date Queries, AGAIN! (英文) Tunning SQL queries for dates https://community.intersystems.com/post/improve-sql-performance-date-queries-again Scrollable ResultSet Pagination Sample(英文) Paginate SQL results (see comments too) https://community.intersystems.com/post/scrollable-resultset-pagination-sample 第 1 天:使用 InterSystems Object 和 SQL 进行开发 Concepts about SQL into InterSystems IRIS https://cn.community.intersystems.com/node/490806 DB Migration using SQLgateway(英文) Migrate from PostgreSQL, MySQL, and other databases to IRIS https://community.intersystems.com/post/db-migration-using-sqlgateway Importing CSV into the Existing Table in InterSystems IRIS(英文) Import CSV to SQL Table https://community.intersystems.com/post/importing-csv-existing-table-intersystems-iris 访问IRIS数据平台的四种API方式 SQL API https://cn.community.intersystems.com/node/493276 Indexing of non-atomic attributes(英文) Create advanced index options https://community.intersystems.com/post/indexing-non-atomic-attributes Know Your Indices(英文) Index creation fundamentals https://community.intersystems.com/post/know-your-indices Dynamic SQL to Dynamic Object(英文) Use DynamicSQL https://community.intersystems.com/post/dynamic-sql-dynamic-object 数据迁移工具 - 第一部分: 从 Postgres 到 IRIS 如何从其他数据库迁移到 IRIS 的系列文章 https://cn.community.intersystems.com/node/510831 BI与分析 BI和分析可以根据图形、仪表盘、摘要和详细表格中的数据分析,并根据分析员用户的导航和数据探索来做出决策。以下是如何使用IRIS建立分析应用的方法: 标题 描述 URL地址 InterSystems IRIS 上的 COVID-19 分析 分析全球疫情的仪表盘 https://community.intersystems.com/post/covid-19-analytics-intersystems-iris DeepSee Troubleshooting Guide(英文) Fix problems https://community.intersystems.com/post/deepsee-troubleshooting-guide AnalyzeThis – Quick start into InterSystems BI (英文) Quick start into IRIS BI https://community.intersystems.com/post/analyzethis-%E2%80%93-quick-start-intersystems-bi Power BI Connector for InterSystems IRIS. Part I(英文) Using IRIS data inside Power BI https://community.intersystems.com/post/power-bi-connector-intersystems-iris-part-i Creating Portlets in DeepSee(英文) Analytics Portlets with IRIS BI https://community.intersystems.com/post/creating-portlets-deepsee Game Of Throne Analytics or How long is Arya's Stark List(英文) Analytics sample https://community.intersystems.com/post/game-throne-analytics-or-how-long-aryas-stark-list DeepSee Web: InterSystems Analytics Visualization with AngularJS. Part 1(英文) Web dashboards using Angular https://community.intersystems.com/post/deepsee-web-intersystems-analytics-visualization-angularjs-part-1 Building Analytics Solution with IRIS(英文) Present main options to do analytics with IRIS https://community.intersystems.com/post/building-analytics-solution-iris Globals Globals 是IRIS中灵活存储和检索数据的关键机制,无论是SQL、类、JSON文档、BI立方体,还是其他自定义格式。在下面的文章中可以看到如何做到这一点: 题目 描述 URL地址 The Art of Mapping Globals to Classes 1 of 3(英文) Mapping globals to SQL tables and Objects https://community.intersystems.com/post/art-mapping-globals-classes-1-3 Globals 是管理数据的魔剑 : 第一部分 Globals 基础 https://cn.community.intersystems.com/node/520821 GlobalToJSON-embeddedPython-pure(英文) Export globals to JSON https://community.intersystems.com/post/globaltojson-embeddedpython-pure Transactions in Global InterSystems IRIS(英文) Manage transactions on Globals persistence https://community.intersystems.com/post/transactions-global-intersystems-iris Store Mindmaps using Globals(英文) Using globals to persist mindmap data https://community.intersystems.com/post/store-mindmaps-using-globals 安全 确保任何应用程序的安全是至关重要的。安全性与访问和授权管理有关,跟踪和审计交易,对存储和传输的内容进行加密,以及设置正确的配置参数以确保合理资源的保护。阅读这些文章,了解更多关于如何建立安全的信息: 标题 Description URL InterSystems IRIS 开放授权框架 (OAuth 2.0) 实现 – 第 1 部分 使用 OAuth https://cn.community.intersystems.com/node/484366 Debugging Web(英文) Debugging CSP and REST apps https://community.intersystems.com/post/debugging-web Class Queries in InterSystems IRIS(英文) Defining SQL Queries inside Persistent classes https://community.intersystems.com/post/class-queries-intersystems-iris 在TLS/SSL中使用操作系统的证书库 利用 OS 证书实现 SSL https://cn.community.intersystems.com/node/518186 一致性检查_ 加速还是减速 保证一致性 https://cn.community.intersystems.com/node/485041 跟踪数据更改 - 审计日志 - 上篇 保存审计数据 https://cn.community.intersystems.com/node/486831 Running the Management Portal (Private Web Server) Over TLS/SSL/HTTPS(英文) Configure SSL to IRIS Web Server https://community.intersystems.com/post/running-management-portal-private-web-server-over-tlssslhttps OAuth Authorization and InterSystems IRIS: Taming Trust Protocols(英文) Using OAuth https://community.intersystems.com/post/oauth-authorization-and-intersystems-iris-taming-trust-protocols Using Oauth2 with SOAP (Web)Services(英文) Oauth setting for SOAP services https://community.intersystems.com/post/using-oauth2-soap-webservices DeepSee: Setting up security - Part 1 of 5(英文) Security on IRIS BI https://community.intersystems.com/post/deepsee-setting-security-part-1-5 Changes to the security level of the system(英文) Security by default https://community.intersystems.com/post/changes-security-level-system DevOps DevOps是一种采用实践和工具的方式,使源代码从开发(Dev)到生产运行(Ops)的快速和高质量的过渡成为可能。请看如何在IRIS中做到这一点。 题目 描述 URL地址 Continuous Delivery of your InterSystems solution using GitLab - Part I: Git(英文) Continuous delivery with GitLab https://community.intersystems.com/post/continuous-delivery-your-intersystems-solution-using-gitlab-part-i-git Introducing InterSystems ObjectScript Package Manager(英文) Use ZPM to configure and install third-party packages inside your application https://community.intersystems.com/post/introducing-intersystems-objectscript-package-manager ZPMshow - a helper for tired fingers(英文) How to use ZPM – IRIS Package Manager https://community.intersystems.com/post/zpmshow-helper-tired-fingers 如何以自动化方式/编程方式创建一个镜像环境 自动化创建镜像 https://cn.community.intersystems.com/node/512986 ObjectScript包管理器中的单元测试和测试覆盖率 为ObjectScript 代码质量创建单元测试 https://cn.community.intersystems.com/node/486826 使用Doker和配置文件模版来部署Sharded 集群 使用 CPF文件自动化配置 https://cn.community.intersystems.com/node/518356 Caché ObjectScript 快速参考 ObjectScript reference pdf document https://cn.community.intersystems.com/node/523791 The Anatomy of ZPM Module: Packaging Your InterSystems Solution(英文) Use ZPM to automate deployment https://community.intersystems.com/post/anatomy-zpm-module-packaging-your-intersystems-solution 在IRIS容器里添加VSCode 在容器中嵌入 VSCode https://cn.community.intersystems.com/node/516431 如何以编程/自动化方式为InterSystems IRIS创建新的数据库、命名空间和Web应用程序 自动化创建数据库和命名空间 https://cn.community.intersystems.com/node/523796 Unit Tests: Quality of your ObjectScript Code(英文) Quality Assurance with Unit Tests https://community.intersystems.com/post/unit-tests-quality-your-objectscript-code 一些有用的 InterSystems 开发者社区 Docker Images镜像 Docker社区镜像 https://cn.community.intersystems.com/node/515076 互操作性 IRIS有一个强大的数据和应用互操作性总线。通过以下文章了解如何使用它. 题目 描述 URL Sending Alerts from Ensemble via Telegram(英文) Production to send data to telegram https://community.intersystems.com/post/sending-alerts-ensemble-telegram [首次使用InterSystems IRIS]-让我们来使用互操作性! 创建BS, BO, BP和productions https://cn.community.intersystems.com/node/513971 使用嵌入式Python实现InterSystems IRIS 互操作性 使用Python创建BS, BO, BP和production https://cn.community.intersystems.com/node/512176 Ensemble / Interoperability Training Course(英文) Great sample to learn how to create productions https://community.intersystems.com/post/ensemble-interoperability-training-course 几个程序化实现互操作性的示例 使用 Python 或 ObjectScript 程序化Productions https://cn.community.intersystems.com/node/516221 Listing files in folder(英文) List files in a folder https://community.intersystems.com/post/listing-files-folder Containerising .Net/Java Gateways (or Kafka Integration Demo)(英文) Kafka support using Java or .Net Native API https://community.intersystems.com/post/containerising-netjava-gateways-or-kafka-integration-demo Implementing IRIS Integrations with .NET or Java using PEX(英文) Using PEX to create productions using Java or .Net https://community.intersystems.com/post/implementing-iris-integrations-net-or-java-using-pex Migrate from Java Business Host to PEX(英文) Using PEX https://community.intersystems.com/post/migrate-java-business-host-pex Using Tesseract OCR and Java Gateway(英文) Using Java PEX https://community.intersystems.com/post/using-tesseract-ocr-and-java-gateway Creating a PEX Business Operation(英文) Create Java PEX Business Operation https://community.intersystems.com/post/creating-pex-business-operation 在IRIS中联合运用OCR与NLP技术 Java PEX 样例 https://cn.community.intersystems.com/node/494206 Creating a custom interoperability business service using an HTTP Adapter(英文) Creating Business Services https://community.intersystems.com/post/creating-custom-interoperability-business-service-using-http-adapter 原生 API IRIS对市场上最常用的一些编程语言(Java、Javascript/NodeJS、.Net、C++和Python)的工作持开放态度。为了做到这一点,我们为这些语言中的每一种使用了本地API。请看这些文章: 题目 描述 URL地址 WebSocket Client JS with IRIS Native API as Docker Micro Server(英文) Using IRIS and NodeJS to do a WebSocket https://community.intersystems.com/post/websocket-client-js-iris-native-api-docker-micro-server IRIS Native API for ObjectScript(英文) Using Native APIs https://community.intersystems.com/post/iris-native-api-objectscript Using ZPM for Node.js(英文) Using ZPM on Node.js projects https://community.intersystems.com/post/using-zpm-nodejs Creating a PDF from a Text file(英文) Java Native API for generating PDF https://community.intersystems.com/post/creating-pdf-text-file How to Start Development with InterSystems IRIS in Less Than a Minute(英文) Start to develop using IRIS https://community.intersystems.com/post/how-start-development-intersystems-iris-less-minute Making a blog using Python + IRIS Globals(英文) A blog on using Python native API https://community.intersystems.com/post/making-blog-using-python-iris-globals 希望我们翻译哪片文章,欢迎给我们留言!
文章
Jingwei Wang · 九月 16, 2022

Java 连接到InterSystems IRIS数据库 - 使用 JDBC

连接前准备: Java 开发环境 InterSystems JDBC 驱动 Connection String 步骤: 配置 Classpath :指向InterSystems JDBC 驱动 - intersystems-jdbc-3.0.0.0.jar Connection String,其中import com.intersystems.jdbc*;用来导入驱动,User是命名空间名称。 import com.intersystems.jdbc*; import java.sql.Connection; public class JDBCConnection{ public static void main (String[] args) throws Exception { String dbUrl = "jdbc:IRIS://127.0.0.1:1972/User"; //replace String user = "SQLAdmin"; String pass = "deployment-password"; IRISDataSource ds = new IRISDataSource(); ds.setURL(dbUrl); ds.setUser(user); ds.setPassword(pass); Connection dbconnection = ds.getConnection(); System.out.println("Connected to InterSystems IRIS via JDBC."); } }
公告
Claire Zheng · 九月 19, 2022

轻而易举!来InterSystems Ideas为你的想法分类吧!

开发者社区的同学们,大家好! 在 之前的公告 中,我们向大家介绍了InterSystems官方反馈门户 InterSystems Ideas! 今天想给大家介绍更多,尤其是涉及到的主题。 你可以按以下主题类别提交你的想法: 💡 InterSystems Products(InterSystems产品) 在这里,您可以在这里发布与我们产品发展相关的创意和想法: InterSystems IRIS数据平台 InterSystems IRIS for Health(医疗版)数据平台 InterSystems HealthShare InterSystems TrakCare 💡 InterSystems Services(InterSystems服务) 您可以在这里发表如何使我们的服务变得更好的想法: Developer Community (开发者社区) Open Exchange app gallery(Open Exchange应用库) Global Masters gamification platform(Global Masters游戏平台) Partner Directory(供应商目录) Documentation(文档) Certification(认证) Learning (学习) 以及InterSystems Ideas Portal 还有一个主题类别是 "Other(其他)" ,如果您的创意和想法与上述两类不直接相关,可以放在这个类别下。 选择好类别(Category)后,您也可以自由添加合适的关键字/标签: 如果您认为还有哪些类别和关键字值得被添加到这里,欢迎随时与我们分享! 点击一下,来 InterSystems Ideas portal 提出你的意见和建议吧✌️
文章
Michael Lei · 九月 12, 2022

分析InterSystems开发者社区的的开放应用

针对InterSystems开发者社区的分析。使用InterSystems IRIS BI (DeepSee)、Power BI和Logi Report Designer制作的项目,可视化并分析InterSystems 开发者社区上的成员、文章、问题、答案、观点和其他内容和活动。 你可以看到自己的活动、文章和问题。跟踪你的贡献如何改变开发者社区。 使用IRIS BI、Adaptive Analytics、InterSystems Reports、Tableau和Power BI分析关于你和你朋友的统计数据。 该项目包含预配置的IRIS和Atscale在Docker容器中的部署以及BI系统的项目文件。 更多细节信息请见相应应用的README。 这个项目也支持在线部署,你可以在这里查看。
公告
Nicky Zhu · 三月 30, 2021

Caché、Ensemble和InterSystems IRIS的维护版本发布

现已推出三套新的维护版本: Caché 2018.1.5, Ensemble 2018.1.5, and HSAP 2018.1.5 InterSystems IRIS 2019.1.2, IRIS for Health 2019.1.2, and HealthShare Health Connect 2019.1.2 InterSystems IRIS 2020.1.1, IRIS for Health 2020.1.1, and HealthShare Health Connect 2020.1.1 安装包和容器版本可从以下网站下载 WRC Software Distribution site。 这些都是维护版本,在广泛的领域内有许多更新。 有关这些版本中的修正信息,请参考该版本的文档,其中包括发行说明和升级检查表、发行变更列表,以及类参考资料和全套指南、参考资料、教程和文章。所有的文档都可以通过以下方式获得 docs.intersystems.com 。 在这些版本中也加入了新的平台支持。 特别是,Ubuntu 20.04 LTS的支持已经添加到所有版本中,IBM AIX 7.1和7.2对System p-64的支持已经添加到2019.1.2中(并且已经在2020.1中),而对Linux的ARM64支持已经添加到2020.1.1中。 详情请参见各版本的支持平台文档。 这些版本的构建号如下表所示: 版本 产品 构建号 2018.1.5 Caché and Ensemble 2018.1.5.659.0 2018.1.5 Caché Evaluation 2018.1.5.659.0su 2018.1.5 HealthShare Health Connect (HSAP) 2018.1.5HS.9056.0 2019.1.2 InterSystems IRIS 2019.1.2.718.0 2019.1.2 IRIS for Health 2019.1.2.718.0 2019.1.2 HealthShare Health Connect 2019.1.2.718.0 2020.1.1 InterSystems IRIS 2020.1.1.408.0 2020.1.1 IRIS for Health 2020.1.1.408.0 2020.1.1 HealthShare Health Connect 2020.1.1.408.0 2020.1.1 InterSystems IRIS Community 2020.1.1.408.0 2020.1.1 IRIS for Health Community 2020.1.1.408.0 2020.1.1 IRIS Studio 2020.1.1.408.0
文章
Jeff Liu · 九月 22, 2021

IRIS 2021 技术文档 First Look 14-- JDBC 和 InterSystems 数据库

本文档介绍了如何使用 InterSystems JDBC 驱动程序连接到 InterSystems IRIS®数据平台实例,这样您就可以在 InterSystems IRIS 中使用 Java。 要浏览所有的技术概要(First Look),包括可以在 InterSystems IRIS 免费的评估实例上执行的那些,请参见 InterSystems First Looks(《InterSystems 技术概要》)。 JDBC:如何在 InterSystems IRIS 中使用它 InterSystems 提供了完全兼容的(JDBC 4.2)、纯 Java、type 4 JDBC 驱动程序,它是一个独立的 JAR 文件,没有任何依赖性。如果您已经熟悉 JDBC,并且安装了 JDK 1.8,那么您需要做的就是将 JDBC 驱动程序添加到本地 CLASSPATH 中(请参见 JDBC:Exploring It [《JDBC:探索它》] )。JDBC URL(连接字符串)是: jdbc:IRIS://ipAddress:superserverPort/namespace 其中的变量表示 InterSystems IRIS 实例主机的 IP 地址、实例的超级服务器端口和实例上的命名空间。 如果您连接到本地计算机上的一个实例(使用主机名 localhost 或 IP 地址 127.0.0.1),该连接可以使用一种特殊的、高性能的本地连接,称为共享内存连接(shared memory connection)。有关共享内存连接(shared memory connection)的更多信息,请参见 "JDBC:What's Unique about Shared Memory Connections(《JDBC: 共享内存连接的独特之处》)"。 本文档的重点是让您体验一下在 InterSystems IRIS 中使用 JDBC,而不是让您陷入细节困境 ,所以我们保持了简单的探索。但是,当您把 InterSystems IRIS 引入您的生产系统时,您需要做很多不同的事情,例如(但不限于)安全性方面。所以请确保不要把这种对 InterSystems IRIS 的探索与真实的情况相混淆! 本文档末尾提供的参考资料将使您对在生产中使用 JDBC 与 InterSystems IRIS 的情况有一个很好的了解。 JDBC:InterSystems IRIS Java 连接选项的一部分 InterSystems IRIS JDBC 驱动程序是 InterSystems IRIS 的核心 Java 组件,支持传统的关系(SQL)访问。它还为使用 InterSystems IRIS Native API for Java 的 Java 调用提供连接机制,这些调用可以访问本机存储格式中的数据。对于基于对象的 Java 集成,InterSystems IRIS 还提供一个单独的功能------InterSystems IRIS XEP 组件(InterSystems IRIS XEP component)。 综上所述,InterSystems IRIS 提供了一组独特的功能,可以使用相同的物理连接和事务环境来使用多个范例(本机[native]、关系[relational]和面向对象[object-oriented])操作数据。对于更复杂的应用程序,InterSystems 完全支持 Hibernate。支持所有这些连接形式的------InterSystems IRIS XEP、Hibernate 以及 InterSystems IRIS Spark 连接器(Connector)------是 InterSystems IRIS JDBC 驱动程序。 技术概要: JDBC 和 InterSystems 数据库 1 JDBC:探索它 JDBC: 共享内存连接(Shared Memory Connections)的独特之处 与其他数据库平台一样,到远程 InterSystems IRIS 实例的 JDBC 连接是通过 TCP/IP 进行的。为了最大限度地提高性能,InterSystems IRIS 还提供了 Java 共享内存连接(shared memory connection)。与 InterSystems IRIS 实例在同一计算机上运行的许多 Java 应用程序都可以使用共享内存连接(shared memory connection)。 共享内存连接(shared memory connection)是一个临时设备,支持虚拟内存,由 JDBC 客户端和运行在同一物理计算机上的 InterSystems IRIS 实例共享。此外,这些连接不需要对内核网络堆栈进行潜在的昂贵调用。通过使用直接从 JDBC 客户端到 InterSystems IRIS 的通道,它们最终为 JDBC 操作提供了低延迟和高吞吐量。 有关共享内存(shared memory connection)的详细信息,请参见 Using Java with the InterSystems JDBC Driver(《在 InterSystems JDBC 驱动程序中使用 Java》)中的 "Shared Memory Connections(共享内存连接)"。 JDBC:探索它 我们开发了一个演示,向您展示如何使用 JDBC 和 InterSystems IRIS------以及这是多么地简单。 请注意,这段代码并没有演示 InterSystems Java 共享内存连接(shared memory connection)的性能提升,因为它无法处理共享内存连接(shared memory connection)可以高效处理的大量数据。 想试试 InterSystems IRIS Java 开发和互操作性功能的在线视频演示吗?请查看 Java QuickStart(Java 快速入门)! 用前须知 要使用该程序,您需要在一个系统上工作,安装 JDK 1.8 版本和您选择的 Java IDE,并连接一个正在运行的 InterSystems IRIS 实例。您对 InterSystems IRIS 的选择包括多种已授权的和免费的评估实例;实例不需要由您正在工作的系统托管(尽管它们必须相互具有网络访问权限)。有关如何部署每种类型的实例的信息(如果您还没有可使用的实例),请参见 InterSystems IRIS Basics: Connecting an IDE(《InterSystems IRIS 基础:连接一个 IDE》)中的 Deploying InterSystems IRIS(部署 InterSystems IRIS)。使用同一文档中的 InterSystems IRIS Connection Information(InterSystems IRIS 连接信息)和 Java IDE 中的信息,将 IDE 连接到您的 InterSystems IRIS 实例。对于这个演示,您可以连接到 USERnamespace,如下面的代码所示,或者您可以指定在已安装的实例中创建的另一个命名空间。 您还需要将 InterSystems IRIS JDBC 驱动程序 intersystems-jdbc-3.0.0.jar 添加到您的本地 CLASSPATH。您可以从 https://github.com/intersystems/quickstarts-java/tree/master/lib 下载这个文件。如果您已经在您的本地计算机或您能访问的另一台计算机上安装了 InterSystems IRIS,您可以在 install-dirdevjavalibJDK18 中找到该文件,其中 install-dir 是 InterSystems IRIS 的安装目录。 尝试示例代码 将示例代码剪切并粘贴到您的 IDE 中,使用 InterSystems IRIS Basics: Connecting an IDE(《InterSystems IRIS 基础:连接一个 IDE 》)中的connection settings described for your instance(为您的实例描述的连接设置)更新 url 和连接(connecttion)变量以及用户名和密码。 . import java.sql.*; public class JDBCSample { ​ public static void main(String[] str) throws Exception { String url = "jdbc:IRIS://127.0.0.1:1972/USER"; ​ Class.forName("com.intersystems.jdbc.IRISDriver"); ​ Connection connection = DriverManager.getConnection(url,"_SYSTEM","SYS"); // Replace _SYSTEM and SYS with a username and password on your system ​ String createTable = "CREATE TABLE People(ID int, FirstName varchar(255), LastName varchar(255))"; String insert1 = "INSERT INTO People VALUES (1, 'John', 'Smith')"; ​ String insert2 = "INSERT INTO People VALUES (2, 'Jane', 'Doe')"; String query = "SELECT * FROM People"; ​ Statement statement = connection.createStatement(); statement.executeUpdate(createTable); statement.executeUpdate(insert1); statement.executeUpdate(insert2); ​ ResultSet resultSet = statement.executeQuery(query); System.out.println("Printing out contents of SELECT query: "); while (resultSet.next()) { ​ System.out.println(resultSet.getString(1) + ", " + resultSet.getString(2) + ", " + resultSet.getString(3)); ​ } ​ resultSet.close(); statement.close(); connection.close(); ​ } ​ } 如果连接和查询已经成功完成,您应该会看到一个控制台窗口(console window),其中包含 SELECT 查询的结果。 4 了解有关 JDBC 的更多信息 要了解有关 JDBC、InterSystems IRIS 中的其他 Java 互操作性技术和其他相关主题的更多信息,请参见: Using Java JDBC with InterSystems IRIS(《在 InterSystems IRIS 中使用 Java JDBC》)中的 "InterSystems Java Connectivity Options(InterSystems Java 连接选项)"------对JDBC 驱动程序支持的所有 InterSystems IRIS Java 技术的概述。 Using Java with the InterSystems JDBC Driver(《在 InterSystems JDBC 驱动程序中使用 Java》)------InterSystems 文档:step-by-step instructions for using JDBC(《使用 JDBC 的详细说明》)。 First Look: XEP Object Persistence with InterSystems IRIS(《技术概要: 使用 InterSystems IRIS 持久化 XEP 对象》)------InterSystems 文档:Java XEP First Look(《Java XEP 技术概要》) First Look:InterSystems IRIS Native API for Java(《技术概要: InterSystems IRIS Native API for Java》)------InterSystems 文档:InterSystems IRIS Native API First Look(《InterSystems IRIS Native API 技术概要》) Java Overview(《Java 概述》)------InterSystems 在线学习:介绍视频 Persisting Java Objects with InterSystems XEP(《使用 InterSystems XEP 持久化 Java 对象》)------InterSystems 文档:step-by-step instructions for using XEP(《使用 XEP 的详细说明》) InterSystems Implementation Reference for Java Third Party APIs (《Java 第三方 API 的 InterSystems 实施参考》)------InterSystems 文档:connecting to InterSystems IRIS using JDBC, Hibernate, and Spark(《使用 JDBC、Hibernate 和 Spark 连接 InterSystems IRIS》)。 Using the InterSystems Spark Connector(《使用 InterSystems Spark 连接器》)------InterSystems 文档:using InterSystems IRIS as an Apache data source(《使用 InterSystems IRIS 作为 Apache 数据源》) Hibernate and JDBC compared(《Hibernate 和 JDBC 的比较》)------栈溢出(Stack Overflow)的文章
文章
Nicky Zhu · 九月 9, 2021

IRIS 2021 技术文档 First Look 22 -- 技术概要:部署 InterSystems 分片集群

本文档将您介绍InterSystems IRIS®数据平台的分片(sharding)功能,以及它在分片集群中的使用,以水平扩展 InterSystems IRIS 的数据量。 作为本指南的一部分,您将使用 ICM 在公共云中提供的分片集群,并了解分片表(sharding a table)如何在集群中的分片之间分布其行。 分片(Sharding)如何帮助您? 您感受到大数据(Big Data)的热度了吗? 无论是否准备好了,我们都在管理比以往任何时候都多的数据,并被要求用这些数据做更多的事情——所需的响应时间也越来越短。无论您是照顾一千万名患者、每天处理数十亿的金融订单,追踪一个星系的恒星,还是监控一千个工厂的引擎,数据平台不仅要支持您目前的数据工作量,而且还必须在保持性能的同时进行扩展(Scale),以满足不断增长的需求,避免业务中断。每个特定业务的工作量对其运行的数据平台提出了不同的挑战 — 而随着工作量的增加,这些挑战将变得更加严峻。 InterSystems IRIS 包含一套全面的功能来扩展(Scale)您的应用程序,这些功能可以单独或组合应用,这取决于您的工作量的性质和它所面临的特定性能挑战。其中之一是分片(sharding),它在多个服务器上对数据及其相关缓存进行分区,为查询和数据摄取提供灵活、价优的性能扩展,同时通过高效的资源利用使基础设施价值最大化。InterSystems IRIS 分片集群(sharded cluster) 可以为各种应用程序提供显著的性能优势,特别是对于那些工作量包括以下一项或多项的应用程序: 高容量或高速数据摄入,或组合。 相对较大的数据集,返回大量数据的查询,或两者兼有。 执行大量数据处理的复杂查询,例如扫描磁盘上的大量数据或涉及大量计算工作的查询。 这些因素各自都会影响分片(sharding)的潜在收益,但如果将它们结合起来,收益可能会得到增强。例如,所有这三个因素的组合——快速摄入的大量数据、大型数据集以及检索和处理大量数据的复杂查询——使得如今的许多分析工作量非常适合进行分片(sharding)。 请注意,这些特征都与数据有关;InterSystems IRIS 分片(sharding)的主要功能是扩展数据量(sharded cluster)。但是,当涉及部分或所有这些数据相关因素的工作量也经历了来自大量用户的非常高的查询量时,分片集群也可以包括扩展用户量(scale for user volume)功能。分片(sharding)也可以与垂直扩展相结合。通过 InterSystems IRIS,您可以为工作量的性能挑战创建恰到好处的整体扩展解决方案。 分片(Sharding)是如何工作的? 分片架构的核心是跨多个系统对数据及其相关缓存进行分区。分片集群将大型数据库表水平(即按行)划分为多个 InterSystems IRIS 实例,称为数据节点(data node),同时允许应用程序通过这些实例中的任何一个访问这些表。每个数据节点在集群分片数据中的份额被称为分片(shard)。这种架构有三个优势: 并行处理(Parallel processing) 查询在数据节点上并行运行,合并查询结果,并作为完整的查询结果返回给应用程序,在许多情况下显著提高了执行速度。 分区缓存(Partitioned caching) 每个数据节点都有自己的专用缓存,而不是由单个实例的缓存为整个数据集服务,这大大降低了缓存溢出和强制降低性能的磁盘读取的风险。 并行加载(Parallel loading) 数据可以并行加载到数据节点上,从而减少摄取工作量和查询工作量之间的缓存和磁盘争夺,提高两者的性能。 一个被称为分片管理器(sharding manager)的联合软件组件会跟踪哪些数据位于哪些数据节点上,并相应地指导查询。非分片数据存储在配置的第一个数据节点上,称为数据节点 1 (它也存储代码和元数据)。从应用程序 SQL 的角度来看,分片表(sharded table)和非分片表(nonsharded table)之间的区别是完全透明的。 图 1: 一个基本的分片集群 试一试!部署和演示 InterSystems IRIS 分片集群 在这次探索中,您将 使用 InterSystems 云管理器(InterSystems Cloud Manager,ICM)在公共云中部署基本的分片集群。 ICM 是一个自动化的命令行工具,可以轻松地在云中配置基础设施,并在提供的节点上部署 InterSystems IRIS 和其他服务。ICM 负责所有需要的 InterSystems IRIS 配置,所以如果您指定了一个分片集群,该集群在部署完成后就可以使用了。 使用不同的分片键(shard key)从相同的数据中创建三个分片表(sharded table),并观察数据节点上跨分片的行的不同分布。 分片键是用来确定分片表的哪些行存储在哪些分片上的一个或多个字段。默认情况下,RowID 被用作分片键,这种分布对于大多数分片表来说是最有效的方法,因为它提供了数据均匀分布的最佳保证,并允许最有效的并行数据加载。然而,在一种情况下,用户定义的键可能是有益的。当您对在字段或用于连接它们的字段上的查询中经常连接的两个大表进行分片时,要连接的行被存储在相同的分片上,并且连接可以在每个分片上本地执行,而不是跨分片执行(across the shard),从而提供显著的性能提升。这被称为 cosharded 连接(cosharded join)。 在所有三个分片表上运行相同的查询,以证明跨分片的行分布对查询是完全透明。 为了向您介绍分片(sharding),而又不至于让您在细节上陷入困境,我们保持了简单的探索。生产中的分片集群需要计划和许多决策,所以确保不要把对分片(sharding)的探索和真实情况相混淆!例如,在设计一个生产集群时,您将检查您的架构和表,以决定哪些表将被分片,然后根据分片数据的预期工作集和服务器上数据库缓存的可用内存量,决定部署多少个数据节点(通常为 4 到 16 个)。然而,在本次探索中,您将部署一个由两个数据节点组成的基本集群。本文档末尾列出的参考资料将使您对生产中使用分片(sharding )的情况有一个很好的了解。Scalability Guide(《可扩展性指南》)中的 "Horizontally Scaling for Data Volume Sharding(《水平扩展数据卷分片[Sharding]》)"一章提供了有关分片(sharding)和分片集群的详细信息。 这些说明假定您有 InterSystems IRIS 分片(sharding)许可证并可以访问 InterSystems 软件下载。 使用 ICM 部署集群 您可以在 First Look:InterSystems Cloud Manager(《技术概要:InterSystems 云管理器》)中找到使用 ICM 在亚马逊网络服务(Amazon Web Services)公共云平台上部署分片集群的程序;特别是在 Try It!Deploy InterSystems IRIS in the Cloud with ICM(试一试!使用 ICM 在云中部署 InterSystems IRIS)部分。您可以使用此处显示的整个程序。当您进入自定义定义.json(Customize definitions.json)时,验证每个 LicenseKey 字段的值是否是 defaults.json 文件中 LicenseDir 字段指定的暂存位置中的 InterSystems IRIS 分片(sharding)许可证的文件名。当您完成了部署阶段(部署 InterSystems IRIS[Deploy InterSystems IRIS])后,留在 ICM 容器中。 注意: 正如 Scalability Guide(《可扩展性指南》)中的 Deploying the Sharded Cluster(部署分片集群) 所描述的那样,您也可以在现有的物理、虚拟或云机器上安装 InterSystems IRIS 实例,并使用分片 API(Sharding API) 或管理门户(Management Portal)部署分片集群,或使用多种方法之一自动化部署分片集群。 使用不同的分片键以不同的方式分布行,然后查询分片表 为了了解分片集群如何根据您使用的分片键(shard key)在数据节点上的分片上对分片表(sharded table)进行分区,您将连接到集群并执行以下步骤: 创建并填充一个小型的非分片表。 使用三个不同的分片键,创建三个与非分片表具有相同字段的分片表 。 从非分片表中填充分片表。 从分片表中选择行,以查看在每种情况下,行在分片(数据节点)上的分布情况。 当一个表被分片时,RowID 值被从每个分片的不同范围分配,从相隔甚远的范围开始;相同范围的行在同一个分片上。当处理一个小表时,就像本例一样,分片的 RowID 很容易区分,清楚地告诉您哪些行在一个分片上,哪些在另一个分片上(尽管您无法分辨哪个分片是哪个)。在 RowID 上分片的表的行的分布方式与行中的数据没有关系,如果您清空并重新加载一个表,可能会有所不同。另一方面,用户定义的分片键,根据键中一个或多个字段的值来分配行,因此当您清空并重新加载表(假设值和分片数没有改变)时将是相同的。 查询所有三个表以获得其中一个字段的最大长度,来显示跨分片(across shards)的行的分布对查询是透明的。 对于这部分探索,请使用以下程序: 为任意一个数据节点实例打开终端(Terminal)窗口。 在 ICM 命令行上, 发出命令 icm session 命令,使用 -machine 选项指定一个数据节点的名称,使用 - namespace 选项指定集群命名空间 IRISCLUSTER (或者使用默认文件中的 Namespace 字段指定的命名空间,如果不同的话)。 如果您不确定节点的名称,可以使用 icm inventory 命令来显示节点名称: $ icm inventory Machine IP Address DNS Name Region Zone Acme-DATA-TEST-0001 00.53.183.209 ec2-00-53-183-209.us-west-1.compute.amazonaws.com us-west-1 c Acme-DATA-TEST-0002 00.53.183.185 ec2-00-53-183-185.us-west-1.compute.amazonaws.com us-west-1 c 选择一个节点(哪个节点并不重要)并发出命令: icm session -machine Acme-DATA-TEST-0002 -namespace IRISCLUSTER icm session 命令为指定节点上的 InterSystems IRIS 实例打开一个终端(Terminal)窗口。 如果您使用 %SYSTEM.Cluster.Sharding API 手动部署您的集群,使用 InterSystems IRIS Basics:Connecting an IDE(《技术概要:连接一个 IDE》)中的procedure described for your instance(为您的实例描述的程序),在任一实例上打开一个终端(Terminal)窗口,然后切换到 IRISCLUSTER 命名空间 (或者初始化集群时指定的命名空间,如果不同的话)。 Node: Acme-DATA-TEST-0002, Instance: IRIS USER>set $namespace="IRISCLUSTER" IRISCLUSTER> 打开终端(Terminal)SQL shell:IRISCLUSTER>do $SYSTEM.SQL.Shell() [SQL]IRISCLUSTER>> 使用以下 SQL 语句,创建并填充非分片表 test.nonsharded。 CREATE TABLE test.nonsharded (field1 CHAR(5), field2 CHAR(5)) INSERT INTO test.nonsharded (field1,field2) VALUES ('one','one') INSERT INTO test.nonsharded (field1,field2) VALUES ('one','two') INSERT INTO test.nonsharded (field1,field2) VALUES ('one','three') INSERT INTO test.nonsharded (field1,field2) VALUES ('two','one') INSERT INTO test.nonsharded (field1,field2) VALUES ('two','two') INSERT INTO test.nonsharded (field1,field2) VALUES ('two','three') INSERT INTO test.nonsharded (field1,field2) VALUES ('three','one') INSERT INTO test.nonsharded (field1,field2) VALUES ('three','two') INSERT INTO test.nonsharded (field1,field2) VALUES ('three','three') 使用 SELECT 来查看表的内容: SELECT * FROM test.nonsharded field1 field2 one one one two one three two one two two two three three one three two three three 使用 test.nonsharded 中的相同字段创建三个分片表,在第一个表中使用默认的分片键(RowID),在第二个表中使用 field1 字段,在第三个表中使用 field2 字段,并使用从 test.nonsharded 中选择的 INSERT INTO 语句填充每一个: CREATE TABLE test.rowid (field1 CHAR(5), field2 CHAR(5), SHARD) INSERT INTO test.rowid (field1,field2) SELECT field1,field2 FROM test.nonsharded CREATE TABLE test.field1 (field1 CHAR(5), field2 CHAR(5), SHARD KEY (field1)) INSERT INTO test.field1 (field1,field2) SELECT field1,field2 FROM test.nonsharded CREATE TABLE test.field2 (field1 CHAR(5), field2 CHAR(5), SHARD KEY (field2)) INSERT INTO test.field2 (field1,field2) SELECT field1,field2 FROM test.nonsharded 使用 SELECT *,%ID 来显示每个分片表的内容和它在分片上的 RowID。 SELECT *,%ID FROM test.rowid ORDER BY %ID field1 field2 ID one one 1 one two 2 two one 3 two two 4 three three 5 one three 256000 two three 256001 three one 256002 three two 256003 这个分布并不反映 field1 或 field2 的值(具有各自全部三个值的行位于两个分片上)。如果您删除、重新创建并重新加载 test.rowid,分布可能会有所不同。 SELECT *,%ID FROM test.field1 ORDER BY %ID field1 one one one field2 one 1 two 2 three 3 ID two one 256000 two two 256001 two three 256002 three one 256003 three two 256004 three three 256005 在 field1 字段上分片(sharding)会分布行,使那些具有相同 field1 值的行被放在同一个分片上。在这种情况下,值为 1 的行在一个分片上,值为 2 和 3 的行在另一个分片上,但是哪个数值最终在哪个分片上取决于有多少个分片和多少个数值。 SELECT *,%ID FROM test.field2 ORDER BY %ID field1 field2 ID one one 1 two one 2 three one 3 one two 256000 one three 256001 two two 256002 two three 256003 three two 256004 three three 256005 这里,分布是由 field2 字段的值决定的。 最后,作为分片如何将工作分配到数据节点的示例,对所有三个分片表使用以下 SELECT 语句: SELECT MAX(LENGTH(field2)) FROM <table> 在每种情况下,结果都是 5,即最长值的长度是 3,因为跨分片的行分布对查询来说是完全透明的。 MAX(LENGTH(field2)) 表达式在每个分片上独立计算,分片管理器选择它们返回结果的 MAX()。例如,当查询在 test.field2 表上运行时,一个分片返回 3,因为它在 field2 字段中只有值 1 ,而另一个分片返回 5;然后分片管理器选择 5 作为两个结果中较大的那个。 如果您愿意,可以使用 EXPLAIN 来显示查询计划,明确指出如何将工作发送到分片上: EXPLAIN SELECT MAX(LENGTH(field2)) FROM <table> 更多分片集群选项 分片集群的其他选项包括如下内容: 您可以随时添加数据节点,并跨扩展的数据节点集重新平衡现有的分片数据。重新平衡(Rebal ancing)不能与查询和更新同时进行,因此只有在分片集群离线并且没有其他分片操作的情况下才能进行。( Scalability Guide[《可扩展性指南》]中的 Add Nodes and Rebalance Data[添加节点和重新平衡数据] ) 要为集群上的数据添加高可用性,您可以将数据节点部署为镜像故障转移对。( Scalability Guide[《可扩展性指南》]中的 Mirror for High Availability[高可用性镜像])。 对于需要极低查询延迟的高级用例(可能与不断涌入的数据相冲突),可以添加计算节点 ,为查询服务提供一个透明的缓存层。当集群包含计算节点时,只读的查询会自动在计算节点上并行执行,而不是在数据节点上执行;所有写入操作(插入、更新、删除和 DDL 操作)继续在数据节点上执行。这种分工将查询和数据摄取工作量分开,同时保持并行处理和分布式缓存的优势,提高两者的性能。(Scalability Guide[《可扩展性指南》]中的 Deploy Compute Nodes[部署计算节点]) 了解有关分片(Sharding)的更多信息 要了解有关分片的更多信息,请参见 Data Platform Scalability Technology Overview(《数据平台可扩展性技术概要》) (视频) Introduction to Sharding(《分片简介》) (在线课程) Sharding Basics(《分片基础》) (在线课程) Experience InterSystems IRIS in the Cloud(在云中体验 InterSystems IRIS) (在线体验) Scalability Guide(《可扩展性指南》) First Look:InterSystems Cloud Manager(《技术概要:InterSystems 云管理器》)
文章
Jeff Liu · 十月 26, 2021

IRIS 2021 技术文档 First Look 24 技术概要:容器中的 InterSystems 产品

本技术概要(First Look)通过重点概述和基本的实践示例,向您介绍在 InterSystems IRIS®数据平台上使用容器(Container)的基本原理。您将了解容器的目的、重要性和好处,以及 InterSystems 如何实现它们的具体细节。 有关 Docker 容器和 InterSystems IRIS 的完整文档,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》),以及 InterSystems Cloud Manager Guide(《InterSystems 云管理器指南》)的 ICM Overview(ICM 概述)章节。Learn More About InterSystems IRIS in Containers(了解容器中的 InterSystems IRIS 的更多信息)部分提供了到其他参考资料的链接。 要浏览所有的技术概要(First Look),包括可以在 InterSystems IRIS 免费的评估实例上执行的那些,请参见 InterSystems First Looks(《InterSystems 技术概要》)。 为什么是容器(Container)? 容器(Container)将应用程序打包成独立于平台、完全可移植的运行时解决方案(runtime solution),满足所有需求,但却隔离于任何依赖项(dependency)。具体来说,Docker 容器无处不在。因为所有主要的公共云基础设施即服务(Infrastructure as a Service,IaaS)供应商都支持 Docker,企业可以通过使用容器并让云供应商处理基础设施来降低成本和复杂性。 容器带来了以下所有的好处: 容器干净地划分代码和数据,提供完全分离的关注点,应用程序可轻松部署和升级。 容器是非常高效的;容器中的应用程序只包含运行它所需的元素(element),并使其能够访问所需的连接、服务和接口,而且容器作为单个进程运行,所占用的内存并不比任何其他可执行文件多。 容器支持应用程序在不同环境之间的清洁移动(clean movement)——例如,从开发到测试,再到生产——从而减少具有不同目标的部门之间的典型过程和管理冲突。开发人员可以专注于最新的代码和库(library),质量开发人员(quality developers)专注于测试和缺陷描述,运营工程师专注于整体解决方案的基础设施,包括网络、高可用性、数据持久性(data durability)等等。 容器提供了企业对业务和技术进行变革所需的敏捷性、灵活性和可重复性。容器将应用供应过程(包括构建阶段)与运行过程明确分开,企业可以采用统一的应用程序交付方法,包括更敏捷的交付方法(DevOps)和架构(微服务)。 这些优势使容器成为应用程序的天然构件块,推动应用程序交付和部署方法变得更简单、更快速、更可重复、更强大。 容器中的 InterSystems IRIS 因为容器只打包运行容器化应用程序所需的元素,并在本地执行应用程序,所以它提供标准的、易于理解的应用程序配置、行为和访问。如果您对在 Linux 上运行的 InterSystems IRIS 有经验,那么基于 Linux 的 InterSystems IRIS 容器在什么物理、虚拟或云系统和操作系统平台上运行并不重要;您以相同的方式与它们进行交互,就像在 Linux 系统上运行传统的 InterSystems IRIS 实例一样。 下面介绍 InterSystems IRIS 在如何使用容器方面的不同。 InterSystems 提供的映像(InterSystems-provided images)——容器映像(container image)是可执行包,而容器是映像(image)的运行时实例 (runtime instance)——即映像(image)在执行时在内存中变成的实例。InterSystems 提供包含完整安装的 InterSystems IRIS 实例的映像(image),以及其他相关映像(image)。有关 InterSystems 映像(image)的更多信息,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》)中的 Using InterSystems IRIS Images(使用 InterSystems IRIS 映像)。 在本文档的实践体验中,您将从 InterSystems 提供的 InterSystems IRIS 映像(image)中创建并启动一个容器。 Iris-main 程序(iris-main program)——iris-main 程序使 InterSystems IRIS 和其他产品能够满足在 Docker 容器中运行的应用程序的要求。入口点应用程序(entrypoint application),即容器启动时启动的主进程,需要阻塞(block)——即等待(wait),直到其工作完成,但启动 InterSystems IRIS 的命令并不作为一个阻塞进程(blocking process)运行。iris-main 程序通过启动 InterSystems IRIS 来解决这个问题,然后继续作为阻塞入口点应用程序(blocking entrypoint application)运行。有关 iris-main 的更多信息,请参见在 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》)中的 The iris-main Program(iris-main 程序)。 该程序还提供了许多选项,以帮助调整 InterSystems IRIS 在容器中的行为;您将在本文档的实践体验中使用一些 iris-main 选项。 持久化 %SYS 功能(durable %SYS feature)——因为容器化的应用程序与主机环境隔离,所以它不会写入持久化数据(persist data);当容器被移除并被新的容器取代时,它在容器内写入的任何内容都会丢失。因此,容器化应用部署的一个重要方面是安排数据存储在容器之外,并提供给其他和未来的容器使用。 当 InterSystems IRIS 在容器中运行时,持久化 %SYS 功能(The durable %SYS feature)能够持久地存储特定于实例的数据——如用户定义、审计记录以及日志、日记和 WIJ 文件——允许一个实例跨越多个容器。例如,如果您使用持久化 %SYS 运行 InterSystems IRIS 容器,您可以通过停止原始容器(the original container)并运行使用旧容器创建的特定于实例的数据(instance-specific data)的新容器来升级实例。 您将在本文档的实践体验中探索持久化 %SYS (durable %SYS)功能。有关持久化 %SYS(durable %SYS) 的详细信息,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》)中的 Durable %SYS for Persistent Instance Data(持久化 %SYS 的持久化实例数据)。 重要提示: InterSystems 的容器映像符合开放容器标准(Open Container Initiative,OCI)规范,并在 Docker 企业版(Enterprise Edition)引擎上使用广泛流行的容器 Ubuntu 操作系统构建,该引擎完全支持 OCI 标准,并允许映像在 Docker Hub 注册表中认证和展示。因此,InterSystems 映像在任何基于 Linux 操作系统的符合 OCI 标准的运行时引擎上都得到支持,无论是在自有云还是在公共云中。 InterSystems 云管理器(InterSystems Cloud Manager,ICM)在其提供的云基础设施以及现有的虚拟和物理基础设施上提供 InterSystems IRIS 容器和其他容器的自动部署。有关使用 ICM 部署容器化的 InterSystems IRIS 实例的更多信息,请参见 First Look:InterSystems Cloud Manager(《技术概要:InterSystems 云管理器》) 和 InterSystems Cloud Manager Guide(《InterSystems 云管理器指南》)。 3. 下载 InterSystems IRIS 映像(Image) 要使来自 InterSystemsInterSystems IRIS 映像(image)可用于本实践,您必须将映像(image)下载到您正在使用的系统中。以下替代方案描述了您可以或可能可以使用的 InterSystems IRIS 映像(image)。 您可以使用来自 InterSystems 容器注册表(InterSystems Container Registry,ICR)的 InterSystems IRIS 社区版(Community Edition)映像(image),该映像(image)包含可从 InterSystems 获得的所有映像(image)的存储库,如 Using the InterSystems Container Registry(《使用 InterSystems 容器注册表》)中所述。您也可以从 Docker Store 的 InterSystems IRIS 数据平台页面下载社区版(Community Edition)映像(image)。 InterSystems IRIS 社区版(Community Edition)有一个免费的内置 13个月的许可证(和一些功能限制);如果您在这次实践中使用社区版(Community Edition),您就不需要提供下一步(Add the License Key to the External Storage Location(添加许可证密钥到外部存储位置))中所述的许可证密钥。更多信息,请参见 Deploy and Explore InterSystems IRIS(《部署和探索 InterSystems IRIS》)中的 Deploy InterSystems IRIS Community Edition on Your Own System(在您自己的系统上部署 InterSystems IRIS 社区版)。 注意: 另一个选择是在 GCP、AWS 或 Azure 上提供一个承载运行中的 InterSystems IRIS 社区版(Community Edition)容器的云节点;更多信息,请参见 Deploy and Explore InterSystems IRIS(《部署和探索 InterSystems IRIS》)中的 Deploy InterSystems IRIS Community Edition on a Cloud Node(在云节点上部署 InterSystems IRIS 社区版)。如果您在这个练习中使用社区版(Community Edition)的云节点,您可以跳过接下来的两个步骤,并跳转到 Change the Instance and Commit the Container as a New Image(更改实例并将容器作为新映像提交)。 如果您是 InterSystems 客户,您可以使用 InterSystems 容器注册表(InterSystems Container Registry,ICR)发布的 InterSystems IRIS 映像(image)。Using the InterSystems Container Registry(使用 InterSystems 容器注册表)列出了 IRC 提供的 InterSystems IRIS 映像(image),并解释了如何使用您的 WRC 凭证对注册表进行身份验证,以便您下载。 您的企业可能有一个私有映像(image)注册表,其中包括一个或多个 InterSystems IRIS 映像(image)。如果是这样,请获取您需要的映像(image)的注册表、存储库和标签的位置,以及访问所需的凭证。 当您确定了要下载的注册表和需要的凭证(如果有)后,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品 》)中的 Downloadingthe InterSystems IRIS Image(下载 InterSystems IRIS 映像),了解下载 InterSystems IRIS 映像(image)的说明。 为了简单起见,这些说明假定您正在使用的映像(image)是 intersystems/iris:2021.1.0.205.0。 4. 添加许可证密钥到外部存储位置 与任何 InterSystems IRIS 实例一样,在容器中运行的实例需要一个许可证密钥(通常称为 iris.key)。 从 Docker Store 获得的 InterSystems IRIS 社区版(Community Edition)映像(在上一节中进行了描述)带有一个免费的内置临时许可证。然而,一般来说,许可证密钥没有也不能包含在 InterSystems IRIS 容器映像(container image)中,而是必须在容器启动后复制到容器中,以便激活运行在其中的 InterSystems IRIS 实例。iris-main 程序为此提供了一个选项,但它要求您把许可证密钥放在一个作为外部 volume 挂载的存储位置;下一节提供了使用说明。要了解有关 InterSystems IRIS 容器的许可证密钥的更多信息,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》)中的 License Keys for InterSystems IRIS Containers(InterSystems IRIS 容器的许可证密钥)。 将您的 InterSystems IRIS 许可证密钥文件 iris.key 复制到外部存储位置。 5. 从 InterSystems IRIS 映像(Image)运行容器 一旦您在本地机器上使 InterSystems IRIS 映像(image)可用,确定了外部存储位置并在其上放置了许可证密钥,您就可以使用 docker run 命令来创建和启动容器了。Docker run 命令实际上结合了三个独立的命令,如下所示: docker pull — 如果本地不存在映像(image),则下载一个。 docker create — 从映像(image)中创建一个容器。 docker start — 启动容器。 这些命令中的每一个都是单独有用的,在不同的背景下有不同的用途。更多信息,请参见 Docker 文档中的Docker run reference(Docker 运行参考资料) 。 下面是一个 docker run 命令的示例;所附文本对所有选项都作了解释。请注意,docker run 命令的选项出现在命令行中映像(image)规范之前,而 InterSystems iris-main 程序的选项(请参见 InterSystems IRIS in Containers(《容器中的 InterSystems IRIS》))出现在之后。在这种情况下,作为 docker run 一部分的 pull 命令不需要运行,因为您已经下载了您想使用的 iris 映像(image)。 docker run --name iris --detach --publish 52773:52773 --volume /nethome/pmartinez/iris_external:/external intersystems/iris:2021.1.0.205.0 --key /external/iris.key --name 容器名称(container name) 指定容器的名称,您可以在其他 Docker 命令中用它来引用该容器,例如,当您想停止该容器时,使用 docker stop container name 。 --detach 在后台运行容器(并显示容器的唯一 ID)。 --Publish 主机端口:容器端口(host_port:container_port) 将容器内的端口发布到主机上的端口,这样容器外(在主机上或其他机器上)的实体就可以与容器内的程序联系。例如,InterSystems IRIS 实例的管理门户(Management Portal)是通过实例的 Web 服务器端口(默认为 52773)访问的。如果容器内的这个端口发布到主机上的端口,那么可以使用主机的端口将实例的管理门户(Management Portal)加载到浏览器中。 --volume 外部存储路径:内部 volume(external_storage_path:internal_volume) 挂载容器可访问的外部存储位置作为容器内部的存储 volume。有关哪些存储位置可以以这种方式挂载以及可能需要的 Docker 配置的信息,请参见 Docker 文档中的 Use Volumes(使用 Volumes ) 。 重要提示: InterSystems 不支持在 InterSystems IRIS 容器中把 NFS 位置作为外部 volume 挂载。 存储库/映像:标签(repository/image:tag) 指定要提取并用于创建容器的映像(请参见 Download the InterSystems IRIS Image(下载 InterSystems IRIS 映像))。使用 docker images 命令来列出可用的映像(image),并确保您指定的是正确的映像(image)。 --Key 许可证密钥路径(license_key_path) iris-main 选项,它标识了要安装在容器实例中的 InterSystems IRIS 许可证密钥;这个位置必须是在一个挂载的 volume 上。 使用前面的示例和说明来构建您自己的 docker run 命令,并在命令行上执行。当命令完成后,使用 docker ps 命令可以在列表中看到您的容器,状态为 Up。 试一试! 创建您自己的基于 InterSystems IRIS 的容器 $ docker run --name iris --detach --publish 52773:52773 --volume /nethome/pmartinez/iris_external:/external intersystems/iris:2021.1.0.205.0 --key /external/iris.key 426d4a511d6746d89ec2a24cf93b29aa546ea696b479a52210d37da4c6d04883 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS 426d4a511d67 intersystems/iris:2021.1.0.205.0 "/iris-main --key ..." 5 seconds ago Up 3 seconds PORTS NAMES 0.0.0.0:52773->52773/tcp iris 注意: InterSystems IRIS 社区版(Community Edition)映像(请参见 Download the InterSystems IRIS Image(下载 InterSystems IRIS 映像))不需要--key 选项 ,该映像附带一个免费的内置许可证。 如果映像尚未在本地存在,但在您组织的存储库中——请参见 Download the InterSystems IRIS Image(下载 InterSystems IRIS 映像),Docker 会在创建和启动容器之前拉取(下载)该映像(image)。 如示例所示,创建容器后,Docker 输出 UUID 长标识符(long identifier); 前 12 个字符组成 UUID 短标识符(short identifier),用于标识其他输出中的容器,例如来自 docker ps 命令的容器。 6.更改实例并将容器作为新映像(Image)提交 当您更改容器内运行的程序时,您可以使用 docker commit 命令从容器中创建一个新映像(image)。这个新映像(image)与您创建容器的原始映像(image)相同,但包括您对容器所作的更改。要了解其工作原理,请遵循以下步骤: 打开容器中 InterSystems IRIS 实例的管理门户(Management Portal)。实例的管理门户(Management Portal)的 URL 包含了实例的主机标识符和 web 服务器端口号 。 主机标识符是运行容器的系统的主机名或 IP 地址;如果您的浏览器与容器运行在同一个系统上,则可以使用 localhost。 Web 服务器端口号是您在使用 docker run 启动容器时发布的实例的 web 服务器端口号,即 52773 的主机端口号。假设您包含了--publish 52773:52773,正如上一节末尾的示例命令中提供的那样,web 服务器端口号是 52773。 例如,在容器主机上,Web 服务器端口为 52773,管理门户(Management Portal)的 URL 将是 http://localhost:52773/csp/sys/%25CSP.Portal.Home.zen。 使用预定义用户帐户之一登录,例如 _SYSTEM,其默认密码是 SYS(请参见 Predefined User Accounts(预定义用户账户))。出于安全考虑,在第一次登录(使用管理门户(Management Portal)或 iris terminal 命令)到容器化的 InterSystems IRIS 实例上的任何预定义账户时,系统会立即提示您更改密码。 注意: 有关更改预定义帐户(强烈建议在生产中这样做)的默认密码(包括在脚本和自动部署中)的更多信息,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》)中的 Authentication and Passwords (身份验证和密码)。 从主页上,选择 System Administration(系统管理) > Configuration(配置) > System Configuration(系统配置) > Namespaces(命名空间) 来显示 Namespaces(名称空间) 页面,然后点击 Create New Namespace(创建新的命名空间) 按钮来显示 New Namespace(新的命名空间) 页面。 创建名为 USER2 的命名空间,方法是在 Name of the namespace box(命名空间框的名称)中输入 USER2,从 Copy from 下拉菜单中选择 USER,清除 Enable namespace for interoperability productions(为互操作性产品启用命名空间) 复选框并确认,点击 Save(保存) 按钮,最后确认您想要复制所有属性和映射。 然后点击 Copy Namespace Mappings(复制命名空间映射) 页面上的 Close(关闭) ,返回到 Namespaces(命名空间) 页面,在该页面上列出了 USER2 命名空间。 您现在已经改变了容器中的实例。 接下来,停止该容器并将其作为名为 iris2 的新映像(image)提交,然后列出可用的映像。 $ docker stop iris $ docker commit iris acme/iris2:test sha256:7b4adb9f7abf1490a39086665ccd3d255c05163c25cb9a3de8e9421f6ca16b40 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE acme/iris2 test 421f6ca16b40 8 seconds ago 1.40GB intersystems/iris 2020.3.0.221.0 15627fb5cb76 1 hour ago 1.39GB centos 7.3.1611 262f7381844c 2 weeks ago 192MB hello-world latest 05a3bd381fc2 7 months ag 1.84kB 最后,删除从原始 iris 映像创建的容器。 $ docker rm iris iris 7.运行和调查第二个基于 InterSystems IRIS 的容器 为了总结这一体验,您将使用 docker run 命令从您刚刚提交的基于 InterSystems-IRIS 的映像中创建并启动一个容器,包括用于持久化特定于实例的数据的持久化 %SYS 功能(durable %SYS feature)。持久化 %SYS (durable %SYS)是保存特定于实例的数据以及您对它所做的任何更改的一种更有用的方法。因为这些数据被保存在容器之外,它可以成为新的 InterSystems IRIS 容器的数据,允许您通过运行后面的映像(image)的容器来升级 IRIS 实例,同时保留以前的容器的数据;当内部容器更改提交到新映像时,这是不可能的。有关持久化 %SYS (durable %SYS)的详细信息,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》)中的 Durable %SYS for Persistent Instance Data(持久化实例数据的持久化 %SYS )。当您启动新容器后,将执行以下操作: 确认在作为一个新映像(image)提交的容器中创建的命名空间(请参见 Change the Instance and Commit the Container as a New Image(更改实例并将容器作为新映像提交))存在于新容器中的 InterSystems IRIS 实例中。 在容器中更改 InterSystems IRIS 实例的设置,并查看它反映在容器外持久化 %SYS (durable %SYS)数据中。 确认您添加的演示文件在容器内存在。 要做到这一点,请遵循以下步骤: 为这个容器确定一个外部存储位置。您可以使用在 Add the License Key to the External Storage Location(添加许可证密钥到外部存储位置)中为前一个容器选择的许可证密钥,也可以选择一个新的。许可证密钥应该仍然在以前的位置。(如果您使用一个新的位置,请确保许可证密钥已经到位)。 创建一个 docker run 命令,类似您在 Run a Container from the InterSystems IRIS Image(从 InterSystems IRIS 映像运行容器)中执行的命令, 基于那里的指令,但有两个更改。 添加选项 --env ISC_DATA_DIRECTORY=pathname 标识持久化 %SYS(durable %SYS) 目录,即写入 InterSystems IRIS 实例的持久化数据(persistent data)的位置。持久化 %SYS目录(durable %SYS directory)必须在一个挂载的 volume 上(请参见--volume 选项和 Add the License Key to the External Storage Location(添加许可证密钥到外部存储位置))。 注意: InterSystems 建议指定挂载 volume 的子目录为持久化 %SYS 的位置。下面的 docker ps 示例显示了这一点。 使用映像:标签(image:tag) 指定新映像 之前,您从 intersystems/iris:2021.1.0.205.0 (即 InterSystems 提供的映像)创建了容器;这次,您使用的是 acme/iris2:test,这是您通过提交更改过的 iris 容器创建的。 调用容器 iris2。当 docker run 命令完成后,使用 docker ps 命令来列出容器并查看其状态。例如: $ docker run --name iris2 --detach --publish 52773:52773--volume /nethome/pmartinez/iris_external:/external --env ISC_DATA_DIRECTORY=/external/durable acme/iris2:test --key /external/iris.key bdfe214ef76a34290a8308cddce92162aae14df1ba1bc244e692af3c8d911a3e $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS af3c8d911a3e acme/iris2:test "/iris-main --key ..." 5 seconds ago Up 3 seconds PORTS NAMES 0.0.0.0:52773->52773/tcp iris2 注意: InterSystems IRIS 社区版(Community Edition)映像(请参见 Download the InterSystems IRIS Image(下载 InterSystems IRIS 映像))不需要--key 选项,该映像附带一个免费的内置许可证。 Docker Compose 是一个用于定义和运行多容器应用程序的工具,为 Docker 命令行交互提供了替代方案。要使用 Compose,您需要创建 docker-compose.yml ,其中包含您想要创建、启动和管理的容器的规范,然后使用 docker-compose 命令。更多信息,请参见 Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》)中的 Running an InterSystems IRIS Container:Docker Compose Example(运行 InterSystems IRIS 容器:Docker Compose 示例),和 Docker 文档中的 Overview of Docker Compose(Docker Compose 概述)。 确认从已更改的 InterSystems 容器提交的更改 在 Change the Instance and Commit the Container as a New Image(更改实例并将容器作为新映像提交)中,您在从 InterSystems 提供的映像 intersystems/iris:2021.1.0.205.0 创建的容器中为 InterSystems IRIS 实例添加了一个命名空间,然后将该容器作为一个新映像 acme/iris2:test 提交。因此,您添加的命名空间应该存在于运行在 iris2 容器内的 InterSystems IRIS 实例中,该容器是从 acme/iris2:test 创建的。 要确认这一点,请执行以下操作: 打开管理门户(Management Portal)并登录,如 Change the Instance and Commit the Container as a New Image(更改实例并将容器作为新映像提交)中所述。 从主页上,选择 System Administration(系统管理) > Configuration(配置) > System Configuration(系统配置) > Namespaces(命名空间),来显示命名空间(Namespaces)页面;在 iris 容器中创建的 USER2 命名空间被列出。 探索和更改持久化 %SYS 目录 要探索 InterSystems IRIS 容器的持久化 %SYS 功能,请执行以下操作: 要查看 InterSystems IRIS 在容器外写入的特定于实例的数据,因为您在 docker run 命令中包含了持久化 %SYS 环境变量,显示您在该变量中指定的目录的内容,该目录在您使用--volume 选项指定的存储位置,作为要挂载的外部 volume。例如,如果该目录被指定为 /nethome/pmartinez/iris_external/durable,如示例 docker run 中所示,您会做如下操作 $ cd /nethome/pmartinez/iris_external $ ls durable iris.key $ ls durable csp dist httpd iris.cpf iris.cpf_20180417 _LastGood_.cpf mgr $ ls durable/mgr alerts.log irisaudit iris.ids irislocaldata iristemp IRIS.WIJ journal.log startup.last SystemMonitor.log user ilock IRIS.DAT iris.lck iris.shid iris.use journal messages.log stream Temp 返回容器中 InterSystems IRIS 实例的管理门户(Management Portal),选择 System Administration(系统管理) > Configuration(配置) > System Configuration(系统配置) > Journal Settings(日志设置) 以显示日志设置(Journal Settings)页面。 Secondary journal directory(二级日志目录)设置从 /external/durable/mgr/journal/ 更改为 /external/durable/mgr/journal2/,并点击 Save(保存)。 返回到命令行,再次列出持久化 %SYS 目录的 mgr 子目录: $ ls /nethome/pmartinez/iris_external/durable/mgr alerts.log irisaudit iris.ids iris.lck iris.shid iris.use journal journal.log messages.log stream Temp ilock IRIS.DAT iris.key irislocaldata iristemp IRIS.WIJ journal2 licmanager.port startup.last SystemMonitor.log user 由于您对容器内的 InterSystems IRIS 实例进行了更改,所以 journal2 子目录被添加到容器外 。 这个示例显示了持久化 %SYS (durable %SYS)如何使您通过从新映像(image)创建容器来升级容器化的 InterSystems IRIS 实例。您对实例所做的所有持久化更改都存储在容器外的持久化 %SYS 目录(durable %SYS directory);如果您使用所需的选项从任何 InterSystems IRIS 映像(image)创建并启动一个新容器 — 即--volume 选项为持久化 %SYS (durable %SYS)挂载外部存储位置,以及--env ISC_DATA_DIRECTORY 选项指定该挂载 volume 上持久化 %SYS(durable %SYS) 位置,该位置必须存在,并且包含一个 /mgr 子目录 — 这些更改由实例继承,因为它使用与前一个容器中的实例相同的数据。 4.了解有关容器中的 InterSystems IRIS 的更多信息 此时,您已经准备好继续探索容器和 InterSystems IRIS 必须提供的东西。使用下面的文档和参考资料来深入了解容器和 InterSystems IRIS。 Docker Containers and InterSystems IRIS(《Docker 容器和 InterSystems IRIS》) (视频) Running InterSystems Products in Containers(《在容器中运行 InterSystems 产品》) 来自 InterSystems 开发者社区(Developer Community)的文章: What is a Container?(《什么是容器?》) What is a Container Image?(《什么是容器映像?》) Using InterSystems IRIS Containers with Docker for Windows(《使用 InterSystems IRIS 容器与 Docker for Windows》) Docker Documentation(《Docker 文档》) InterSystems Cloud Manager Guide(《InterSystems 云管理器指南》)——使用 InterSystems 云管理器(InterSystems Cloud Manager,ICM)可以轻松直观地配置基础设施,并以各种方式在上面部署容器。ICM 为 InterSystems IRIS 带来了基础设施即代码(Infrastructure as Code,IaC)和容器化部署的好处,而不需要在新技术、培训、配置和管理方面进行重大投资。本指南包含有关 ICM 和使用 InterSystems IRIS 与 Docker 容器的文档。 First Look:InterSystems Cloud Manager(《技术概要:InterSystems 云管理器》)
文章
Jeff Liu · 一月 7, 2021

使用 GitHub Actions 在 EKS 上部署 InterSystems IRIS 解决方案

假设你想了解 InterSystems 在数据分析方面能提供什么。 你研究了理论,现在想要进行一些实践。 幸运的是,InterSystems 提供了一个项目:Samples BI,其中包含了一些很好的示例。 从 README 文件开始,跳过任何与 Docker 相关的内容,直接进行分步安装。 启动虚拟实例 安装 IRIS,按照说明安装 Samples BI,然后用漂亮的图表和表格让老板眼前一亮。 到目前为止还不错。 但是不可避免地,你需要进行更改。 事实证明,自己保留虚拟机存在一些缺点,交给云服务商保管是更好的选择。 Amazon 看起来很可靠,你只需创建一个 AWS 帐户(入门免费),了解到使用 root 用户身份执行日常任务是有害的,然后创建一个常规的具有管理员权限的 IAM 用户。 点击几下鼠标,就可以创建自己的 VPC 网络、子网和虚拟 EC2 实例,还可以添加安全组来为自己开放 IRIS Web端口 (52773) 和 ssh 端口 (22)。 重复 IRIS 和 Samples BI 的安装。 这次使用 Bash 脚本,如果你喜欢,也可以使用 Python。 再一次让老板刮目相看。 但是无处不在的 DevOps 运动让你开始了解基础架构即代码,并且你想要实现它。 你选择了 Terraform,因为它是众所周知的,而且它的方法非常通用,只需微小调整即可适合各种云提供商。 使用 HCL 语言描述基础架构,并将 IRIS 和 Samples BI 的安装步骤转换到 Ansible。 然后再创建一个 IAM 用户使 Terraform 正常工作。 全部运行一遍。 获得工作奖励。 渐渐地你会得出结论,在我们这个[微服务](https://martinfowler.com/articles/microservices.html)时代,不使用 Docker 就太可惜了,尤其是 InterSystems 还会告诉你[怎么做](https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=ADOCK_iris)。 返回到 Samples BI 安装指南并阅读关于 Docker 的几行内容,似乎并不复杂: $ docker pull intersystemsdc/iris-community:2019.4.0.383.0-zpm$ docker run --name irisce -d --publish 52773:52773 intersystemsdc/iris-community:2019.4.0.383.0-zpm$ docker exec -it irisce iris session irisUSER>zpmzpm: USER>install samples-bi   将浏览器定向到 http://localhost:52773/csp/user/_DeepSee.UserPortal.Home.zen?$NAMESPACE=USER 后,再次去老板那里,因为做得好而获得一天假期。 然后你开始明白,“docker run”只是开始,至少需要使用 docker-compose。 没问题: $ cat docker-compose.ymlversion: "3.7"services: irisce: container_name: irisce image: intersystemsdc/iris-community:2019.4.0.383.0-zpm ports: - 52773:52773$ docker rm -f irisce # We don’t need the previous container$ docker-compose up -d   这样你使用 Ansible 安装了 Docker 和 docker-compose,然后运行了容器,如果机器上还没有映像,则会下载一个映像。 最后安装了 Samples BI。 你一定喜欢 Docker,因为它是各种内核素材的又酷又简单的接口。 你开始在其他地方使用 Docker,并且经常启动多个容器。 还发现容器必须经常互相通信,这就需要了解如何管理多个容器。 终于,你发现了 Kubernetes。 从 docker-compose 快速切换到 Kubernetes 的一个方法是使用 [kompose](https://kompose.io/)。 我个人更喜欢简单地从手册中复制 Kubernetes 清单,然后自己编辑,但是 kompose 在完成小任务方面做得很好: $ kompose convert -f docker-compose.ymlINFO Kubernetes file "irisce-service.yaml" createdINFO Kubernetes file "irisce-deployment.yaml" created   现在你有了可以发送到某个 Kubernetes 集群的部署和服务文件。 你发现可以安装 minikube,它允许你运行一个单节点 Kubernetes 集群,这正是你现阶段所需要的。 在摆弄一两天 minikube 沙盒之后,你已经准备好在 AWS 云中的某处使用真实的 Kubernetes 部署。   设置 我们一起来进行吧。 此时,我们做以下几个假设: 首先,我们假设你有一个 AWS 帐户,你[知道其 ID](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html),并且未使用 root 凭据。 你创建了一个具有[管理员权限](https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-started_create-admin-group.html)且只能以编程方式访问的 IAM 用户(我们称之为“my-user”),并存储了其凭据。 你还创建了另一个具有相同权限的 IAM 用户,名为“terraform”: ![](/sites/default/files/inline/images/images/iam_user.png) Terraform 将以它的名义进入你的 AWS 帐户,并创建和删除必要资源。 这两个用户的广泛权限将通过演示来说明。 你在本地保存了这两个 IAM 用户的凭据: $ cat ~/.aws/credentials[terraform]aws_access_key_id = ABCDEFGHIJKLMNOPQRSTaws_secret_access_key = ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890123[my-user]aws_access_key_id = TSRQPONMLKJIHGFEDCBAaws_secret_access_key = TSRQPONMLKJIHGFEDCBA01234567890123   注意:不要复制和粘贴上面的凭据。 它们在这里作为示例提供,不再存在。 请编辑 ~/.aws/credentials 文件并引入你自己的记录。 其次,我们将在文中使用虚拟的 AWS 帐户 ID (01234567890) 和 AWS 区域“eu-west-1”。 可以随意使用其他区域。 第三,我们假设你知道 AWS 不是免费的,你需要为使用的资源付费。 接下来,您已经安装了 AWS CLI 实用程序,以便与 AWS 进行命令行通信。 你可以尝试使用 aws2,但你需要在 kube 配置文件中特别设置 aws2 的用法,如这里所述。 你还安装了 kubectl 实用程序来与 AWS Kubernetes 进行命令行通信。 并且你也针对 docker-compose.yml 安装了 kompose 实用程序,来转换 Kubernetes 清单。 最后,你创建了一个空的 GitHub 仓库,并将其克隆到主机上。 我们将其根目录引用为 。 在此仓库中,我们将创建并填充三个目录:.github/workflows/、k8s/ 和 terraform/。 请注意,所有相关代码都在 github-eks-samples-bi 仓库中复制,以简化拷贝和粘贴。 我们继续。   AWS EKS 预置 我们已经在文章使用 Amazon EKS 部署简单的基于 IRIS 的 Web 应用程序中知道了 EKS。 那时,我们以半自动方式创建了一个集群。 即,我们在一个文件中描述集群,然后从本地机器手动启动 eksctl 实用程序,该实用程序根据我们的描述创建集群。 eksctl 是为创建 EKS 集群而开发的,它非常适合概念验证实现,但对于日常使用来说,最好使用更通用的工具,例如 Terraform。 AWS EKS 简介是一个非常好的资源,其中介绍了创建 EKS 集群所需的 Terraform 配置。 花一两个小时熟悉一下,决不会是浪费时间。 你可以在本地操作 Terraform。 为此,你需要一个二进制文件(在撰写本文时,我们使用最新的 Linux 版本 0.12.20),并且 IAM 用户“terraform”需要有足够的权限才能让 Terraform 进入 AWS。 创建目录 /terraform/ 以存储 Terraform 代码: $ mkdir /terraform$ cd /terraform   你可以创建一个或多个 .tf 文件(它们会在启动时合并)。 只需复制并粘贴 AWS EKS 简介中的代码示例,然后运行如下命令: $ export AWS_PROFILE=terraform$ export AWS_REGION=eu-west-1$ terraform init$ terraform plan -out eks.plan   你可能会遇到一些错误。 如果遇到的话,可以在调试模式下操作,但记得稍后关闭该模式: $ export TF_LOG=debug$ terraform plan -out eks.plan$ unset TF_LOG   这个经验会很有用,你很可能会启动一个 EKS 集群(使用“terraform apply”进行该操作)。 在 AWS 控制台中查看: ![](/sites/default/files/inline/images/images/eks.png)   觉得厌烦时就清理掉: $ terraform destroy   然后进入下一阶段,开始使用 Terraform EKS 模块,尤其它也基于同一 EKS 简介。 在 examples/ 目录中,你将看到如何使用它。 你还会在那里找到其他示例。 我们对示例进行了一定的简化。 以下是主文件,其中调用了 VPC 创建和 EKS 创建模块: $ cat /terraform/main.tfterraform {  required_version = ">= 0.12.0"  backend "s3" {    bucket         = "eks-github-actions-terraform"    key            = "terraform-dev.tfstate"    region         = "eu-west-1"    dynamodb_table = "eks-github-actions-terraform-lock"  }} provider "kubernetes" {  host                   = data.aws_eks_cluster.cluster.endpoint  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)  token                  = data.aws_eks_cluster_auth.cluster.token  load_config_file       = false  version                = "1.10.0"} locals {  vpc_name             = "dev-vpc"  vpc_cidr             = "10.42.0.0/16"  private_subnets      = ["10.42.1.0/24", "10.42.2.0/24"]  public_subnets       = ["10.42.11.0/24", "10.42.12.0/24"]  cluster_name         = "dev-cluster"  cluster_version      = "1.14"  worker_group_name    = "worker-group-1"  instance_type        = "t2.medium"  asg_desired_capacity = 1} data "aws_eks_cluster" "cluster" {  name = module.eks.cluster_id} data "aws_eks_cluster_auth" "cluster" {  name = module.eks.cluster_id} data "aws_availability_zones" "available" {} module "vpc" {  source               = "git::https://github.com/terraform-aws-modules/terraform-aws-vpc?ref=master"   name                 = local.vpc_name  cidr                 = local.vpc_cidr  azs                  = data.aws_availability_zones.available.names  private_subnets      = local.private_subnets  public_subnets       = local.public_subnets  enable_nat_gateway   = true  single_nat_gateway   = true  enable_dns_hostnames = true   tags = {    "kubernetes.io/cluster/${local.cluster_name}" = "shared"  }   public_subnet_tags = {    "kubernetes.io/cluster/${local.cluster_name}" = "shared"    "kubernetes.io/role/elb" = "1"  }   private_subnet_tags = {    "kubernetes.io/cluster/${local.cluster_name}" = "shared"    "kubernetes.io/role/internal-elb" = "1"  }} module "eks" {  source = "git::https://github.com/terraform-aws-modules/terraform-aws-eks?ref=master"  cluster_name     = local.cluster_name  cluster_version  = local.cluster_version  vpc_id           = module.vpc.vpc_id  subnets          = module.vpc.private_subnets  write_kubeconfig = false   worker_groups = [    {      name                 = local.worker_group_name      instance_type        = local.instance_type      asg_desired_capacity = local.asg_desired_capacity    }  ]   map_accounts = var.map_accounts  map_roles    = var.map_roles  map_users    = var.map_users}   我们再仔细看一下 main.tf 中的“_terraform_”块: terraform {  required_version = ">= 0.12.0"  backend "s3" {    bucket         = "eks-github-actions-terraform"    key            = "terraform-dev.tfstate"    region         = "eu-west-1"    dynamodb_table = "eks-github-actions-terraform-lock"  }}   这里需要指出,我们将遵守不低于 Terraform 0.12 的语法(与早期版本相比有了很大变化),同时,Terraform 不应该将其状态存储在本地,而是远程存储在 S3 存储桶中。 不同的人可以从不同的地方更新 terraform 代码确实很方便,这意味着我们需要能够锁定用户的状态,因此我们使用 dynamodb 表添加了一个锁。 有关锁定的更多信息,请参见状态锁定页面。 由于存储桶的名称在整个 AWS 中应该是唯一的,因此你不能再使用名称“eks-github-actions-terraform”。 请想一个你自己的名称,并确保它没有被占用(应该收到 NoSuchBucket 错误): $ aws s3 ls s3://my-bucket调用 ListObjectsV2 操作时发生错误 (AllAccessDisabled):对此对象的所有访问均已禁用$ aws s3 ls s3://my-bucket-with-name-that-impossible-to-remember调用 ListObjectsV2 操作时发生错误 (NoSuchBucket):指定的存储桶不存在   想好一个名称,创建存储桶(我们这里使用 IAM 用户“terraform”。 它拥有管理员权限,因此可以创建存储桶),并为其启用版本管理(这在配置出错时能让你省心): $ aws s3 mb s3://eks-github-actions-terraform --region eu-west-1make_bucket: eks-github-actions-terraform$ aws s3api put-bucket-versioning --bucket eks-github-actions-terraform --versioning-configuration Status=Enabled$ aws s3api get-bucket-versioning --bucket eks-github-actions-terraform{  "Status": "Enabled"}   对于 DynamoDB,不需要唯一性,但你需要先创建一个表: $ aws dynamodb create-table                                                                                     \  --region eu-west-1                                                                                                           \  --table-name eks-github-actions-terraform-lock                                              \  --attribute-definitions AttributeName=LockID,AttributeType=S                \  --key-schema AttributeName=LockID,KeyType=HASH                                   \  --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5   ![](/sites/default/files/inline/images/images/dynamodb.png)   注意,如果 Terraform 操作失败,你可能需要从 AWS 控制台手动删除锁。 但这样做时要小心。 对于 main.tf 中的 eks/vpc 模块,引用 GitHub 上提供的模块很简单: git::https://github.com/terraform-aws-modules/terraform-aws-vpc?ref=master   现在看一下另外两个 Terraform 文件(variables.tf 和 outputs.tf)。 第一个文件保存了 Terraform 变量: $ cat /terraform/variables.tfvariable "region" {  default = "eu-west-1"} variable "map_accounts" {  description = "Additional AWS account numbers to add to the aws-auth configmap. See examples/basic/variables.tf for example format."  type        = list(string)  default     = []} variable "map_roles" {  description = "Additional IAM roles to add to the aws-auth configmap."  type = list(object({    rolearn  = string    username = string    groups   = list(string)  }))  default = []} variable "map_users" {  description = "Additional IAM users to add to the aws-auth configmap."  type = list(object({    userarn  = string    username = string    groups   = list(string)  }))  default = [    {      userarn  = "arn:aws:iam::01234567890:user/my-user"      username = "my-user"      groups   = ["system:masters"]    }  ]}   这里最重要的部分是将 IAM 用户“my-user”添加到 map_users 变量中,但你应该使用自己的帐户 ID 替换 01234567890。 这有什么用? 当通过本地 kubectl 客户端与 EKS 通信时,它会向 Kubernetes API 服务器发送请求,每个请求都要经过身份验证和授权过程,这样 Kubernetes 就可以知道谁发送了请求,以及它们可以做什么。 因此 Kubernetes 的 EKS 版本会要求 AWS IAM 帮助进行用户身份验证。 如果发送请求的用户列在 AWS IAM 中(这里我们指向其 ARN),请求将进入授权阶段,该阶段将由 EKS 自己处理,但要依据我们的设置。 这里要指出的是,IAM 用户“my-user”非常酷(组“system: masters”)。 最后,output.tf 文件描述了 Terraform 在完成工作后应该打印的内容: $ cat /terraform/outputs.tfoutput "cluster_endpoint" {  description = "Endpoint for EKS control plane."  value       = module.eks.cluster_endpoint} output "cluster_security_group_id" {  description = "Security group ids attached to the cluster control plane."  value       = module.eks.cluster_security_group_id} output "config_map_aws_auth" {  description = "A kubernetes configuration to authenticate to this EKS cluster."  value       = module.eks.config_map_aws_auth}   Terraform 部分的描述完成。 我们很快就会回来,看看如何启动这些文件。   Kubernetes 清单 到目前为止,我们已经解决了在哪里启动应用程序的问题。 现在我们来看看要运行什么。 回想一下 /k8s/ 目录中的 docker-compose.yml(我们重命名了服务,添加了几个不久就会被 kompose 用到的标签) : $ cat /k8s/docker-compose.ymlversion: "3.7"services:  samples-bi:    container_name: samples-bi    image: intersystemsdc/iris-community:2019.4.0.383.0-zpm    ports:    - 52773:52773    labels:      kompose.service.type: loadbalancer      kompose.image-pull-policy: IfNotPresent   运行 kompose,然后添加下面突出显示的内容。 删除注释(使内容更容易理解): $ kompose convert -f docker-compose.yml --replicas=1$ cat /k8s/samples-bi-deployment.yamlapiVersion: extensions/v1beta1kind: Deploymentmetadata:  labels:    io.kompose.service: samples-bi  name: samples-bispec:  replicas: 1  strategy:    type: Recreate  template:    metadata:      labels:        io.kompose.service: samples-bi    spec:      containers:      - image: intersystemsdc/iris-community:2019.4.0.383.0-zpm        imagePullPolicy: IfNotPresent        name: samples-bi        ports:        - containerPort: 52773        resources: {}        lifecycle:          postStart:            exec:              command:              - /bin/bash              - -c              - |                echo -e "write\nhalt" > test                until iris session iris < test; do sleep 1; done                echo -e "zpm\ninstall samples-bi\nquit\nhalt" > samples_bi_install                iris session iris < samples_bi_install                rm test samples_bi_install        restartPolicy: Always   我们使用 Recreate 更新策略,这意味着先删除 pod,然后重新创建。 这对于演示目的是允许的,让我们可以使用更少的资源。 我们还添加了 postStart 挂钩,该挂钩在 pod 启动后立即触发。 我们等待至 IRIS 启动,然后从默认的 zpm-repository 安装 samples-bi 包。 现在我们添加 Kubernetes 服务(同样没有注释): $ cat /k8s/samples-bi-service.yamlapiVersion: v1kind: Servicemetadata:  labels:    io.kompose.service: samples-bi  name: samples-bispec:  ports:  - name: "52773"    port: 52773    targetPort: 52773  selector:    io.kompose.service: samples-bi  type: LoadBalancer   是的,我们将在“默认”命名空间中部署,该命名空间适合演示。 好了,现在我们知道了运行_位置_和_内容_。 还剩下_方式_需要了解。   GitHub Actions 工作流程 我们不需要每件事都从头开始做,而是创建一个工作流程,类似于[使用 GitHub Actions 在 GKE 上部署 InterSystems IRIS 解决方案](https://community.intersystems.com/post/deploying-intersystems-iris-solution-gke-using-github-actions)中所述的工作流程。 这次,我们不必担心构建容器。 GKE 特定的部分已替换为特定于 EKS。 粗体部分与接收提交消息和在条件步骤中使用它有关: $ cat /.github/workflows/workflow.yamlname: Provision EKS cluster and deploy Samples BI thereon:  push:    branches:    - master # Environment variables.# ${{ secrets }} are taken from GitHub -> Settings -> Secrets# ${{ github.sha }} is the commit hashenv:  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}  AWS_REGION: ${{ secrets.AWS_REGION }}  CLUSTER_NAME: dev-cluster  DEPLOYMENT_NAME: samples-bi jobs:  eks-provisioner:    # Inspired by:    ## https://www.terraform.io/docs/github-actions/getting-started.html    ## https://github.com/hashicorp/terraform-github-actions    name: Provision EKS cluster    runs-on: ubuntu-18.04    steps:    - name: Checkout      uses: actions/checkout@v2     - name: Get commit message      run: |        echo ::set-env name=commit_msg::$(git log --format=%B -n 1 ${{ github.event.after }})     - name: Show commit message      run: echo $commit_msg     - name: Terraform init      uses: hashicorp/terraform-github-actions@master      with:        tf_actions_version: 0.12.20        tf_actions_subcommand: 'init'        tf_actions_working_dir: 'terraform'     - name: Terraform validate      uses: hashicorp/terraform-github-actions@master      with:        tf_actions_version: 0.12.20        tf_actions_subcommand: 'validate'        tf_actions_working_dir: 'terraform'     - name: Terraform plan      if: "!contains(env.commit_msg, '[destroy eks]')"      uses: hashicorp/terraform-github-actions@master      with:        tf_actions_version: 0.12.20        tf_actions_subcommand: 'plan'        tf_actions_working_dir: 'terraform'     - name: Terraform plan for destroy      if: "contains(env.commit_msg, '[destroy eks]')"      uses: hashicorp/terraform-github-actions@master      with:        tf_actions_version: 0.12.20        tf_actions_subcommand: 'plan'        args: '-destroy -out=./destroy-plan'        tf_actions_working_dir: 'terraform'     - name: Terraform apply      if: "!contains(env.commit_msg, '[destroy eks]')"      uses: hashicorp/terraform-github-actions@master      with:        tf_actions_version: 0.12.20        tf_actions_subcommand: 'apply'        tf_actions_working_dir: 'terraform'     - name: Terraform apply for destroy      if: "contains(env.commit_msg, '[destroy eks]')"      uses: hashicorp/terraform-github-actions@master      with:        tf_actions_version: 0.12.20        tf_actions_subcommand: 'apply'        args: './destroy-plan'        tf_actions_working_dir: 'terraform'   kubernetes-deploy:    name: Deploy Kubernetes manifests to EKS    needs:    - eks-provisioner    runs-on: ubuntu-18.04    steps:    - name: Checkout      uses: actions/checkout@v2     - name: Get commit message      run: |        echo ::set-env name=commit_msg::$(git log --format=%B -n 1 ${{ github.event.after }})     - name: Show commit message      run: echo $commit_msg     - name: Configure AWS Credentials      if: "!contains(env.commit_msg, '[destroy eks]')"      uses: aws-actions/configure-aws-credentials@v1      with:        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}        aws-region: ${{ secrets.AWS_REGION }}     - name: Apply Kubernetes manifests      if: "!contains(env.commit_msg, '[destroy eks]')"      working-directory: ./k8s/      run: |        aws eks update-kubeconfig --name ${CLUSTER_NAME}        kubectl apply -f samples-bi-service.yaml        kubectl apply -f samples-bi-deployment.yaml        kubectl rollout status deployment/${DEPLOYMENT_NAME}   当然,我们需要设置“terraform”用户的凭据(从 ~/.aws/credentials 文件中获取),让 Github 使用它的机密: ![](/sites/default/files/inline/images/images/secrets.png)   注意工作流程的突出显示部分。 我们可以通过推送包含短语“[destroy eks]”的提交消息来销毁 EKS 集群。 请注意,我们不会使用这样的提交消息来运行“kubernetes apply”。 运行管道,但首先要创建一个 .gitignore 文件: $ cat /.gitignore.DS_Storeterraform/.terraform/terraform/*.planterraform/*.json$ cd $ git add .github/ k8s/ terraform/ .gitignore$ git commit -m "GitHub on EKS"$ git push   在 GitHub 仓库页面的“Actions”选项卡上监视部署过程。 请等待成功完成。 第一次运行工作流程时,“Terraform apply”步骤需要 15 分钟左右,大约与创建集群的时间一样长。 下次启动时(如果未删除集群),工作流程会快很多。 你可以将此签出: $ cd $ git commit -m "Trigger" --allow-empty$ git push   当然,最好检查一下我们做了什么。 这次可以在你的笔记本电脑上使用 IAM“my-user”的凭据: $ export AWS_PROFILE=my-user$ export AWS_REGION=eu-west-1$ aws sts get-caller-identity$ aws eks update-kubeconfig --region=eu-west-1 --name=dev-cluster --alias=dev-cluster$ kubectl config current-contextdev-cluster $ kubectl get nodesNAME                                                                               STATUS   ROLES      AGE          VERSIONip-10-42-1-125.eu-west-1.compute.internal   Ready          6m20s     v1.14.8-eks-b8860f $ kubectl get poNAME                                                       READY        STATUS      RESTARTS   AGEsamples-bi-756dddffdb-zd9nw    1/1               Running    0                      6m16s $ kubectl get svcNAME                   TYPE                        CLUSTER-IP        EXTERNAL-IP                                                                                                                                                         PORT(S)                    AGEkubernetes        ClusterIP               172.20.0.1                                                                                                                                                                                443/TCP                    11msamples-bi         LoadBalancer     172.20.33.235    a2c6f6733557511eab3c302618b2fae2-622862917.eu-west-1.elb.amazonaws.com    52773:31047/TCP  6m33s   访问 _[http://a2c6f6733557511eab3c302618b2fae2-622862917.eu-west-1.elb.amazonaws.com:52773/csp/user/_DeepSee.UserPortal.Home.zen?$NAMESPACE=USER](http://a2c6f6733557511eab3c302618b2fae2-622862917.eu-west-1.elb.amazonaws.com:52773/csp/user/_DeepSee.UserPortal.Home.zen?%24NAMESPACE=USER) _(将链接替换为你的外部 IP),然后输入“_system”、“SYS”并更改默认密码。 您应该看到一系列 BI 仪表板: ![](/sites/default/files/inline/images/images/deepsee_ui.png)   点击每个仪表板的箭头可以深入了解: ![](/sites/default/files/inline/images/images/deepsee_2.png)   记住,如果重启 samples-bi pod,所有更改都将丢失。 这是有意的行为,因为这是演示。 如果你需要保留更改,我在 github-gke-zpm-registry/k8s/statefulset.tpl 仓库中创建了一个示例。 完成后,删除你创建的所有内容: $ git commit -m "Mr Proper [destroy eks]" --allow-empty$ git push   结论 在本文中,我们将 eksctl 实用程序替换成 Terraform 来创建 EKS 集群。 这是向“编纂”您的所有 AWS 基础架构迈出的一步。 我们展示了如何使用 Github Actions 和 Terraform 通过 git push 轻松部署演示应用程序。 我们还向工具箱中添加了 kompose 和 pod 的 postStart 挂钩。 这次我们没有展示 TLS 启用。 我们将在不久的将来完成这项任务。