Skip to main content

SQL Console (Redis)

This article introduces how to use the SQL Console to manage Redis databases.

Background

Redis is an in-memory data structure storage system that is widely used in various applications such as caching, queuing, real-time analysis, etc. However, managing Redis databases requires certain technical knowledge and experience, which can be a challenge for many developers.

The SQL Console of NineData can help users manage Redis databases more easily. Through NineData, users can easily view, edit, and manage Redis data, as well as create, delete, and modify Redis databases.

Features

The SQL Console of NineData provides multiple convenient features to help you easily manage your data source.

FeatureDescription
AI intelligent assistanceProvides natural language conversion function. Redis commands can be quickly converted through short natural language expressions.
Visual managementSupports visual operations such as accessing and viewing data, creating, deleting, renaming, and modifying the expiration time of keys, and adding, deleting, and modifying the content of keys.
EditorProvides a command-line mode that supports powerful Redis commands and options to meet various needs. The Redis commands supported by the editor are listed in the appendix.
Workspace recoveryIn the event of unexpected browser exit or sudden host failure, you only need to log in to the NineData console and open the SQL Console. The previously opened data sources and executed commands will be automatically loaded. Because the page state is saved in the cloud and is not restricted by the browser or host, you can recover your workspace anytime, anywhere.
Execution history records all the commands executed by the current account in the NineData console and supports fast retrieval based on data source, execution time, command keywords, etc. You can also quickly copy and execute commands from the execution history.
SQL specification checkUnder the organization modeThe organization mode supports assigning different roles and resource management permissions to each user under the organization, which is suitable for multi-user collaborative development under the same organization. It ensures data security and improves overall production efficiency., the system checks every command executed in the SQL Console based on the SQL development policy configured by . If the command does not comply with the specification, it will be intercepted by the system to ensure database security.

Use Cases

The Redis editor feature of NineData is suitable for the following use cases:

  • Developers: During the development process, developers can manage and edit data in Redis databases through the SQL Console to develop applications more quickly and efficiently.
  • Database administrators: Help database administrators to manage Redis databases more easily, such as adding, editing, and deleting data.
  • Operations personnel: Help operations personnel to monitor and analyze the performance and operation of Redis databases quickly, in order to detect and resolve problems in a timely manner.

Limitations

  • Displaying the size of a Key is only supported in Redis version 4.0.0 and above.
  • Managing Keys of Stream type is only supported in Redis version 5.0.0 and above.

Prerequisites

  • The target database to be managed has been added to NineData. For instructions on how to add it, please refer to Managing Data Sources.

  • The data source must be Redis version 3.0.0 or higher.

  • In the organizational mode (), you must have read-only, DML, or DDL permissions on the target data source.

    tip

    Read-only permission only supports query operations.

  • In the commercial versions (, ), please ensure that your monthly/yearly subscription is not expired, as it may result in the inability to use the Database DevOpsservice. You can quickly check the remaining quota and expiration date at the top right corner of the NineData console page.

    check_quota

