Redis uses multiple database and password configurations

Source: Internet
Author: User

The default port for Redis is 6379, you can use a maximum of 16 databases, and the database is independent from one another.

Different databases can be accessed by select Num

The following commands can be used to switch to different databases, each with its own space, without worrying about key conflicts.

The FLUSHDB command clears the data and clears only the data under the current database, without affecting other databases.

Multi-Port using Redis

Use Redis on the same machine, enable multiple ports, implement multiple instances, complete the simulation of the cluster implementation.

A new port (process) can then be opened via Redis-server-port 6378.

However, this is not recommended because it takes a lot of effort to maintain the new port

Redis Configuration Authentication Password

1. Configuring with configuration Files
The Yum-style installation of Redis profiles is typically in/etc/redis.conf, which opens the configuration file to find

  

#requirepass foobared

Remove the comment before the line, and change the password to the desired password, save the file

requirepass mypassword

Restart Redis

sudo service Redis restart# or sudo service Redis Stopsudo redis-server/etc/redis.conf

This is the time to try to log in to Redis and find that it is possible to mount, but the specific command is prompt operation is not allowed

Try to log in with a password and execute a specific command to see that it can be executed successfully

Redis uses multiple database and password configurations

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.