Redis-cli interaction

Redis CLI Interaction

Initial Redis CLI Interaction

redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> keys *
1) "key1"
127.0.0.1:6379> scan
(error) ERR wrong number of arguments for 'scan' command
127.0.0.1:6379>
            

Set and Get Operations

127.0.0.1:6379> set key value1
OK
127.0.0.1:6379> set key value2
OK
127.0.0.1:6379> get key
"value2"
127.0.0.1:6379> set image:key value2
OK
127.0.0.1:6379> set link:key value1
OK
127.0.0.1:6379> get link:key
"value1"
127.0.0.1:6379> get image:key
"value2"
            

Kubernetes and Exec Commands

kubectl get pods
NAME                             READY   STATUS    RESTARTS      AGE
redis-5c995b7fbf-jxddf           1/1     Running   0             8h
redis-5c995b7fbf-vp2cd           1/1     Running   0             8h
redis-5c995b7fbf-z6pg7           1/1     Running   0             8h
redis-master-5ccf554d96-ssrql    1/1     Running   2 (16s ago)   7h56m
redis-replica-858fc45586-97zbd   1/1     Running   0             7h51m
redis-replica-858fc45586-zfl92   1/1     Running   0             7h51m

kubectl exec -it redis-replica-858fc45586-97zbd -- nslookup redis-master
error: Internal error occurred: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "3d0126182660c945f60cbc95781e02ac8ae093d72e953cb9a22d293288cb8022": OCI runtime exec failed: exec failed: unable to start container process: exec: "nslookup": executable file not found in $PATH: unknown

kubectl exec -it redis-replica-858fc45586-97zbd -- /bin/bash
root@redis-replica-858fc45586-97zbd:/data# key *
bash: key: command not found
root@redis-replica-858fc45586-97zbd:/data# exit
command terminated with exit code 127

kubectl exec -it redis-replica-858fc45586-97zbd -- redis-cli
127.0.0.1:6379> keys *
1) "link:key"
2) "image:key"
3) "key1"
4) "key"
            

Comments