(Basic knowledge) Redis connection and security

1. Query whether the connection requires a password redis

127.0.0.1:6379> CONFIG get requirepass
1) "requirepass"
2) ""

When an empty string, the server is connected to redis not required to enter a password

2. Set connection password redis

127.0.0.1:6379> CONFIG set requirepass "kkk123"
OK
127.0.0.1:6379> CONFIG get requirepass
1) "requirepass"
2) "kkk123"

3. The connection authentication password  

AUTH password received password string as a parameter
[@ wwZ the root /] # Redis-CLI -H 127.0 . 0.1 -p 6379 # Redis - CLI client connection command
 127.0.0.1:6379> auth kkk123 OK 127.0.0.1:6379>

   Using a remote connection  

redis-cli -h host -p port -a password

 

4. The maximum number of connections

Server---maxclients Redis 100000 
query maximum number of connections
config get maxclients

1) "maxclients" 2) "10000"
 

5 commonly used commands

. 1 .Auth command is used to detect a given profile and password matches the password
 127.0 . 0.1 : 6379 > the AUTH PASSWORD 
2 .Echo command for printing the given string 127.0 . 0.1 : 6379 > ECHO " the Hello World " " the Hello World "

3 .Redis connection Ping to test whether the server is still in force # Connection is normal redis 127.0.0.1:6379> PING PONG # Improperly connected redis 127.0.0.1:6379> PING Redis not Connect to AT Could 127.0 . 0.1 : 6379 : Connection refused The
4 .Redis the Quit to close the current client and redis service connection. 127.0 . 0.1 : 6379 > the QUIT The OK
. 5 .Redis the Select command for switching to the specified database, the database index number specified by the index numeric value to 0 as the initial value of the index Use # 1 number of the database 127.0 . 0.1 : 6379 > the SELECT 1 the OK

Guess you like

Origin www.cnblogs.com/ddf128/p/12176072.html