In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how many redi default dbs, the code is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article, I hope you can get something.
Redis supports multiple databases, and the data in each database is isolated and cannot be shared, and it is based on a stand-alone machine. If it is a cluster, there is no database concept.
Redis is a dictionary-structured storage server, but in fact an Redis instance provides multiple dictionaries for storing data, and the client can specify which dictionary to store the data in. This is similar to the well-known fact that multiple databases can be created in a relational database instance, so each dictionary can be understood as a separate database.
Each database is externally named with an incremental number starting from 0. Redis supports 16 databases by default (more can be supported through configuration files, no upper limit). You can modify this number by configuring databases. The client automatically selects database 0 after establishing a connection with Redis, but you can use the SELECT command to change the database at any time. To select database 1:
Redis > SELECT 1OKredis [1] > GET foo (nil)
However, these databases named after numbers are different from those we understand. First of all, Redis does not support custom database names, each database is named by a number, and developers must record which databases store which data. In addition, Redis does not support setting a different access password for each database, so a client can either access all databases or do not even have permission to access one database. The most important point is that multiple databases are not completely isolated. For example, the FLUSHALL command can empty the data in all databases in a Redis instance. To sum up, these databases are more like a namespace than suitable for storing data from different applications. For example, database 0 can be used to store data in the production environment of an application, and database 1 can be used to store data in the test environment, but it is not suitable to use database 0 to store data in application An and database B in database 1. Different applications should use different Redis instances to store data. Because Redis is very lightweight, an empty Redis instance takes up only about 1m, so you don't have to worry about multiple Redis instances taking up a lot of extra memory.
The above is the default number of dbs for redi. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.