Redis Password Management

Source: Internet
Author: User
Tags auth redis

I. how to initialize the Redis password.

A total of 2 steps:

A. There is a parameter in the configuration file: Requirepass This is the parameter that configures the Redis access password.

Like Requirepass test123.

B. The parameters in the configuration file need to be restarted to restart Redis.

Ii. do not restart Redis How do I configure a password?

A. Configure the Requirepass password in the configuration file (the password is still valid when Redis restarts).

# Requirepass Foobared
As modified to:

Requirepass test123

B. Enter Redis redefine parameters

To view the current password:

[root@slaver251 redis-2.4.16]#./src/redis-cli-p 6379
Redis 127.0.0.1:6379>
Redis 127.0.0.1:6379> config Get requirepass
1) "Requirepass"
2) (nil)

The display password is empty,

Then set the password:

Redis 127.0.0.1:6379> Config set Requirepass test123
Ok

Check password again:

Redis 127.0.0.1:6379> config Get requirepass
(Error) ERR Operation not permitted

This is an error.

Now you just need the password authentication.

Redis 127.0.0.1:6379> Auth test123
Ok

Check password again:

Redis 127.0.0.1:6379> config Get requirepass
1) "Requirepass"
2) "Test123"

The password has been modified.

When the Redis is ready to restart, the password will automatically take effect because the configuration parameters have been modified.

If the configuration parameter does not add a password then the Redis restart password will be equivalent to no settings.

Three. how to log in with a password for Redis.

A. Enter the password when you log in

[root@slaver251 redis-2.4.16]#./src/redis-cli-p 6379-a test123
Redis 127.0.0.1:6379>
Redis 127.0.0.1:6379> config Get requirepass
1) "Requirepass"
2) "Test123"

B. Log in again to verify:

[root@slaver251 redis-2.4.16]#./src/redis-cli-p 6379
Redis 127.0.0.1:6379>
Redis 127.0.0.1:6379> Auth test123
Ok
Redis 127.0.0.1:6379> config Get requirepass
1) "Requirepass"
2) "Test123"
Redis 127.0.0.1:6379>

Four. Master has a password and slave how to configure it.

When Master has a password, the corresponding password parameters should be configured appropriately when the slave is configured. Otherwise, slave is not able to replicate normally.

The corresponding parameters are:

#masterauth

Like what:

Masterauth Mstpassword


Original address: http://blog.csdn.net/lxpbs8851/article/details/8136126

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.