【问题标题】:Apache brooklyn create own volumes instead of using the existing oneApache brooklyn 创建自己的卷而不是使用现有的卷
【发布时间】:2015-12-04 13:47:50
【问题描述】:

我使用 Apache Brooklyn 0.8.0-incubating 在 AWS 上使用以下蓝图创建 d2.xlarge 实例:

location: 
 jclouds:aws-ec2:
   region: eu-central-1
... 
provisioning.properties:
  imageId: eu-central-1/ami-7bcddf17 # Redhat 6.6
  hardwareId: d2.xlarge # with 2TB EBS

机器上只有 10GB 的总存储空间。经过一番研究,我发现 /dev/xvdb 下的实例卷未分区。

谁能解释我如何使用实例存储而不是在 AWS 上为机器创建新卷?

最好的问候, 费利克斯

【问题讨论】:

    标签: amazon-web-services jclouds brooklyn


    【解决方案1】:

    这是 AWS EC2 中虚拟机的预期行为。

    http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/add-instance-store-volumes.html中所述:

    "After you launch the instance, you must ensure that the instance
    store volumes for your instance are formatted and mounted before you can use them. Note that the root
    volume of an instance store-backed instance is mounted automatically."
    
    "the instance type determines which instance store volumes are mounted for you and which are available for you to mount yourself"
    

    对于您的实例类型,看起来实例存储卷未格式化。

    EC2 文档谈到了运行 lsblkmkfsmount 来格式化和挂载实例存储卷。

    预期的行为也取决于 AMI:“每个 AMI 都有一个块储存设备映射,指定从 AMI 启动实例时要附加到实例的块储存设备。亚马逊提供的 AMI 仅包括根设备。”

    请注意,您在一个 AMI 上工作的内容可能不适用于所有其他 AMI(例如,由于不同的块储存设备映射)。坚持使用 Amazon 自己的 AMI 通常是一个好主意,以获得合理的默认行为。


    这可以在 Apache Brooklyn 中实现自动化。你有几个选择:

    • 在实体中实现它,例如如果使用 SoftwareProcess 实体,那么您可以使用配置键 pre.install.command 执行 bash 命令来设置音量。

    • 在该位置实施它。

      • 这可以使用新的MachineLocationCustomizer 在机器上执行命令(然后在该位置进行配置)。

      • 或者,对于 jclouds 位置,您可以使用 setup.script 配置,该配置采用 shell 脚本的 URL 来执行。

    在这些方法中,MachineLocationCustomizer 为您提供最大的功能和灵活性。

    【讨论】:

    • 感谢您的建议。我将环境更新为 Apache Brooklyn 0.9.0,现在使用 JcloudsLocationCustomizer。但我发现我的问题来自EC2HardwareBuilder 类。根设备卷将始终从 Jcloud 设置为 10GB。是否可以创建自己的 HardwareBuilder 并将其注入 JcloudLocationCustomizer,以便我可以为根设备卷定义自己的大小?
    • 我将针对该问题打开另一个问题。
    猜你喜欢
    • 1970-01-01
    • 2022-12-31
    • 1970-01-01
    • 2019-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多