Amazon web services EC2上的Ubuntu 12.04LTS在用户数据脚本后关闭

Amazon web services EC2上的Ubuntu 12.04LTS在用户数据脚本后关闭,amazon-web-services,amazon-ec2,ubuntu-12.04,Amazon Web Services,Amazon Ec2,Ubuntu 12.04,在执行用户数据脚本后,运行Ubuntu12.04LTS的EC2实例关闭时出现问题 它在ELB后面运行,健康检查似乎正在工作。在系统日志中,在一些运行状况检查之后,会出现“检查无人参与的更新:”提示,然后关闭电源 下面是系统日志的一部分 user-data: Using MemoryStore for the Session user-data: Using MemoryStore for the data store user-data: OAuth 2.0 Authorization Serv

在执行用户数据脚本后,运行Ubuntu12.04LTS的EC2实例关闭时出现问题

它在ELB后面运行,健康检查似乎正在工作。在系统日志中,在一些运行状况检查之后,会出现“检查无人参与的更新:”提示,然后关闭电源

下面是系统日志的一部分

user-data: Using MemoryStore for the Session
user-data: Using MemoryStore for the data store
user-data: OAuth 2.0 Authorization Server started on port 3000
user-data: 10.0.18.6 - - [Wed, 12 Feb 2014 20:37:22 GMT] "GET / HTTP/1.1" 200 2789 "-" "ELB-HealthChecker/1.0"
user-data: 10.0.18.6 - - [Wed, 12 Feb 2014 20:37:52 GMT] "GET / HTTP/1.1" 200 2789 "-" "ELB-HealthChecker/1.0"
Checking for running unattended-upgrades: 
acpid: exiting

Wed Feb 12 20:38:13 UTC 2014: shutting down for poweroff [up 156s].
 * Stopping landscape-client daemon       [80G 
[74G[[31mfail[39;49m]
 * Asking all remaining processes to terminate...       [80G failed: /var/lib/cloud/instance/scripts/part-001 [-15]
2014-02-12 20:38:13,694 - cc_scripts_user.py[WARNING]: failed to run-parts in /var/lib/cloud/instance/scripts
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/handlers.py", line 807, in emit
    self._connect_unixsocket(self.address)
  File "/usr/lib/python2.7/logging/handlers.py", line 745, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth

[74G    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Logged from file cc_scripts_user.py, line 33
[ OK ]
2014-02-12 20:38:13,721 - __init__.py[WARNING]: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 117, in run_cc_modules
    cc.handle(name, run_args, freq=freq)
  File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 78, in handle
    [name, self.cfg, self.cloud, cloudinit.log, args])
  File "/usr/lib/python2.7/dist-packages/cloudinit/__init__.py", line 327, in sem_and_run
    func(*args)
  File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/cc_scripts_user.py", line 31, in handle
    util.runparts(runparts_path)
  File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 229, in runparts
    raise RuntimeError('runparts: %i failures' % failed)
RuntimeError: runparts: 1 failures

Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/handlers.py", line 807, in emit
    self._connect_unixsocket(self.address)
  File "/usr/lib/python2.7/logging/handlers.py", line 745, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Logged from file __init__.py, line 119
2014-02-12 20:38:13,722 - __init__.py[ERROR]: config handling of scripts-user, None, [] failed

Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/handlers.py", line 807, in emit
    self._connect_unixsocket(self.address)
  File "/usr/lib/python2.7/logging/handlers.py", line 745, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Logged from file __init__.py, line 121
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/handlers.py", line 807, in emit
    self._connect_unixsocket(self.address)
  File "/usr/lib/python2.7/logging/handlers.py", line 745, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Logged from file __init__.py, line 116
ec2: 
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 1024 40:fa:b0:63:19:cb:ba:ab:d3:60:d5:f1:8e:7b:46:e0  root@ip-10-0-19-71 (DSA)
ec2: 256 5b:f6:a6:28:8e:70:6d:e5:37:53:f2:2c:d3:9f:4e:80  root@ip-10-0-19-71 (ECDSA)
ec2: 2048 ab:e4:68:84:28:b7:dd:31:9c:61:36:df:2a:90:0f:35  root@ip-10-0-19-71 (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFjnRoQzoWPMShoAHXgvoqWVxils40EfyzTzlj3ASR6zaOTt9Aw+JH+LwHe0bpmyhXAIgiG4Yo0aazwt1301kZY= root@ip-10-0-19-71
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCp7JxhFxkc8RxfmzhEiLKOuH1NOrpaMsF+SENi47Z8ncA20+VZwhCETxnqVqiybqzITIuuV/33FkCu+4N5ii0GCiZIbdHd9zlbi0QTLXcV1CPORTNH3+1HEiyn6yKC3Cyk2qVqCTpKHNdboG1PKBWrLGg5PqyM45A7+4BSqTNk1vnvE0r3k6hKn8K4WSfQfy8LCBNm4/xq5rxuKSkMTSvoBenWMaaeS63t3k213Y+nQ0dilOXhjxa8VP55Vtx/7t2C1PwMZHiQNNpMiUmhduNzVr1yJKu7G57c+7iMIk7IGgAZ/tiNYqigvfKfJwYqEUEIisNrluBgSR3S2FXI/euJ root@ip-10-0-19-71
-----END SSH HOST KEY KEYS-----
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/handlers.py", line 807, in emit
    self._connect_unixsocket(self.address)
  File "/usr/lib/python2.7/logging/handlers.py", line 745, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Logged from file __init__.py, line 116
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/handlers.py", line 807, in emit
    self._connect_unixsocket(self.address)
  File "/usr/lib/python2.7/logging/handlers.py", line 745, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Logged from file __init__.py, line 116
cloud-init boot finished at Wed, 12 Feb 2014 20:38:13 +0000. Up 156.72 seconds
2014-02-12 20:38:13,913 - cloud-init-cfg[ERROR]: errors running cloud_config [final]: ['scripts-user']
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/handlers.py", line 807, in emit
    self._connect_unixsocket(self.address)
  File "/usr/lib/python2.7/logging/handlers.py", line 745, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Logged from file cloud-init-cfg, line 106
errors running cloud_config [final]: ['scripts-user']
 * All processes ended within 2 seconds....       [80G 
[74G[ OK ]
 * Deconfiguring network interfaces...       [80G 
[74G[ OK ]
 * Deactivating swap...       [80G 
[74G[ OK ]
 * Will now halt
[38117.674998] System halted.

自动缩放有一个可配置的宽限期,在此期间实例必须响应。如果没有。自动缩放将终止实例并尝试启动新实例


考虑到您的引导脚本,该宽限期需要增加一点。

您是否在ELB上使用自动缩放?是的,当使用自动缩放启动时会出现问题。使用相同的用户数据脚本通过控制台启动它,它很好。我想就是这样。我把宽限期改为300,效果很好。需要把范围缩小一点。这并不让我感到惊讶,因为脚本运行npm安装,它在一些模块上进行自定义构建。我猜我读错了日志,因为我是在脚本执行后安装更新的。谢谢