I'm currently trying to connect my App Engine node.js service to a Google Cloud Memorystore. Following this guide, I need both to run in the same network and region (in my case Europe). This seems impossible since I can only create the Redis instance in europe-west-1 or europe-west-4, while App Engine offers me europe-west, europe-west-2 or europe-west-3.
I'm assuming 'same region' stands for europe-west-x ? If this is true, I'm still unable to connect, configuring the Node.js on the IP X.X.X.X:XXXX
as described in the gcloud console (for my active Redis instance) the app throws connection failed, ETIMEDOUT
.
Is the region the reason?
The instance has the authorized network set to default
and the apps app.yaml has:
network: name: default
UPDATE:
Even when i have GAE in europe-west-1 and Memorystor in europe-west as suggested i get
Redis connection to X.X.X.X:XXXX failed - connect ETIMEDOUT X.X.X.X:XXXX
I'm using node_redis with the following code fragment to test the connection (REDIS_PORT and REDIS_IP are the values i see on the Memorystore instance page):
const redis = require('redis');
let redisClient = redis.createClient(REDIS_PORT, REDIS_IP);
redisClient.set("string key", "string val", redis.print);
redisClient.hset("hash key", "hashtest 1", "some value", redis.print);
redisClient.hset(["hash key", "hashtest 2", "some other value"], redis.print);
redisClient.hkeys("hash key", function (err, replies) {
console.log(replies.length + " replies:");
replies.forEach(function (reply, i) {
console.log(" " + i + ": " + reply);
});
redisClient.quit();
});
redisClient.on("error", function (err) {
console.log("Redis rror " + err);
});
I realized the GAE service has to run in the flex environment, so the application is based on Google Compute Engine aswell. The env: flex
was missing in the app.yaml. The communication between GAE and Memorystore is working with this configuration.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments