This topic describes the methods that you can use to access an ApsaraDB for Redis instance.
Prerequisites
The IP address of your client is added to a whitelist of your ApsaraDB for Redis instance. For more information, see Configure whitelists.
The IP address or CIDR block of your client must be added to a whitelist of your ApsaraDB for Redis instance regardless of what connection method you use. If you cannot connect to your instance, you can use the connection diagnostics feature to check whether the IP address of your client is added to a whitelist of your instance.
Password-only logon
- Logon method: Connect to your instance by using a password instead of a username-password combination.
- Limits: This method is applicable only to the default account of your instance. Typically, the username of the default account is the instance ID. Examples:
r-bp1jpghfglv6******
anddefault
. You can view the default account on the Account Management page in the console. - Benefits: This method is similar to the way you connect to open source Redis. This is a convenient and widely used method. In this case, the instance may connect to multiple applications by using the default account because an instance has only a single default account.
- Example (use redis-cli to connect to an instance):
# Use the default account whose username is r-bp1jpghfglv6****** and password is Rp829dlwa to connect to your instance. redis-cli -h r-bp1zx****.redis.rds.aliyuncs.com -p 6379 -a Rp829dlwa
Account and password logon (recommended)
- Logon method: Use the username and password of an account to connect to your instance. Separate the username and password with colons (
:
). Example:user:password
.Note- If you use a third-party database management tool such as RDM to connect to your ApsaraDB for Redis instance, enter the password in the
user:password
format. - If you use Data Management (DMS) to connect to your ApsaraDB for Redis instance, enter the username of the database account and corresponding password.
- ApsaraDB for Redis instances that are compatible with Redis 6.0 and later also support the
AUTH user password
format.
- If you use a third-party database management tool such as RDM to connect to your ApsaraDB for Redis instance, enter the password in the
- Limits: No limits are imposed on this method. This method is applicable to both the default account and standard accounts of your instance.
- Benefits: You can create multiple accounts for your ApsaraDB for Redis instance and connect to your instance by using different accounts in different applications to ensure data security. For more information about how to create a database account, see Create and manage database accounts.
- Example (use redis-cli to connect to an instance):
# Use a custom account whose username is testaccount and password is Rp829dlwa to connect to your instance. # Format 1: user:password. # This format is applicable to Tair and ApsaraDB for Redis instances. redis-cli -h r-bp1zx****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa # Format 2: user password. # This format is applicable to Tair and ApsaraDB for Redis instances that are compatible with Redis 6.0 and later. redis-cli -h r-bp1zx****.redis.rds.aliyuncs.com -p 6379 AUTH testaccount Rp829dlwa
Password-free logon
- Logon method: Connect to your instance without using a username or password.
- Limits:
- Client: Your client must be deployed within the same virtual private cloud (VPC) as your ApsaraDB for Redis instance.
- Instance: Your ApsaraDB for Redis instance must have password-free access enabled. For more information, see Enable password-free access.
This method is applicable only when you use the default account to connect to the instance over the internal endpoint of the instance. After you connect to the instance by using this method, you have read and write permissions on the instance.
- Benefits: You can connect to your instance without using a password. This method is less secure than the preceding methods. By default, all clients that are deployed within the same VPC as the instance can connect to the instance by using this method. You can use the
#no_loose_check-whitelist-always
parameter to specify whether to check that the IP address of a client is added to a whitelist of the instance. For more information, see Supported parameters. - Example (use redis-cli to connect to an instance):
# Connect to your instance in password-free mode. redis-cli -h r-bp1zx****.redis.rds.aliyuncs.com -p 6379
If you forget the password or have not set a password, you can reset the password. For more information, see Change or reset the password.
Common errors
Error message | Cause and solution |
---|---|
|
The specified password is invalid. Specify the username and password in the correct format as described in this topic. |