JBoss Fuse - Fabric
什么是 Fabric?
Fabric 为多个 Fuse 实例提供管理和编排功能。Fabric 允许我们从单个点控制与其连接的所有 Fuse 实例。普通的 Fuse 容器可以转换为 Fabric。 Fabric 中有一个 Fabric 注册表,它充当数据存储,其中包含有关其管理的容器的所有信息。
为什么选择 Fabric?
Fabric 具有以下特殊功能,使其成为分布式环境中使用的理想选择。
- 监控 Fabric 中所有容器的状态。
- 启动和停止远程容器。
- 配置远程容器以运行特定应用程序。
- 升级应用程序并在实时系统中推出补丁。
- 快速启动和配置新容器,例如以应对系统负载的增加。

Fabric 设置
创建 Fabric
普通 Fuse 容器可以转换为 Fabric通过使用以下命令
fabric: create --clean --zookeeper-password myZooPass
将其他容器连接到 Fabric −
fabric:join --zookeeper-password myZooPass <fabric_host>:2181 Cont1
注意 − 请将 <fabric_host> 替换为 Fabric 正在运行的实际主机名。
当您使用 localhost:8181 从浏览器登录 Fuse 管理控制台时,您应该能够看到两个容器,如以下屏幕截图所示。 Fabric 容器前面有一个小云符号。

配置文件
配置文件包含以下信息 −
- 要安装的软件包
- 要安装的功能
- 要应用的配置
配置文件提供了一种在 Fabric 环境中在多台服务器上安装同一套软件包、功能和配置的方法。
如果将同一个配置文件应用于多个容器,并且我们从任何容器对该配置文件进行更改,则类似的更改将自动部署到应用该配置文件的其余容器。
创建配置文件
登录 FMC localhost:8181
运行时 → 管理
在左侧的配置文件菜单下单击 +

输入要为配置文件指定的名称,然后单击创建。

此后,应创建配置文件。
将配置文件应用于容器
运行时 → 容器 → root(选择您想要的容器)

单击添加,将弹出一个弹出框。搜索所需的配置文件,然后再次单击添加。

配置文件应显示在列表中,如以下屏幕截图所示。

部署捆绑包
要部署捆绑包,请使用以下路径 −
运行时 → 容器 → 根(选择所需的容器)→ First_profile(选择配置文件)

单击"捆绑包"选项卡。按以下格式设置包路径,然后单击 +。
mvn:group.id/artifact.id/version
例如:mvn:com.tutorialpoint.app/camel-firt-app/1.0-SNAPSHOT


包将添加到配置文件中,并将部署在分配了配置文件的所有容器上。
取消部署包
要取消部署包,请使用以下路径−
运行时 → 容器 → 根目录(选择所需容器)→ First_profile(选择配置文件)

单击"捆绑包"选项卡并搜索要删除的捆绑包,然后单击 X。捆绑包将从应用了配置文件的所有容器中删除。
