Redis configures password authentication, and you can connect through passwords

Requirement description :

  Today, I configured a redis server, and I want to log in by configuring the username/password like other databases.

  I looked it up and didn't see the place where the user name was configured, that is, there was an authentication password, so I did a test and recorded it here.

Operation process:

1. Open redis password authentication, open redis.conf, and find the following content

[aiprd@redhat6 redis-4.0.2]$ grep "requirepass" redis.conf 
# If the master is password protected (using the "requirepass" configuration
# requirepass foobared

2. Remove the comment in front of requirepass and change foobard to your own password

[aiprd@redhat6 redis-4.0.2]$ grep "requirepass" redis.conf 
# If the master is password protected (using the "requirepass" configuration
requirepass An4Z0EnM

Note: The authentication password has been changed.

3. Restart the redis server to make the configuration file take effect, then log in to the redis client to get the key information

[aiprd@redhat6 redis-4.0.2]$ src/redis-cli 
127.0.0.1:6379> keys *
(error) NOAUTH Authentication required.
127.0.0.1:6379>

Note: If password authentication is performed, the data in it cannot be obtained. Note that there is a process of restarting the redis server.

4. Obtain the data in redis by using auth <password> in the redis client

[aiprd@redhat6 redis-4.0.2]$ src/redis-cli 
127.0.0.1:6379> keys *
(error) NOAUTH Authentication required.
127.0 . 0.1 : 6379 > auth An4Z0EnM #After              entering auth and password here, you can get the data in redis .
OK
127.0.0.1:6379> keys *
(empty list or set)

5. On the command line, authenticate directly through the -a option plus a password

[aiprd@redhat6 redis-4.0.2]$ src/redis-cli -a An4Z0EnM
127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379> 

 

Summary :

  There is no concept of user in redis, it is an authenticated password, and the data in it is obtained after the authentication is successful.

 

Document Creation Time: April 16, 2018 20:37:29

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324594093&siteId=291194637
Recommended