Interface Description

  • Visual Editor

    gui

    Index
    Feature
    Description
    1SQL TabRepresents the currently open SQL console for the data source. Multiple SQL consoles can be toggled by clicking on the tabs, and the close button X on the right side of the tab can be used to close the SQL console. The right-click menu supports the following operations:
    • : Open the current data source details window.
    • : Open a new data source SQL console.
    • : Close the current tab.
    2Open Data SourceSelect and open a new data source SQL console.
    3Data Source InformationDisplays the data source information for the current SQL console, including environment, IP address, and port number.
    Right-click menu:
    • : Show detailed information of the current data source, including username, connection address, running time, and connection count, etc.
    • : Refresh the data source information.
    4Favorite|Refresh
    • Favorite: Clicking the favorite icon adds the current data source to , allowing for quick selection in a new SQL Console after addition.
    • Refresh: Refresh the data in the current data source.
    5Database NameSwitches the Redis database.
    Right-click menu:
    • : Show detailed information of the target database, including database name, default character set, database size, total number of keys, etc.
    • : Create a new key. The creation options depend on the . Please configure it according to the page prompts.
    • : Open a new SQL tab window.
    6Function Buttons
    • setting02:
      • : Choose or .
        • (default): The new result set will overwrite the previous execution result.
        • : Generate a new tab to display the new result set.
      • : Change the theme of the SQL window, choose between and .
      • : Drag the slider to adjust the font size of SQL statements in the SQL window. The default values are as follows:
        • Windows: 16
        • MacOS: 13
    • thread: Displays information about all active connections on the current database server, along with the queries these connections are currently executing. also supports automatic refresh functionality, with options to automatically refresh every 5, 10, 20, or 30 seconds.
    • table: Toggle to visualization mode.
    • codefill: Toggle to editor mode.
    • expend: Display the SQL console in full-screen mode (based on browser size). After going full-screen, you can click the compress button in the upper right corner to restore the original SQL console size.
    7SearchQuickly search for the target key by entering the key name. It supports both exact search by entering the complete key name and fuzzy search by entering partial characters with an asterisk (*) wildcard.
    8Key ListDisplays the keys in the current database, with a default load of 100 keys. To load more, you can scroll the list to the end and click on to load another 100 keys. In the Key List, you can perform the following operations on keys:
    • : Right-click on the target key, click , enter the new key name in the text box below , and then click .
    • : Right-click on the target key, click , and then click to delete the current key.
    • : Right-click on the target key, click , enter an integer in the text box below or click the UpDown button next to the text box to adjust the number up or down, the unit is in seconds, and then click . To remove the expiration time, delete the number in the text box and click .
    • : Right-click on any key, click , and open the tab. You can configure the based on your needs. The creation options vary depending on the . Please configure it according to the page prompts. After configuration, click to create the key.
    • : Right-click on any key, click , to open a new SQL tab window.
    • : Right-click on any key, click , to refresh the key list.
    9Create KeyCreate a new key. Click on to open the tab. You can configure the based on your needs. The creation options vary depending on the . Please configure it according to the page prompts. After configuration, click to create the key.
    Note: To close the tab, simply click the Close icon on the right side of the tab.
    10Key DetailsClick on a key in the Key List to display its details here. For keys with data exceeding 100 records, only the first 100 records are loaded by default. Click on at the bottom of the page to load another 100 records.
    In the Key Details, you can perform the following operations on the key:
    • Common Operations:
      • Change Key Name: Click on the edit icon to the right of the key name, enter the new key name in the text box, and then click check.
      • Refresh Key Content: Click on the fresh icon to refresh the content of the key.
      • Delete Key: Click on the delete icon, and then click to delete the current key.
      • Change Key Expiry: Click on the edit icon next to , enter an integer in the text box, or click the UpDown button next to the text box to adjust the number up or down. The unit is in seconds. Then click check. To remove the expiration time, delete the number in the text box and click check.
      • View Key (Only available in version 4.0.0 and above) and .
      • Change the Display Format of Key Data: Click on the drop-down box to the left of the search box, which is set to Unicode by default. Select the desired display format.
      • Search Data in the Key (except for Stream type): Supports both exact and fuzzy searches. Click on the search icon to view the search results.
        • Exact Search: Enter the complete field or value for an exact search.
        • Fuzzy Search: Enter a partial string with an asterisk wildcard (*) for fuzzy search.
    • Operations on Key Data: Depending on the type of key, different operations are supported. Typically, you can add, edit, and delete data in the key. Please refer to the console for specific details.
  • Command Line Editor

    command_line

    Number
    Function
    Description
    1SQL TabRepresents the currently open SQL console for the data source. Multiple SQL consoles can be switched by clicking on the tabs, and a SQL console can be closed by clicking on the X on the right side of the tab. The right-click menu supports the following actions:
    • : Open the details window for the current data source.
    • : Open a new SQL console for a different data source.
    • : Close the current tab.
    2Open Data SourceSelect and open a new SQL console for a different data source.
    3Data Source InformationDisplay information about the data source of the current SQL console, including environment, IP address, and port number.
    Right-click menu:
    • : Show detailed information about the current data source, including username, connection address, runtime, and number of connections.
    • : Refresh the data source information.
    4Favorite|Refresh
    • Favorite: Clicking the favorite icon adds the current data source to , allowing for quick selection in a new SQL Console after addition.
    • Refresh: Refresh the data in the current data source.
    5Database NameSwitching Redis database or node addresses in cluster mode.
    The commands that need to be executed to switch node addresses in cluster mode include KEYS, SCAN, CLUSTER FLUSHSLOTS, CLUSTER MYID, CLUSTER MYSHARDID, CLUSTER ADDSLOTS, CLUSTER ADDSLOTSRANGE, CLUSTER DELSLOTS, and CLUSTER DELSLOTSRANGE. For any other commands, they can be executed on any node.
    Right-click menu:
    • : Show detailed information about the target database, including database name, default character set, database size, total number of keys, etc.
    • : Create a new key. The creation options depend on the selected . Please configure according to the prompts on the page.
    • : Open a new SQL console tab.
    6Function Buttons
    • execute: Execute the selected Redis command.
    • : Open the tab. You can choose the according to your needs. The available options depend on the selected . Please configure according to the prompts on the page, and click when finished.
    • time: View the command execution history of the target data source. You can filter the execution history by date or search the history using keywords (command, database number, error message). Click the in the column on the right side of the target execution history to copy it to the clipboard.
    • setting02: Set the display mode for the result set and the font size of the SQL console.
      • : Select either or .
        • (default): New result sets will replace the previous execution result.
        • : Generate a new tab to display the new result set.
      • : Change the theme of the SQL console, with options of and .
      • : Adjust the font size of the commands in the SQL console by dragging the slider. The default values are as follows:
        • Windows: 16
        • MacOS: 13
    • : Displays information about all active connections on the current database server, along with the queries these connections are currently executing.
    • thread: : Display information about all active connections on the current database server and the queries being executed by these connections. also supports automatic refresh functionality, with options to automatically refresh every 5, 10, 20, or 30 seconds.
    • admin: | Only can operate. After enabling this mode, all commands executed in the SQL window are not subject to standardization or approval flows and can be executed directly.
    • table: Switch to visualization mode.
    • codefill: Switch to editor mode.
    • expend: Display the SQL console in full screen mode (based on the browser size). After entering full screen mode, click compress in the upper right corner to restore the original size of the SQL console.
    7SearchQuickly find the target key by entering the key name. Supports searching with the complete key name for precise search, or using partial characters with asterisks (*) as wildcards for fuzzy search.
    8Key ListDisplays the keys in the current database, with 100 keys loaded by default. To load more keys, you can scroll the list to the end and click to load another 100 keys. In the Key List, you can perform the following actions on keys:
    • : Right-click on the target key, click , enter the new key name in the text box below , and then click .
    • : Right-click on the target key, click , and then click .
    • : Right-click on the target key, click , enter an integer in the text box below , or click the UpDown button to adjust the number up or down. The unit is seconds. Then click . To remove the expiration time, delete the number in the text box and click .
    • : Right-click on any key, click , and open the tab. You can choose the according to your actual needs. The creation options differ depending on the selected , so please configure it according to the on-screen prompts. Once configured, click .
    • : Right-click on any key, click , to open a new SQL console tab.
    • : Right-click on any key, click to refresh the key list.
    9Command Line WindowA window for executing Redis commands. It supports the following features:
    • Execute Redis commands: Supports executing single or multiple commands.
    • Syntax highlighting.
    • Right-click menu:
      • : Execute the SQL statement at the cursor position.
      • : Save all commands in the current SQL Concosle to favorites for easy access next time.
      • : View saved commands. You can insert the target command into the current SQL window. Additionally, you can or the target command.
      • : View the command execution history of the target data source. You can choose to filter out the execution history of a certain time period or search the execution history by keywords (SQL statement, database name, error message).
      • : Display information about all active connections on the current database server and the queries being executed by these connections.
      • General Operations: Including , , , and .
      • : Select the SQL statement at the cursor position.
    10Execution Information, Result SetDisplays the execution information and result set of commands.
    • Execution Information: Includes execution time, executed command, execution status, execution details, and other information.
    • Result Set: Displays the results of the command. You can also perform the following actions:
      • Search within the result set. Supports and .
      • Click the small arrow next to the column name to sort the result set.
      • View SQL Statement for Result Set: Hover the mouse over the tab of the target result set to display the SQL statement corresponding to that result set.

