CentOS 6.9 Redis Installation and basic configuration (next)

Source: Internet
Author: User
Tags auth redis

After we install the Redis service, then we look at the basic configuration.

Redis configuration file default location/etc/redis.conf:

Egrep-v "(^#|^$)"/etc/redis.conf


Enter the Redis command line:

Redis-cli


Where 6379 is the listening port.

View all configurations: Configget *


To view a configuration: Configget loglevel


Modify a configuration: ConfigSet loglevel Warning


Note: After the completion of the above, the default will only modify the memory configuration, if the Redis service restarts, will re-read the configuration file to overwrite the modified configuration:


To write back to the configuration file, you can use rewrite:


By default, Redis only listens for the loopback address of the native, so the default is only for local clients to be able to connect to the Redis service, and to timeout from other clients on the same network:


We edit the configuration file and change it to 0 address:

bind0.0.0.0

After editing, restart the Redis service, intranet and other clients as well as the public network can be accessed:


Public network:


To do some basic security reinforcement configuration:

Disabling of some dangerous commands (added in/etc/redis.conf file):

Rename-commandflushall ""

Rename-commandflushdb ""

Rename-commandconfig ""

Rename-commandkeys ""

Rename-commandeval ""

Of course, you can also rename these dangerous commands:


Enable passwd authentication:


Once enabled, we verify the configuration above:

First go directly to the local redis-cli and use the Config command to modify the loglevel:


As you can see, the Config command is unrecognizable because of the previous settings, and we'll try again with the command defined earlier:


And because we set the Requirepass earlier, the default use of REDIS-CLI does not provide certified pass leads to no permissions.

You can use the following command to provide passwd when entering REDISCLI:

Redis-cli-h

You can also enter REDIS-CLI and use the AUTH command to authenticate:

Auth<passwd>


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.