Technology Sharing

redis-cli connects to Redis

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Redis-cli Introduction

redis-cli is a command line tool that comes with native Redis. You can use redis-cli to connect to the Redis database on the cloud host or local device to manage data.

For instructions on how to use the redis-cli client, please refer toOfficial Documentation

Connection Command

redis-cli -h <redis_instance_address> -p <port> -c

▪︎ <redis_instance_address>: Indicates the connection address of the Redis Cluster instance. Please replace it according to the actual address.

▪︎ <port>: Indicates the port number of the Redis Cluster instance. The default value is 6379.

▪︎ -c: Required parameter when connecting to a cluster node (optional for the stand-alone version).

Example:

redis-cli -h localhost -p 6379 

My port has been changed to 6380, the default is 6379.

Redis access password

If the Redis instance has an access password set, you need to execute the following command to verify the password. Only after the verification passes can you read and write cache data.

Order:

  1. auth <password>
  2. #或者
  3. auth <user>:<password>
  • <user>: Indicates the account number.

  • <password>: Indicates the password of the account.

  • If you are using the default account, fill in the<password>That's it.

No login prompt: NOAUTH Authentication required.

After login

View information

info