我刚刚开始使用布鲁克林,我正试图通过我的AWS账户从deploying blueprints页面获取示例。
Maven构建成功完成,我可以使用running Brooklyn页面上的步骤从~/apache-brooklyn-0.7.0-M2-incubating/usage/dist/target/brooklyn-dist
成功启动Brooklyn Web UI。
当我启动蓝图时,我可以看到在我的AWS控制台用户界面中启动的所有虚拟机。我还可以看到创建的密钥对和安全组。但蓝图最终失败了,因为(我相信)布鲁克林无法进入虚拟机,请参阅下面的第一个日志输出。我假设布鲁克林试图以某种方式使用创建的密钥对登录虚拟机?
根据locations页面中的信息,我创建了~/.brooklyn/brooklyn.properties file
并添加了以下配置:
brooklyn.location.jclouds.aws-ec2.identity = MyAwsAccessKeyID
brooklyn.location.jclouds.aws-ec2.credential = MyAwsSecretAccessKey
brooklyn.location.jclouds.aws-ec2.privateKeyFile = /home/username/key4brooklyn.pem
我从AWS控制台用户界面创建了key4brooklyn.pem
文件并重新启动了布鲁克林,但是蓝图仍然不起作用,它创建了虚拟机但无法访问虚拟机,请参阅下面的日志输出。
2015-03-02 23:31:27,295 INFO Starting MySqlNodeImpl{id=lzJhHxwD}, obtaining a new location instance in JcloudsLocation[aws-ec2:MyAwsAccessKeyID/aws-ec2] with ports [22, 3306]
2015-03-02 23:31:27,369 INFO Starting NginxControllerImpl{id=QYRLgQPh}, obtaining a new location instance in JcloudsLocation[aws-ec2:MyAwsAccessKeyID/aws-ec2] with ports [22, 8000]
2015-03-02 23:31:27,612 INFO Resize DynamicWebAppClusterImpl{id=iJNs2ltC} from 0 to 1
2015-03-02 23:31:28,830 INFO Starting JBoss7ServerImpl{id=MWMGwHXx}, obtaining a new location instance in JcloudsLocation[aws-ec2:MyAwsAccessKeyID/aws-ec2] with ports [22, 9443, 10999, 8443, 8080, 9990]
2015-03-02 23:31:37,870 INFO Creating VM aws-ec2@MySqlNodeImpl{id=lzJhHxwD} in JcloudsLocation[aws-ec2:MyAwsAccessKeyID/aws-ec2]
2015-03-02 23:31:38,508 INFO Creating VM aws-ec2@JBoss7ServerImpl{id=MWMGwHXx} in JcloudsLocation[aws-ec2:MyAwsAccessKeyID/aws-ec2]
2015-03-02 23:31:38,983 INFO Creating VM aws-ec2@NginxControllerImpl{id=QYRLgQPh} in JcloudsLocation[aws-ec2:MyAwsAccessKeyID/aws-ec2]
2015-03-02 23:34:55,349 INFO Not able to load publicKeyData from inferred files, based on privateKeyFile: tried [/home/username/key4brooklyn.pem.pub] for aws-ec2@MySqlNodeImpl {id=lzJhHxwD}
2015-03-02 23:34:55,353 INFO Not able to load publicKeyData from inferred files, based on privateKeyFile: tried [/home/username/key4brooklyn.pem.pub] for aws-ec2@JBoss7ServerImpl {id=MWMGwHXx}
2015-03-02 23:34:55,351 INFO Not able to load publicKeyData from inferred files, based on privateKeyFile: tried [/home/username/key4brooklyn.pem.pub] for aws-ec2@NginxControllerImpl {id=QYRLgQPh}
我使用安装了Oracle Java 7的Ubuntu 14.04,它是一个VirtualBox VM。
答案 0 :(得分:1)
查看日志输出,问题出在这里:
2015-03-02 23:34:55,349 INFO Not able to load publicKeyData from inferred files, based on privateKeyFile: tried [/home/username/key4brooklyn.pem.pub] for aws-ec2@MySqlNodeImpl {id=lzJhHxwD}
privateKeyFile 配置密钥需要在两个文件中指定id_rsa
或id_dsa
样式密钥对。如果未配置 publicKeyFile ,则会自动检测相应的*.pub
文件。有creating an ssh key可用的更好说明。 令人困惑,更好的错误报告围绕密钥(包括快速失败)是在最新的 SNAPSHOT 版本中,并将包含在 M3 里程碑中发布。另请注意,id_rsa
文件必须只有一个私钥,并且不得包含公钥。单调乏味,有这么多格式!
布鲁克林仅使用~/.ssh/id_rsa
或其他已配置的密钥对来设置配置后对VM的ssh访问。默认情况下,jclouds(我们在封面下使用)将创建一个临时AWS密钥对,以获得对VM的初始访问权限。然后,我们会自动将~/.ssh/id_rsa.pub
添加到VM ~/.ssh/authorized_keys
(在VM上创建默认情况下与运行Brooklyn进程的用户名称相同的用户)
您下载的key4brooklyn.pem
文件是AWS密钥对的私有部分。默认情况下,这将不,因为jclouds将创建自己的密钥对。
如果您希望jclouds使用预先存在的密钥对,那么您必须使用以下配置设置:
brooklyn.location.jclouds.aws-ec2.keyPair = MyKeypairName
其中 MyKeypairName 是根据AWS的密钥对的名称。