Node.js 教程触发所有 App Engine VM 实例
Node.js Tutorial Triggers all App Engine VM Instances
我遵循了此处概述的教程:https://cloud.google.com/nodejs/getting-started/hello-world
与 app.js
:
'use strict';
var express = require('express');
var app = express();
// [START hello_world]
// Say hello!
app.get('/', function(req, res) {
res.status(200).send('Hello, world!');
});
// [END hello_world]
if (module === require.main) {
// [START server]
// Start the server
var server = app.listen(process.env.PORT || 8080, function () {
var host = server.address().address;
var port = server.address().port;
console.log('App listening at http://%s:%s', host, port);
});
// [END server]
}
module.exports = app;
部署到 App Engine 后,虽然脚本非常简单,引用 VM 实例,但它证明可以调出 8 个不同的实例:
这是正常行为吗?
每次您执行 gcloud preview app deploy
,我们都会创建该应用程序的新版本。每个版本(默认情况下)带有 2 个 VM。查看您的 VM 列表 - 我想我看到部署了 ~5 个不同的版本。
要停止旧版本,请转到 developers console,然后使用 UI 停止每个旧(非默认)版本:
这应该会让您回到预期的位置。我们正在更改我们的工具(在接下来的几周内),以便这些工具会自动为您停止。
希望对您有所帮助!
我遵循了此处概述的教程:https://cloud.google.com/nodejs/getting-started/hello-world
与 app.js
:
'use strict';
var express = require('express');
var app = express();
// [START hello_world]
// Say hello!
app.get('/', function(req, res) {
res.status(200).send('Hello, world!');
});
// [END hello_world]
if (module === require.main) {
// [START server]
// Start the server
var server = app.listen(process.env.PORT || 8080, function () {
var host = server.address().address;
var port = server.address().port;
console.log('App listening at http://%s:%s', host, port);
});
// [END server]
}
module.exports = app;
部署到 App Engine 后,虽然脚本非常简单,引用 VM 实例,但它证明可以调出 8 个不同的实例:
这是正常行为吗?
每次您执行 gcloud preview app deploy
,我们都会创建该应用程序的新版本。每个版本(默认情况下)带有 2 个 VM。查看您的 VM 列表 - 我想我看到部署了 ~5 个不同的版本。
要停止旧版本,请转到 developers console,然后使用 UI 停止每个旧(非默认)版本:
这应该会让您回到预期的位置。我们正在更改我们的工具(在接下来的几周内),以便这些工具会自动为您停止。
希望对您有所帮助!