Operation Steps

  1. Log in to the NineData Console.

  2. Click on > in the left navigation bar.

    tip

    If you have previously logged in to a data source and did not close it, you will be automatically directed to that data source page.

  3. Click on the text box below , and a pop-up will appear showing the data sources you have added. Click on the desired data source, and then click to go to the SQL console.

    tip
    • If you haven't created data source before, a blank page will be displayed. In this case, please click on on the page.
    • If you have multiple data sources, you can enter complete or partial keywords in the box for precise or fuzzy search. The searchable fields are as follows:

      • Data source name

      • IP address

:::

  1. Once the SQL console is opened, you can perform SQL development operations on the data source. For detailed instructions on how to use the SQL console, please refer to the Interface Explanation section.

Appendix: Command List Supported by Redis Editor

KeywordSupported VersionCommand Format
BITCOUNT2.6.0BITCOUNT key [start end]
BITFIELD3.2.0BITFIELD key [GET type offset] [SET type offset value] [INCRBY type offset increment] [OVERFLOW WRAP|SAT|FAIL]
BITFIELD_RO6.0.0BITFIELD_RO key [GET encoding offset [GET encoding offset ...]]
BITOP2.6.0BITOP <AND | OR | XOR | NOT> destkey key [key ...]
BITPOS2.8.7BITPOS key bit [start [end [BYTE | BIT]]]
GETBIT2.2.0GETBIT key offset
SETBIT2.2.0SETBIT key offset value