我正在Safari上关注Cloud Foundry BOSH基础LiveLessons。我已通过override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.row {
case 0:
return 136
case 1:
return 50
default:
if selectedRow != nil && indexPath == selectedRow {
tableView.layoutIfNeeded()
let cell = self.tableView(tableView, cellForRowAt: indexPath) as! DynamicTableViewCell
cell.layoutIfNeeded()
return cell.nativeHeight
} else {
return 50
}
}
}
将BOSH部署到GCP中。我正在使用一个免费试用帐户,该帐户可以给我8个vCPU。到目前为止,我使用的是两种:一种用于Director,一种用于Jumpbox。
我正在尝试使用以下命令部署nginx:
bbl
其中nginx.yml是
bosh deploy -d nginx nginx.yml
这给了我以下错误:
---
name: nginx
releases:
- name: nginx
version: latest
stemcells:
- alias: ubuntu
os: ubuntu-trusty
version: latest
instance_groups:
- name: nginx
azs: [z2]
instances: 1
vm_type: sharedcpu
stemcell: ubuntu
networks:
- name: default
jobs:
- name: nginx
release: nginx
properties:
nginx_conf: |
worker_processes 1;
er ror_log /var/vcap/sys/log/nginx/error.log info;
#pid logs/nginx.pid; # PIDFILE is configured via monit's ctl
events {
worker_connections 1024;
}
http {
include /var/vcap/packages/nginx/conf/mime.types;
default_type application/octet-stream;
sendfile on;
ssi on;
keepalive_timeout 65;
server_names_hash_bucket_size 64;
server {
server_name _; # invalid value which will never trigger on a real hostname.
listen 0.0.0.0:80;
access_log /var/vcap/sys/log/nginx/toto-access.log;
error_log /var/vcap/sys/log/nginx/toto-error.log;
}
root /var/vcap/store/nginx;
index index.shtml index.html index.htm;
}
pre_start: |
#!/bin/bash -ex
NGINX_DIR=/var/vcap/store/nginx
if [ ! -d $NGINX_DIR ]; then
mkdir -p $NGINX_DIR
cd $NGINX_DIR
echo '<html><title>hello</title><body><h1>Hello <!--#echo var="REMOTE_ADDR" --></h1></body></html>' > index.shtml
fi
update:
canaries: 1
max_in_flight: 1
serial: false
canary_watch_time: 1000-60000
update_watch_time: 1000-60000
鉴于我应该还有6个vCPU,我尝试通过Web控制台手动创建实例,以查看是否会出现类似的错误。我没有,我能够用完剩余的6个vCPU来创建实例。知道发生了什么事吗?
答案 0 :(得分:0)
import socket
import wmi
import time
import sys
ip = 'servers IP'
port = 8001
try:
my_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
my_socket.connect((ip, port))
except:
print "socket error"
c = wmi.WMI()
disks=[]
for disk in c.Win32_LogicalDisk (DriveType=3):
data= disk.Caption, "%0.2f%% free" % (100.0 * long (disk.FreeSpace) / long
(disk.Size))
disks.append(data)
print str(disks)
data = str(disks)
my_socket.send(data)
部署的环境中,Compilation VMs默认情况下占用8个CPU,这会很快耗尽您的配额。编译VM的大小由BOSH云配置设置。
解决此问题的步骤取决于您的bbl
版本。此修复程序假设您使用的是bbl
5或更高版本。
将具有以下内容的文件写入状态bbl
的{{1}}目录中:
cloud-config
(您可以将其命名为所需的文件,只要它不覆盖现有文件即可。我将其命名为bbl
。)
然后再次运行- type: replace
path: /compilation/vm_type
value: n1-highcpu-2
- type: replace
path: /compilation/workers
value: 1
。
您的BOSH Director下次尝试创建编译VM时,它将默认为单个2-CPU VM。