简体   繁体   中英

How can i split data in redis cluster?

Is there any possibility to split the data in the redis cluser. If there are multiple application using the same redis cluster, would there any possibility to split the key value pair based on application name. One way i could see is using database select in the redis, but it don't work in the redis cluster. can you please suggest any other approach.

Indeed, shared/numbered/logical databases are not supported by the Redis cluster. That said, even if the cluster had supported databases, I would recommend against using them for multiple applications.

Your best option is to install a Redis cluster per application. This will not only solve the namespacing problem, but will also ensure each application can fully utilize its Redis database's resources and allows per-app configuration of the database.

If you must, you can still use a single database for all your applications by prefixing each key with a unique, per-application, prefix to provide a "namespace" for each app.

database select is not supported by redis cluster mode. You can adopt the concept of namespace by appending the application name to key. But it's not a good idea to use the same redis cluster for different application. It will make the maintenance and troubleshooting more difficult.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM