当我使用post_install脚本时,Cfncluster无法创建主节点

时间:2016-06-13 17:33:06

标签: amazon-web-services amazon-s3 amazon-ec2

我正在尝试使用postconfig脚本创建cfncluster.Master节点已创建我可以在Ec2仪表板中看到主节点并打开管理控制台。但它说'创造失败''在命令提示符和CloudFormation中。在我的postconfig脚本中,我正在挂载NFS共享。没有使用我的postconfig脚本,我没有遇到任何问题。

请查看以下日志:

12:53:44 UTC-0400   CREATE_FAILED   AWS::CloudFormation::Stack  cfncluster-cfnclustertest1  The following resource(s) failed to create: [MasterServer].
12:53:42 UTC-0400   CREATE_FAILED   AWS::EC2::Instance  MasterServer    Received FAILURE signal with UniqueId i-07ef799b
12:47:40 UTC-0400   CREATE_IN_PROGRESS  AWS::EC2::Instance  MasterServer    Resource creation Initiated
12:47:38 UTC-0400   CREATE_IN_PROGRESS  AWS::EC2::Instance  MasterServer    
12:47:28 UTC-0400   CREATE_COMPLETE AWS::IAM::InstanceProfile   RootInstanceProfile 
12:45:29 UTC-0400   CREATE_COMPLETE AWS::IAM::Policy    S3ReadWriteRolePolicies 
12:45:29 UTC-0400   CREATE_COMPLETE AWS::IAM::Policy    CfnClusterPolicies

请查找主节点/var/log/cfn-init.log

的日志
Running handlers:
Running handlers complete
Chef Client finished, 69/184 resources updated in 01 minutes 11 seconds

2016-06-13 18:55:32,250 [DEBUG] No services specified
2016-06-13 18:55:33,124 [INFO] Running config shellRunPostInstall
2016-06-13 18:55:33,124 [DEBUG] No packages specified
2016-06-13 18:55:33,124 [DEBUG] No groups specified
2016-06-13 18:55:33,124 [DEBUG] No users specified
2016-06-13 18:55:33,124 [DEBUG] No sources specified
2016-06-13 18:55:33,124 [DEBUG] No files specified
2016-06-13 18:55:33,124 [DEBUG] Running command runpostinstall
2016-06-13 18:55:33,124 [DEBUG] No test for command runpostinstall
2016-06-13 18:55:37,118 [ERROR] Command runpostinstall (/opt/cfncluster/scripts/fetch_and_run -postinstall) failed
2016-06-13 18:55:37,118 [DEBUG] Command runpostinstall output: /tmp/tmp.jooCNBMSMS: line 2: $'\r': command not found
/tmp/tmp.jooCNBMSMS: line 4: $'\r': command not found
 does not existt point /mnt/nfs/home
/tmp/tmp.jooCNBMSMS: line 7: $'\r': command not found
/tmp/tmp.jooCNBMSMS: line 8: $'\r': command not found
/tmp/tmp.jooCNBMSMS: line 9: $'\r': command not found
/tmp/tmp.jooCNBMSMS: line 10: $'\r': command not found
/tmp/tmp.jooCNBMSMS: line 11: $'\r': command not found
/tmp/tmp.jooCNBMSMS: line 12: $'\r': command not found
cfncluster: fetch_and_run - Failed to run boot_as_master postinstall

2016-06-13 18:55:37,118 [ERROR] Error encountered during build of shellRunPostInstall: Command runpostinstall failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/construction.py", line 517, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/construction.py", line 248, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)
ToolError: Command runpostinstall failed
2016-06-13 18:55:37,119 [ERROR] -----------------------BUILD FAILED!------------------------
2016-06-13 18:55:37,121 [ERROR] Unhandled exception during build: Command runpostinstall failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 171, in <module>
    worklog.build(metadata, configSets)
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/construction.py", line 118, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/construction.py", line 505, in build
    self.run_config(config, worklog)
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/construction.py", line 517, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/construction.py", line 248, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.7/dist-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)
ToolError: Command runpostinstall failed
2016-06-13 18:55:37,267 [DEBUG] CloudFormation client initialized with endpoint https://cloudformation.us-****-1.amazonaws.com
2016-06-13 18:55:37,267 [DEBUG] Signaling resource MasterServer in stack cfncluster-cfnclustertest1 with unique ID i-1561f789 and status FAILURE

1 个答案:

答案 0 :(得分:1)

找不到

'\ r'命令错误是由于在Windows中编辑文件并尝试在非Windows系统上运行它而引起的。当我从非Windows系统创建bash脚本时,集群已成功创建。