If you have a Redis database, you'll probably have wanted an easier way to do ad-hoc queries and updates with it. We have and that's why we're introducing the Redis data browser for Compose.s
The problem with the
redis-cli is that it is an integral part of the Redis database distribution so you have to build or install Redis on your local system before you can make use of it. Then you have to get your Redis database URI and password so you can connect the
redis-cli to your Compose Redis database. If that's your development workstation, then that's reasonable, but when you are out on the road or away from your desk and need to, say, add some key/values, edit some values or just see what some keys are set to, then this becomes burdensome.
Building on our tradition of not just hosting databases by making them more accessible, we're bringing a version of our data browser to Redis. That means that when you are logged into to your Compose dashboard and viewing your Redis deployment, one click on the "Browser" button in the sidebar and you will be able to explore your data. We've a screencast that can tell you more...
Your first view will be an overview of the sixteen databases of key/values that Redis holds. By default, new connections will use database 0 unless a user selects one of the other 15. Each database is listed along with the number of keys it currently holds. You can drill down into each database to get a
SCAN view of the keys.
The virtual command line here offers
SCAN command which allows you to set how many keys to display, set with
COUNT after skipping over a number of other keys, set with
CURSOR. The displays syntax is similar but not identical to the of the redis-cli. Selecting the
MATCH= option on the line below allows you to add a wildcard string to select which keys you want displayed. Wild cards include ? and * for any single character and any number of characters.
The list below shows what keys and values match the current
SCAN, with the number of characters (for strings), fields (for hashes), elements (for lists) or members (for sets) that that key represents. Clicking on the row takes you into a view of that item. Click on
keys to return to the
To add a key, use the
Add Key button on the right. This takes you to our new key editor view. There's five different operations you can carry out here:
- String does a Redis
SETwhich sets a key with a string value.
- Hash does a Redis
HSETwhich sets a key with a hash value and, within that, a field with its own value.
- List does a Redis
RPUSHwhich sets a key with a list value and then appends the given value to the tail end of that list.
- Set does a Redis
SADDwhich sets a key to be a set value and then adds the value given as a member of that set.
- Sorted Set does a Redis
ZSETwhich sets a key to be a sorted set value then adds a member and score for that member to the sorted set.
After any key addition, you can go straight to the created key by clicking "View key" in the confirmation dialog. That will take you to the value editor. As well as being able to delete the key and associated value with the "Delete" button, you can re-set a simple key/value's value (
SET), add and remove a hash's fields and values (
HDEL), push new values to the start and end of a list (
RPUSH) and add and remove members to both kinds of set (
ZREM). This value editor is also displayed when you click on a key in the
We've set out to follow the Redis CLI style for commands so that using the browser not only lets you make changes but helps you remember the various Redis commands whenever you do use
redis-cli. Thats is just one of the ways we like to empower our users at Compose.
If you have any comments or issues with the Redis Data Browser please contact firstname.lastname@example.org by email or through the integrated support page for assistance.