从本地机器访问 GCP Memorystore [英] Accessing GCP Memorystore from local machines

查看:46
本文介绍了从本地机器访问 GCP Memorystore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发过程中从本地机器访问 Memorystore 的最佳方式是什么?有没有像 Cloud SQL Proxy 这样的东西可以用来设置隧道?

Whats the best way to access Memorystore from Local Machines during development? Is there something like Cloud SQL Proxy that I can use to set up a tunnel?

推荐答案

您可以启动 Compute Engine 实例并使用端口转发连接到您的 Redis 机器.

You can spin up a Compute Engine instance and use port forwarding to connect to your Redis machine.

例如,如果您的 Redis 机器具有内部 IP 地址 10.0.0.3,您会这样做:

For example if your Redis machine has internal IP address 10.0.0.3 you'd do:

gcloud compute instances create redis-forwarder --machine-type=f1-micro
gcloud compute ssh redis-forwarder -- -N -L 6379:10.0.0.3:6379

只要保持 ssh 隧道打开就可以连接到 localhost:6379

As long as you keep the ssh tunnel open you can connect to localhost:6379

更新:现在正式记录在案:https://cloud.google.com/memorystore/docs/redis/connecting-redis-instance#connecting_from_a_local_machine_with_port_forwarding

Update: this is now officially documented: https://cloud.google.com/memorystore/docs/redis/connecting-redis-instance#connecting_from_a_local_machine_with_port_forwarding

这篇关于从本地机器访问 GCP Memorystore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