Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Distributed Cache Service/ Getting Started/ Getting Started with Redis and Reading and Writing Data Using Web CLI

Getting Started with Redis and Reading and Writing Data Using Web CLI

Updated on 2024-11-18 GMT+08:00

This section takes the example of creating a single-node Distributed Cache Service (DCS) Redis 5.0 instance, connecting to it, and performing data read and write operations on the DCS console to get you quickly started with DCS.

There are three steps to get started with DCS:

  1. Preparations

    Before creating a Redis instance, an authenticated Huawei Cloud account with balance, users with required permissions, and a set of VPC and subnet should be prepared.

  2. Creating a DCS Redis Instance

    When creating a Redis instance, you can customize it with the required type and specifications, and configure a VPC and a subnet.

  3. Accessing a Redis Instance and Reading and Writing Data

    Access Redis instances and run Redis commands to read and write data on a client compatible with Redis or using Web CLI on the DCS console.

Preparations

  1. Register a Huawei Cloud account and authenticate it.
    If you already have one, go to 2. If you do not have one, do as follows:
    1. Log in to the Huawei Cloud official website, and click Register.
    2. Complete the registration as prompted. For details, see Signing up for a HUAWEI ID and Enabling Huawei Cloud Services.

      Your personal information page is displayed after the registration completes.

    3. Complete real-name authentication for individual or enterprise users by referring to Real-Name Authentication.
      NOTE:

      Real-name authentication is required only when you buy or use resources in the Chinese mainland.

  2. Top up your account.

    Ensure enough balance in your account.

  3. Add DCS permissions.

    Before creating a Redis instance and its dependencies, specific permissions are required. For details about how to add user permissions, see Creating a User and Granting DCS Permissions.

  4. Create a VPC and a subnet.

    A DCS instance runs in a virtual private cloud (VPC) and has a subnet. Prepare a VPC and a subnet before creating a DCS instance. For more information, see Creating a VPC. If you already have an available VPC and subnet, use them.

    NOTE:
    • The VPC must be created in the same region as your DCS Redis instance.
    • In VPC and subnet creation, retain the default settings unless otherwise specified.

Creating a DCS Redis Instance

  1. Go to the Buy DCS Instance page.
  2. Select Custom.
  3. Configure the instance. For details, see Table 1.

    Table 1 Configuring an instance

    Parameter

    Description

    Billing Mode

    Select Pay-per-use.

    Region

    Retain the default setting.

    Project

    Retain the default setting.

    Cache Engine

    This example uses Redis.

    Edition

    This example uses Basic.

    CPU Architecture

    This example uses x86.

    Version

    Select 5.0 in this operation.

    Instance Type

    Select Single-node in this operation. Single-node Redis instances use single nodes, do not persist data, and cost low. They are applicable in development and testing.

    AZ

    Each region contains multiple AZs. This example retains the default AZ.

    Instance Specification

    Select 128 MB in this operation.

    VPC

    Select the VPC in Preparations.

    Subnet

    Select the subnet in Preparations.

    IPv4 Address

    Auto and Manual are available.

    In this example, select Auto.

    Port

    Custom. The default port 6379 will be used when unspecified.

    In this example, use 6379.

    Security Group

    Skip it.

    Instance Name

    By default, a random name is generated. Retain it.

    Enterprise Project

    An enterprise project manages cloud resources by gathering relevant ones together. The default option default is available.

    If you cannot select a required enterprise project, see Why Can't I Select the Required Enterprise Project When Creating a DCS Instance?

    Password Protected

    Select Yes and enter Password and Confirm Password.

    (Optional) Advanced Settings

    In this example, you can skip these settings.

    Quantity

    One instance will be created by default, and you can buy up to 100 DCS instances at a time.

  4. Check the estimated price in the lower left corner of the page. You can click Pricing details to learn more.
  5. Click Next.
  6. Confirm the instance settings, and click Submit.

    The instance has been created successfully if it is in the Running state.

  7. After the task is successfully submitted, the Cache Manager page is displayed. When the new instance is in the Running state, the instance is created successfully.

Accessing a Redis Instance and Reading and Writing Data

This section takes the example of accessing a DCS Redis instance by using Web CLI on the console.

NOTE:

To access a DCS Redis instance on a compatible client, see Accessing Redis on a Client.

  1. In the navigation pane, choose Cache Manager. In the Operation column of the instance, choose More > Connect to Redis, as shown in the following figure.

    Figure 1 Accessing Web CLI

  2. Enter the password set in instance creation and go to Web CLI.

    NOTE:
    • If no operation is performed for more than 5 minutes, the connection times out. You need to enter the password to access the instance again.
    • You do not need to enter a password for accessing a password-free DCS Redis instance.

  3. Single-node instances support multiple databases (multi-DB). Select one of the databases. Select "Database 0" here.

    Figure 2 Selecting a Database

  4. Enter Redis commands in the input box. For example, run the SET command to write a data name KEY_NAME and data value VALUE, and press Enter. The data is written when "OK" is returned. Write another ABC data of 123 again.

    > SET KEY_NAME VALUE
      OK
    > SET ABC 123
      OK

  5. Run the GET command to read the written data.

    > GET KEY_NAME
      VALUE
    > GET ABC
      123

Related Information

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback