How to Connect to a Redis instance from a Compute Engine VM in google Cloud
There are multiple options to connect to a redis instance in GCP (Google Cloud Project) to test.
- Telnet
- GKE
- redis-cli
Telnet:
1. Create a Compute Engine VM that uses that same authorized network as your Redis instance.
2. Install telnet using apt-get:
- If successful, the command will return this result: 
- In the telnet session, enter some Redis commands: - Enter: - Result: - Enter - Result: - Enter: - Result: 
redis-cli
- Install - redis-clion the Compute Engine VM by running the following command from the Compute Engine SSH terminal:
- Run the following command in the Compute Engine terminal, replacing variables with appropriate values. - You are now connected to your Redis instance using - redis-cli.
- Once you are done testing your connection to the Redis instance, you should consider deleting the Compute Engine VM . 
GKE:
- Click the Connect button to the right of your cluster's name, then click the Run in Cloud Shell button in the window that appears.
- Configure kubectlcommand line access by running the following command:- CLUSTER_NAMEis the name of your cluster.
- CLUSTER_ZONEis the zone your cluster is in. Must also be the zone your Redis instance is in.
- PROJECT_IDis the project where your cluster and your Redis instances exist.
 kubeconfig generated for CLUSTER_NAME
- Use the following command to start a Redis pod running the redis-cli:
- Run a redis-clicommand, replacingHOST-IPwith the host IP address of your Redis instance:
- Optionally, run a Redis benchmark command, again replacing HOST-IPwith the host IP address of your Redis instance:
 
 
 
 
No comments