165
Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD.

User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Distributed Cache Service

User Guide

Issue 01

Date 2020-04-20

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.

Huawei Technologies Co., Ltd.Address: Huawei Industrial Base

Bantian, LonggangShenzhen 518129People's Republic of China

Website: https://www.huawei.com

Email: [email protected]

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. i

Page 3: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Contents

1 Introduction.............................................................................................................................. 11.1 What Is DCS?............................................................................................................................................................................ 11.2 Application Scenarios............................................................................................................................................................. 31.3 DCS Instance Types................................................................................................................................................................. 51.3.1 Single-Node DCS Instances.............................................................................................................................................. 51.3.2 Master/Standby DCS Instances....................................................................................................................................... 71.3.3 Cluster DCS Instances......................................................................................................................................................... 81.4 DCS Disaster Recovery........................................................................................................................................................ 121.5 DCS Instance Specifications...............................................................................................................................................151.6 Comparing DCS and Open-Source Cache Services................................................................................................... 201.7 Selecting a Cache Engine................................................................................................................................................... 231.7.1 Comparing Redis and Memcached..............................................................................................................................241.7.2 Comparing DCS Redis Versions.....................................................................................................................................251.7.3 New Features of DCS for Redis 4.0............................................................................................................................. 271.7.4 New Features of DCS Redis 5.0.................................................................................................................................... 311.8 Command Compatibility.................................................................................................................................................... 371.8.1 Redis Command Compatibility..................................................................................................................................... 371.8.2 Web CLI Command Compatibility............................................................................................................................... 461.8.3 Memcached Command Compatibility........................................................................................................................491.9 Basic Concepts....................................................................................................................................................................... 531.10 Related Services.................................................................................................................................................................. 54

2 Getting Started...................................................................................................................... 572.1 Creating a DCS Instance..................................................................................................................................................... 572.1.1 Identifying Requirements................................................................................................................................................572.1.2 Preparing the Environment............................................................................................................................................ 582.1.3 Creating a DCS Redis Instance...................................................................................................................................... 592.1.4 Creating a DCS Memcached Instance........................................................................................................................ 612.2 Accessing a DCS Redis Instance....................................................................................................................................... 632.3 Accessing an Instance in Web CLI................................................................................................................................... 662.4 Accessing a DCS Memcached Instance......................................................................................................................... 662.5 Viewing Details of a DCS Instance..................................................................................................................................68

3 Operation Guide.................................................................................................................... 71

Distributed Cache ServiceUser Guide Contents

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

3.1 Operating DCS Instances....................................................................................................................................................713.1.1 Modifying DCS Instance Specifications...................................................................................................................... 713.1.2 Starting a DCS instance...................................................................................................................................................733.1.3 Restarting DCS Instances................................................................................................................................................ 733.1.4 Deleting DCS Instances................................................................................................................................................... 743.1.5 Performing a Master/Standby Switchover for a DCS Instance.......................................................................... 763.1.6 Clearing DCS Instance Data........................................................................................................................................... 763.1.7 Exporting DCS Instance List........................................................................................................................................... 773.2 Managing DCS Instances....................................................................................................................................................773.2.1 Configuration Notice........................................................................................................................................................ 773.2.2 Modifying Configuration Parameters......................................................................................................................... 783.2.3 Modifying an Instance's Maintenance Time Window...........................................................................................863.2.4 Modifying an Instance's Security Group....................................................................................................................863.2.5 Viewing Background Tasks............................................................................................................................................. 873.2.6 Viewing Data Storage Statistics of a Proxy Cluster Instance............................................................................. 883.3 Backing Up and Restoring DCS Instances.................................................................................................................... 883.3.1 Overview...............................................................................................................................................................................883.3.2 Configuring a Backup Policy.......................................................................................................................................... 903.3.3 Manually Backing Up a DCS Instance........................................................................................................................ 913.3.4 Restoring a DCS Instance................................................................................................................................................923.3.5 Downloading a Backup File........................................................................................................................................... 933.4 Migrating Data with DCS................................................................................................................................................... 943.4.1 Introduction to Migration with DCS........................................................................................................................... 943.4.2 Importing Backup Files.................................................................................................................................................... 963.4.3 Migrating Data Online.....................................................................................................................................................993.5 Managing Passwords.........................................................................................................................................................1013.5.1 DCS Instance Passwords............................................................................................................................................... 1013.5.2 Changing Instance Passwords.....................................................................................................................................101

4 Monitoring............................................................................................................................ 1034.1 DCS Metrics.......................................................................................................................................................................... 1034.2 Viewing DCS Monitoring Metrics.................................................................................................................................. 1294.3 Setting Alarm Rules for Critical Metrics..................................................................................................................... 130

5 Auditing.................................................................................................................................1335.1 Operations That Can Be Recorded by CTS.................................................................................................................1335.2 Viewing Traces on the CTS Console............................................................................................................................. 136

6 FAQs....................................................................................................................................... 1386.1 Client and Network Connection.................................................................................................................................... 1386.2 Redis Usage.......................................................................................................................................................................... 1456.3 Redis Commands................................................................................................................................................................ 1506.4 Instance Scaling and Upgrade....................................................................................................................................... 1526.5 Monitoring and Alarm...................................................................................................................................................... 154

Distributed Cache ServiceUser Guide Contents

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. iii

Page 5: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

6.6 Data Backup, Export, and Migration........................................................................................................................... 1556.7 Master/Standby Switchover............................................................................................................................................ 1566.8 Security Group Configurations.......................................................................................................................................1576.9 Memcached Usage.............................................................................................................................................................158

Distributed Cache ServiceUser Guide Contents

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. iv

Page 6: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

1 Introduction

1.1 What Is DCS?Distributed Cache Service (DCS) is an online, distributed, in-memory cache servicecompatible with Redis and Memcached. It is reliable, scalable, usable out of thebox, and easy to manage, meeting your requirements for high read/writeperformance and fast data access.

● Usability out of the boxDCS provides single-node, master/standby, and cluster instances withspecifications ranging from 128 MB to 1 TB. DCS instances can be createdwith just a few clicks on the console, without requiring you to prepare servers.DCS Redis 4.0 and 5.0 instances are containerized and can be created withinseconds.

● Security and reliabilityInstance data storage and access are securely protected through securitymanagement services, including Identity and Access Management (IAM),Virtual Private Cloud (VPC), Cloud Eye, and Cloud Trace Service (CTS).Master/Standby and cluster instances can be deployed within an availabilityzone (AZ) or across AZs.

● Auto scalingDCS instances can be scaled up or down online, helping you control costsbased on service requirements.

● Easy managementA web-based console is provided for you to perform various operations, suchas restarting instances, modifying configuration parameters, and backing upand restoring data. RESTful application programming interfaces (APIs) arealso provided for automatic instance management.

● Online migrationYou can create a data migration task on the console to import backup files ormigrate data online.

For details on how to select a cache engine, see Selecting a Cache Engine.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 1

Page 7: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

DCS for Redis

Redis is a storage system that supports multiple types of data structures, includingkey-value pairs. It can be used in such scenarios as data caching, eventpublication/subscription, and high-speed queuing, as described in ApplicationScenarios. Redis is written in ANSI C, supporting direct read/write of strings,hashes, lists, sets, streams, and sorted sets. Redis works with an in-memorydataset which can be persisted on disk.

DCS Redis instances can be customized based on your requirements.

Table 1-1 DCS Redis instance configuration

Instancetype

DCS for Redis provides the following three types of instances to suitdifferent service scenarios:Single-node: Suitable for caching temporary data in low reliabilityscenarios. Single-node instances support highly concurrent read/write operations, but do not support data persistence. Data will bedeleted after instances are restarted.Master/Standby: Each master/standby instance runs on two nodes(one master and one standby). The standby node replicates datasynchronously from the master node. If the master node fails, thestandby node automatically becomes the master node.Cluster: Each cluster DCS instance consists of multiple shards andeach shard includes a master node and zero or multiple replicas.Shards are not visible to users. If the master node fails, a standbynode in the same shard takes over.

Instancespecification

DCS for Redis provides instances of different specifications, rangingfrom 128 MB to 1 TB.

Redisversion

DCS instances are compatible with open-source Redis 3.0, 4.0, and5.0.

Underlyingarchitecture

Standard Redis based on VMs: supports up to 100,000 queries persecond (QPS) at a single node.

Highavailability (HA)and DR

Master/Standby and cluster DCS Redis instances can be deployedacross AZs in the same region with physically isolated powersupplies and networks.

For more information about open-source Redis, visit https://redis.io/.

DCS for Memcached

Memcached is an in-memory key-value caching system that supports read/writeof simple strings. It is often used to cache backend database data to alleviate load

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 2

Page 8: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

on these databases and accelerate web applications. For details about itsapplication scenarios, see Memcached Application Scenarios.

In addition to full compatibility with Memcached, DCS for Memcached providesthe hot standby and data persistence.

Table 1-2 DCS Memcached instance configuration

Instancetype

DCS for Memcached provides the following two types of instancesto suit different service scenarios:Single-node: Suitable for caching temporary data in low reliabilityscenarios. Single-node instances support highly concurrent read/write operations, but do not support data persistence. Data will bedeleted after instances are restarted.Master/Standby: Each master/standby instance runs on two nodes(one master and one standby). The standby node replicates datasynchronously from the master node, but does not support read/write operations. If the master node fails, the standby nodeautomatically becomes the master node.

Memory Specification of single-node or master/standby DCS Memcachedinstances: 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, and 64 GB.

HA andDR

Master/Standby DCS Memcached instances can be deployed acrossAZs in the same region with physically isolated power supplies andnetworks.

For more information about open-source Memcached, visit https://memcached.org/.

1.2 Application Scenarios

Redis Application ScenariosMany large-scale e-commerce websites and video streaming and gamingapplications require fast access to large amounts of data that has simple datastructures and does not need frequent join queries. In such scenarios, you can useRedis to achieve fast yet inexpensive access to data. Redis enables you to retrievedata from in-memory data stores instead of relying entirely on slower disk-baseddatabases. In addition, you no longer need to perform additional managementtasks. These features make Redis an important supplement to traditional disk-based databases and a basic service essential for Internet applications receivinghigh-concurrency access.

Typical application scenarios of DCS for Redis are as follows:

1. E-commerce flash salesE-commerce product catalogue, deals, and flash sales data can be cached toRedis.For example, the high-concurrency data access in flash sales can be hardlyhandled by traditional relational databases. It requires the hardware to have

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 3

Page 9: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

higher configuration such as disk I/O. By contrast, Redis supports 100,000 QPSper node and allows you to implement locking using simple commands suchas SET, GET, DEL, and RPUSH to handle flash sales.For details about locking, see "Implementing Distributed Locks" best practice.

2. Live video commentingIn live streaming, online user, gift ranking, and bullet comment data can bestored as sorted sets in Redis.For example, bullet comments can be returned using theZREVRANGEBYSCORE command. The ZPOPMAX and ZPOPMIN commandsin Redis 5.0 can further facilitate message processing.

3. Game leaderboardIn online gaming, the highest ranking players are displayed and updated inreal time. The leaderboard ranking can be stored as sorted sets, which areeasy to use with up to 20 commands.For details, see the "Ranking with Redis" best practice.

4. Social networking commentsIn web applications, queries of post comments often involve sorting by time indescending order. As comments pile up, sorting becomes less efficient.By using lists in Redis, a preset number of comments can be returned fromthe cache, rather than from disk, easing the load off the database andaccelerating application responses.

Memcached Application Scenarios

Memcached is suitable for storing simple key-value data.

1. Web pagesCaching static data such as HTML pages, Cascading Style Sheets (CSS), andimages to DCS Memcached instances improves access performance of webpages.

2. Frontend databaseIn dynamic systems such as social networking and blogging sites, writeoperations are far fewer than read operations such as querying users, friends,and articles. Such frequently access data can be cached in Memcached toreduce database load and improve performance.The following data can be cached:– Frequently accessed data that does not require real-time updates and can

expire automaticallyExample: latest article lists and rankings. Although data is generatedconstantly, its impact on user experience is limited. Such data can becached for a preset period of time and accessed from the database afterthis period. If web page editors want to view the latest ranking, a cacheclearing or refreshing policy can be configured.

– Frequently accessed data that requires real-time updatesExample: friend lists, article lists, and reading records. Such data can becached to Memcached first, and then updated whenever changes(adding, modifying, and deleting data) occur.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 4

Page 10: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

3. Flash salesIt is difficult for traditional databases to write an order placement operationduring flash sales into the database, modify the inventory data, and ensuretransaction consistency while ensuring uninterrupted user experience.Memcached incr and decr commands can be used to store inventoryinformation and complete order placement in memory. Once an order issubmitted, an order number is generated. Then, the order can be paid.

Scenarios where Memcached is not suitable:

● The size of a single cache object is larger than 1 MB.

Memcached cannot cache an object larger than 1 MB. In such cases, use Redis.

● The key contains more than 250 characters.

To use Memcached in such a scenario, you can generate an MD5 hash for the key andcache the hash instead.

● High data reliability is required.

Open-source Memcached does not provide data replication, backup, and migration, sodata persistence is not supported.

Master/Standby DCS Memcached instances support data persistence. For moreinformation, contact customer service.

● Complex data structures and processing are required.

Memcached supports only simple key-value pairs, and does not support complex datastructures such as lists and sets, or complex operations such as sorting.

1.3 DCS Instance Types

1.3.1 Single-Node DCS InstancesDCS provides single-node Redis or Memcached instances.

Features1. Low system overhead and high QPS

Single-node instances do not support data synchronization or datapersistence, reducing system overhead and supporting higher concurrency.QPS of single-node DCS Redis or Memcached instances reaches up to100,000.

2. Process monitoring and automatic fault recoveryWith an HA monitoring mechanism, if a single-node DCS instance becomesfaulty, a new process is started within 30 seconds to resume serviceprovisioning.

3. Out-of-the-box usability and no data persistenceSingle-node DCS instances can be used out of the box because they do notinvolve data loading. If your service requires high QPS, you can warm up thedata beforehand to avoid strong concurrency impact on the backenddatabase.

4. Low-cost and suitable for development and testing

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 5

Page 11: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Single-node instances are 40% cheaper than master/standby DCS instances,suitable for setting up development or testing environments.

In summary, single-node DCS instances support highly concurrent read/writeoperations, but do not support data persistence. Data will be deleted afterinstances are restarted. They are suitable for scenarios which do not require datapersistence, such as database front-end caching, to accelerate access and ease theconcurrency load off the backend. If the desired data does not exist in the cache,requests will go to the database. When restarting the service or the DCS instance,you can pre-generate cache data from the disk database to relieve pressure on thebackend during startup.

ArchitectureFigure 1-1 shows the architecture of single-node DCS Redis and Memcachedinstances.

Figure 1-1 Single-node DCS instance architecture

Architecture description:

● VPCThe VPC where all nodes of the instance are run.

For intra-VPC access, the client and the instance must be in the same VPC withspecified security group rule configurations.

For details, see Security Group Configurations.

● Application

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 6

Page 12: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

The client of the instance, which is the application running on an Elastic CloudServer (ECS).DCS Redis and Memcached instances are respectively compatible with Redisand Memcached protocols, and can be accessed through open-source clients.For examples of accessing DCS instances, see Accessing a DCS RedisInstance and Accessing a DCS Memcached Instance.

● DCS instanceA single-node DCS instance, which has only one node and one Redis process.DCS monitors the availability of the instance in real time. If the Redis processbecomes faulty, DCS starts a new process to resume service provisioning.DCS Memcached instances are accessed through port 11211. DCS Redisinstances are accessed through port 6379.

1.3.2 Master/Standby DCS InstancesDCS provides master/standby Redis and Memcached instances.

Features

Master/Standby DCS instances have higher availability and reliability than single-node DCS instances.

Master/Standby DCS instances have the following features:

1. Data persistence and high reliabilityBy default, data persistence is enabled by both the master and the standbynode of a master/standby DCS instance. Master/Standby DCS Memcachedinstances also support data persistence to ensure high data reliability.The standby node of a Redis or Memcached instance is invisible to you. Onlythe master node provides data read/write operations.

2. Data synchronizationData in the master and standby nodes is kept consistent through incrementalsynchronization.

After recovering from a network exception or node fault, master/standby instancesperform a full synchronization to ensure data consistency.

3. Automatic master/standby switchoverIf the master node becomes faulty, the standby node takes over within 30seconds, without requiring any service interruptions or manual operations.

4. DR policiesEach master/standby DCS instance can be deployed across AZs with physicallyisolated power supplies and networks. Applications can also be deployedacross AZs to achieve HA for both data and applications.

Architecture

Figure 1-2 shows the architecture of master/standby DCS Redis 3.0 andMemcached instances.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 7

Page 13: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Figure 1-2 Master/Standby DCS instance architecture

Architecture description:

● VPCThe VPC where all nodes of the instance are run.

For intra-VPC access, the client and the instance must be in the same VPC withspecified security group rule configurations.For details, see Security Group Configurations.

● ApplicationThe Redis or Memcached client of the instance, which is the applicationrunning on the ECS.DCS Redis and Memcached instances are respectively compatible with Redisand Memcached protocols, and can be accessed through open-source clients.For examples of accessing DCS instances, see Accessing a DCS RedisInstance and Accessing a DCS Memcached Instance.

● DCS instanceIndicates a master/standby DCS instance which has a master node and astandby node. By default, data persistence is enabled and data is synchronizedbetween the two nodes.DCS monitors the availability of the instance in real time. If the master nodebecomes faulty, the standby node becomes the master node and resumesservice provisioning.DCS Memcached instances are accessed through port 11211. DCS Redisinstances are accessed by default through port 6379.

1.3.3 Cluster DCS InstancesDCS for Redis provides two types of cluster instances: Proxy Cluster and RedisCluster. Proxy Cluster is compatible with Redis 3.0 and uses Linux Virtual Server(LVS) and proxies to achieve high availability. Redis Cluster is the nativedistributed implementation of Redis and is compatible with Redis 4.0 and 5.0.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 8

Page 14: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Proxy Cluster Redis 3.0 Instances

The specifications of Proxy Cluster DCS Redis 3.0 instances range from 64 GB to1,024 GB, meeting requirements for millions of concurrent connections andmassive data cache. Distributed data storage and access is implemented by DCS,without requiring development or maintenance.

Each Proxy Cluster instance consists of load balancers, proxies, cluster managers,and shards.

Table 1-3 Specifications of Proxy Cluster DCS Redis 3.0 instances

Total Memory Proxies Shards

64 GB 3 8

128 GB 6 16

256 GB 8 32

512 GB 16 64

1,024 GB 32 128

Figure 1-3 Proxy Cluster DCS Redis instance architecture

Architecture description:

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 9

Page 15: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● VPCThe VPC where all nodes of the instance are run.

For intra-VPC access, the client and the instance must be in the same VPC withspecified security group rule configurations.For details, see Security Group Configurations.

● ApplicationThe client used to access the instance.DCS Redis instances can be accessed through open-source clients. Forexamples of accessing DCS instances, see Accessing a DCS Redis Instance.

● LB-M/LB-SThe load balancers, which are deployed in master/standby HA mode. Theconnection addresses (IP address:Port) of the cluster DCS Redis instance arethe addresses of the load balancers. Shards and cluster managers cannot beaccessed in this way.

● ProxyThe proxy server used to achieve high availability and process high-concurrency client requests.

● Redis shardA shard of the cluster.Each shard consists of a pair of master/standby nodes. If the master nodebecomes faulty, the standby node automatically takes over cluster services.If both the master and standby nodes of a shard are faulty, the cluster canstill provide services but the data on the faulty shard is inaccessible.

● Cluster managerThe cluster configuration managers, which store configurations andpartitioning policies of the cluster.

Redis Cluster Redis 4.0 and 5.0 InstancesThe native Redis Cluster uses smart clients and a distributed architecture toperform sharding.

Table 1-4 lists the shard specification for different instance specifications.

Specification per shard=Instance specification/Number of shards

For example, if a 48 GB instance has 6 shards, the specification of each shard is 48GB/6 = 8 GB.

Table 1-4 Specifications of Redis Cluster DCS instances

Total Memory Shards

24 GB/32 GB 3

48 GB 6

64 GB 8

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 10

Page 16: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Total Memory Shards

96 GB 12

128 GB 16

192 GB 24

256 GB 32

384 GB 48

512 GB 64

768 GB 96

1,024 GB 128

● Distributed architectureAny node in a Redis Cluster can receive requests. Received requests are thenredirected to the right node for processing. Each node consists of a subset ofone master and one (by default) or multiple replicas. The master or replicaroles are determined through an election algorithm. You can add replicas foreach group of node and configure the master/replica roles for them.

Figure 1-4 Distributed architecture of Redis Cluster

● PreshardingThere are 16,384 hash slots in each Redis Cluster. The mapping between hashslots and Redis nodes is stored in Redis Servers. To compute what is the hashslot of a given key, simply take the CRC16 of the key modulo 16384.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 11

Page 17: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Figure 1-5 Redis Cluster presharding

Comparing Proxy Cluster and Redis Cluster

Table 1-5 Differences between Proxy Cluster and Redis Cluster

Item Proxy Cluster Redis Cluster

Redis versioncompatibility

Redis 3.0 Redis 4.0 and 5.0Specify a Redis versionwhen creating aninstance.

Client and protocol Any Redis client Clients that support theRedis Cluster protocol

Command compatibility Some Redis commandsare disabled. For details,see Table 1-25.

Some Redis commandsare disabled. For details,see Table 1-27.

Replication Each shard has tworeplicas, with one replicabeing the master. Youcannot add additionalreplicas to the shard.

Each shard has tworeplicas by default. Youcan configure a clusterwith only one replica.

1.4 DCS Disaster RecoveryWhether you use DCS as the frontend cache or backend data store, DCS is alwaysready to ensure data reliability and service availability. The following figure showsthe evolution of DCS DR architectures.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 12

Page 18: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Figure 1-6 DCS DR architecture evolution

To meet the reliability requirements of your data and services, you can choose todeploy your DCS instance within a single AZ or across AZs.

Single-AZ HASingle-AZ deployment means deploying an instance within a physical equipmentroom. DCS provides process/service HA, data persistence, and hot standby DRpolicies for different types of DCS instances.

Single-node DCS instance: When DCS detects a process fault, a new process isstarted to ensure service HA.

Figure 1-7 HA for a single-node DCS instance deployed within an AZ

Master/Standby DCS instance: Data is persisted to disk in the master node andincrementally synchronized and persisted to the standby node, achieving hotstandby and data persistence.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 13

Page 19: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Figure 1-8 HA for a master/standby DCS instance deployed within an AZ

Cluster DCS instance: Similar to a master/standby instance, data in each shard(instance process) of a cluster instance is synchronized between master andstandby nodes and persisted in both nodes.

Figure 1-9 HA for a cluster DCS instance deployed within an AZ

Cross-AZ DR

The master and standby nodes of a master/standby or cluster DCS instance can bedeployed across AZs (in different equipment rooms). Power supplies and networksof different AZs are physically isolated. When a fault occurs in the AZ where themaster node is deployed, the standby node connects to the client and takes overdata read and write operations.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 14

Page 20: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Figure 1-10 Cross-AZ deployment of a master/standby DCS instance

This mechanism applies in a similar way to a cluster DCS instance, in which each shard(process) is deployed across AZs.

When creating a master/standby DCS instance, select a standby AZ that isdifferent from the master AZ as shown below.

Figure 1-11 Selecting different AZs

You can also deploy your application across AZs to ensure both data reliability and serviceavailability in the event of power supply or network disruptions.

1.5 DCS Instance SpecificationsThis section describes DCS instance specifications, including total memory,available memory, maximum number of connections allowed, maximum/assuredbandwidth, and reference performance.

The maximum number of connections allowed is the maximum number ofconcurrent client connections.

Reference performance is measured by the number of queries per second (QPS).

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 15

Page 21: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● DCS Redis 3.0 instances are available in single-node, master/standby, and Proxy Clustertypes.

● DCS Redis 4.0 and 5.0 instances are available in single-node, master/standby, and RedisCluster types.

● DCS Memcached instances are available in single-node and master/standby types.

DCS Redis 3.0 Instance SpecificationsFor each single-node DCS Redis instance, the available memory is less than thetotal memory because some memory is reserved for system overhead, as shown inTable 1-6.

Table 1-6 Specifications of single-node DCS Redis 3.0 instances

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

2 1.5 10,000 42/512 50,000

4 3.2 10,000 64/1536 100,000

8 6.8 10,000 64/1536 100,000

16 13.6 10,000 85/3072 100,000

32 27.2 10,000 85/3072 100,000

64 58.2 12,000 128/5120 100,000

For each master/standby DCS Redis instance, the available memory is less thanthat of a single-node DCS Redis instance because some memory is reserved fordata persistence, as shown in Table 1-7. The available memory of a master/standby instance can be adjusted to support background tasks such as datapersistence and master/standby synchronization.

Table 1-7 Specifications of master/standby DCS Redis 3.0 instances

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

2 1.5 10,000 42/512 50,000

4 3.2 10,000 64/1536 100,000

8 6.4 10,000 64/1536 100,000

16 12.8 10,000 85/3072 100,000

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 16

Page 22: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

32 25.6 10,000 85/3072 100,000

64 51.2 12,000 128/5120 100,000

In addition to larger memory, cluster instances feature more connections allowed,higher bandwidth allowed, and more QPS than single-node and master/standbyinstances.

Table 1-8 Specifications of Proxy Cluster DCS Redis 3.0 instances

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

64 64 90,000 600/5120 500,000

128 128 180,000 600/5120 500,000

256 256 240,000 600/5120 500,000

512 512 480,000 600/5120 500,000

1,024 1,024 960,000 600/5120 500,000

DCS Redis 4.0 and 5.0 Instance Specifications

Table 1-9 Specifications of single-node DCS Redis 4.0 or 5.0 instances

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

0.125 0.125 10,000 40/40 -

0.25 0.25 10,000 80/80 -

0.5 0.5 10,000 80/80 -

1 1 10,000 80/80 -

2 2 10,000 128/128 -

4 4 10,000 192/192 -

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 17

Page 23: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

8 8 10,000 192/192 100,000

16 16 10,000 256/256 100,000

24 24 10,000 256/256 100,000

32 32 10,000 256/256 100,000

48 48 10,000 256/256 100,000

64 64 10,000 384/384 100,000

Table 1-10 Specifications of master/standby DCS Redis 4.0 or 5.0 instances

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

0.125 0.125 10,000 40/40 -

0.25 0.25 10,000 80/80 -

0.5 0.5 10,000 80/80 -

1 1 10,000 80/80 -

2 2 10,000 128/128 -

4 4 10,000 192/192 -

8 8 10,000 192/192 100,000

16 16 10,000 256/256 100,000

24 24 10,000 256/256 100,000

32 32 10,000 256/256 100,000

48 48 10,000 256/256 100,000

64 64 10,000 384/384 100,000

In addition to larger memory, cluster instances feature more connections allowed,higher bandwidth allowed, and more QPS than single-node and master/standbyinstances.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 18

Page 24: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 1-11 Specifications of Redis Cluster DCS Redis 4.0 or 5.0 instances

TotalMemory(GB)

AvailableMemory(GB)

Masters(Count)

MaximumConnections Allowed(Count)

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

24 24 3 30,000 2304/2304 300,000

32 32 3 30,000 2304/2304 300,000

48 48 6 60,000 4608/4608 >300,000

64 64 8 80,000 6144/6144 500,000

96 96 12 120,000 9216/9216 >500,000

128 128 16 160,000 12288/12288 1,000,000

192 192 24 240,000 18432/18432 >1,000,000

256 256 32 320,000 24576/24576 >2,000,000

384 384 48 480000 36864/36864 >2,000,000

512 512 64 640000 49152/49152 >2,000,000

768 768 96 960000 73728/73728 >2,000,000

1,024 1,024 128 1280000 98304/98304 >2,000,000

DCS Memcached InstancesFor each single-node DCS Memcached instance, the available memory is less thanthe total memory because some memory is reserved for system overhead, asshown in Table 1-12.

For each master/standby DCS Memcached instance, the available memory is lessthan the total memory because some memory is reserved for data persistence, asshown in Table 1-13. The available memory of a master/standby instance can beadjusted to support background tasks such as data persistence and master/standby synchronization.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 19

Page 25: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 1-12 Specifications of single-node DCS Memcached instances

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

2 1.5 10,000 42/128 50,000

4 3.2 20000 64/192 100,000

8 6.8 20000 64/192 100,000

16 13.6 25000 85/256 100,000

32 27.2 25000 85/256 100,000

64 58.2 25000 128/384 100,000

Table 1-13 Specifications of master/standby DCS Memcached instances

TotalMemory(GB)

AvailableMemory(GB)

MaximumConnectionsAllowed

Assured/MaximumBandwidth(Mbit/s)

ReferencePerformance(QPS)

2 1.5 10,000 42/128 50,000

4 3.2 20000 64/192 100,000

8 6.8 20000 64/192 100,000

16 13.6 25000 85/256 100,000

32 27.2 25000 85/256 100,000

64 58.2 25000 128/384 100,000

1.6 Comparing DCS and Open-Source Cache ServicesDCS supports single-node, master/standby, and cluster instances, ensuring highread/write performance and fast data access. It also supports various instancemanagement operations to facilitate your O&M. With DCS, you only need to focuson the service logic, without concerning about the deployment, monitoring,scaling, security, and fault recovery issues.

DCS is compatible with open-source Redis and Memcached, and can becustomized based on your requirements. This renders DCS unique features inaddition to the advantages of open-source cache databases.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 20

Page 26: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

DCS for Redis vs. Open-Source Redis

Table 1-14 Differences between DCS for Redis and open-source Redis

Feature Open-SourceRedis

DCS for Redis

Servicedeployment

Requires 0.5 to 2days to prepareservers.

● Creates a Redis 3.0 instance in 5 to 15minutes.

● Creates a containerized Redis 4.0 or 5.0instance within 8 seconds.

Version - Closely follows open-source trends andsupports the latest Redis version. Currently,Redis 3.0, 4.0, and 5.0 are supported.

Security Network andserver safety isthe user'sresponsibility.

● Network security is ensured using VPCs andsecurity groups.

● Data reliability is ensured by datareplication and scheduled backup.

Performance

- 100,000 QPS per node

Monitoring

Provides onlybasic statistics.

Provides more than 30 monitoring metrics andcustomizable alarm threshold and policies.● Various metrics

– External metrics include the number ofcommands, concurrent operations,connections, clients, and deniedconnections.

– Resource usage metrics include CPUusage, physical memory usage, networkinput throughput, and network outputthroughput.

– Internal metrics include instance capacityusage, as well as the number of keys,expired keys, PubSub channels, PubSubpatterns, keyspace hits, and keyspacemisses.

● Custom alarm thresholds and policies fordifferent metrics to help identify servicefaults.

Backupandrestoration

Supported ● Supports scheduled and manual backup.Backup files can be downloaded.

● Backup data can be restored on the console.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 21

Page 27: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Feature Open-SourceRedis

DCS for Redis

Parametermanagement

No visualizedparametermanagement

● Visualized parameter management issupported on the console.

● Configuration parameters can be modifiedonline.

● Data can be accessed and modified on theconsole.

Scale-up Interrupts servicesand involves acomplexprocedure frommodifying theserver RAM tomodifying Redismemory andrestarting the OSand services.

● Supports online scale-up and scale-downwithout interrupting services.

● Specifications can be scaled up or downwithin the available range based on servicerequirements.

DCS for Memcached vs. Open-Source Memcached

Table 1-15 Differences between DCS for Memcached and open-sourceMemcached

Feature Open-SourceMemcached

DCS for Memcached

Servicedeployment

Requires 0.5 to 2days to prepareservers.

Creates an instance in 5 to 15 minutes.

Security Network andserver safety is theuser'sresponsibility.

● Network security is ensured using VPCs andsecurity groups.

● Data reliability is ensured by datareplication and scheduled backup.

Performance

- 100,000 QPS per node

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 22

Page 28: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Feature Open-SourceMemcached

DCS for Memcached

Monitoring

Provides only basicstatistics.

Provides more than 30 monitoring metrics andcustomizable alarm threshold and policies.● Various metrics

– External metrics include the number ofcommands, concurrent operations,connections, clients, and deniedconnections.

– Resource usage metrics include CPUusage, physical memory usage, networkinput throughput, and network outputthroughput.

– Internal metrics include instancecapacity usage, as well as the number ofkeys, expired keys, PubSub channels,PubSub patterns, keyspace hits, andkeyspace misses.

● Custom alarm thresholds and policies fordifferent metrics to help identify servicefaults.

Backupandrestoration

Not supported ● Supports scheduled and manual backup.● Backup data can be restored on the

console.

Visualizedmaintenance

No visualizedparametermanagement

● Visualized parameter management issupported on the console.

● Configuration parameters can be modifiedonline.

Scale-up Interrupts servicesand involves acomplex procedurefrom modifyingthe server RAM tomodifying Redismemory andrestarting the OSand services.

● Supports online scale-up withoutinterrupting services.

● Specifications can be scaled up or downwithin the available range based on servicerequirements.

Datapersistence

Not supported Supported for master/standby instances

1.7 Selecting a Cache Engine

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 23

Page 29: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

1.7.1 Comparing Redis and MemcachedRedis and Memcached are both popular open-source in-memory databases whichare easy to use and provide higher performance than relational databases.

How can I select between the two key-value databases?

Memcached is suitable for storing simple data structures that do not require datapersistence, whereas Redis is suitable for storing more complex, larger data thatrequires persistency.

For details, see the following table.

Table 1-16 Differences between Redis and Memcached

Item Redis Memcached

Latency In-memory database with sub-millisecond latency

In-memory database with submillisecond latency

Ease of use Simple syntax and easy to use Simple syntax and easy to use

Distributedstorage

Horizontal expansion in clustermode

Supported

Multi-languageclient

Supports client connections inmore than 30 languagesincluding Java, C, and Python.

Supports client connections inmore than 10 languagesincluding Java, C, and Python.

Thread/Process

Single-core and single-threadSingle-thread communication,avoiding unnecessary contextswitching and contentionNon-blocking I/O (I/Omultiplexing) is used to reduceresource consumption whenmultiple clients are connected.

Multi-thread and scalableThe Memcached performancecan be improved by increasingthe number of CPUs.There is an obvious performanceadvantage in the scenario wherethe value of key is great.

Persistentstorage

SupportedEach write operation (adding,deleting, or modifying data)can be recorded on disk (AOFfile).

Not supported

Datastructure

Supports complex datastructures such as hash, list,set, and sorted set, catering tovarious scenarios.

Supports simple strings.

Lua scriptsupport

Supported Not supported

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 24

Page 30: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Item Redis Memcached

Snapshotbackup

SupportedSnapshots are generatedperiodically. Therefore, there isno guarantee that data will notbe lost.Redis forks a subprocess togenerate snapshots. Whenthere is a large amount ofdata, the Redis service may beinterrupted for a short time.

Not supported

Datamigration

SupportedData can be backed up andmigrated to a new Redisinstance through RDB snapshotrestoration, AOF file playback,or by using the console tomigrate data online.

Not supported because databackup and persistence are notsupported.The data processing efficiency ofthe Memcached is higherbecause persistence is notrequired.

Key valuerestriction

The value of a key can be up to1 GB.

1 MB

Multipledatabases

Supports up to 256 Redisdatabases.

Not supported

Based on the preceding comparison, both the Redis and Memcached are easy touse and have high performance. However, Redis and Memcached are different indata structure storage, persistence, backup, migration, and script support. You areadvised to select the most appropriate cache engine based on actual applicationscenarios.

Memcached is suitable for caching scenarios of small amount of static data, where data isonly read without further computing and processing, for example, HTML code snippets.Redis has richer data structures and wider application scenarios.

1.7.2 Comparing DCS Redis VersionsWhen creating a DCS Redis instance, you can select the cache engine version andthe instance type.

● VersionSelect 3.0, 4.0, or 5.0.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 25

Page 31: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 1-17 Differences between Redis versions

Feature Redis3.0 Redis4.0 & Redis5.0

Instancedeployment mode

Based on VMs Containerized based onphysical servers

Timerequiredforcreatinganinstance

3–15 minutes, or 10–30minutes for cluster instances.

8 seconds

QPS 100,000 QPS per node 100,000 QPS per node

Visualizeddatamanagement

Not supported Provides Web CLI for Redisaccess and data management.

Instancetype

Single-node, master/standby,and Proxy Cluster

Single-node, master/standby,and Redis Cluster

Instancetotalmemory

Ranges from 2 GB to 1 TB. Regular specifications rangefrom 2 GB to 1 TB. Smallspecifications of 128 MB, 256MB, 512 MB, and 1 GB arealso available for single-nodeand master/standby instances.

Scale-upor scale-down

Online scale-up and scale-down

Online scale-up and scale-down

Backupandrestoration

Supported for master/standbyand cluster instances

Supported for master/standbyand cluster instances

The underlying architectures vary by Redis version. Once a Redis version is chosen, itcannot be changed. For example, you cannot upgrade a DCS Redis 3.0 instance toRedis 4.0 or 5.0. If you require a higher Redis version, create a new instance that meetsyour requirements and then migrate data from the old instance to the new one.

● Instance typeSelect from single-node, master/standby, and cluster types. For details abouttheir architectures and application scenarios, see DCS Instance Types.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 26

Page 32: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

1.7.3 New Features of DCS for Redis 4.0Compared with Redis 3.0, DCS Redis 4.0 and later versions provides the followingimprovements in addition to the features of open-source Redis:

Shorter creation time

The instance deployment is changed from the VM mode to physical server–basedcontainerization mode. An instance can be created within 8 to 10 seconds.

Redis 4.0 provides the following new features:

1. New commands, such as MEMORY and SWAPDB2. Lazyfree, delaying the deletion of large keys and reducing the impact of the

deletion on system resources3. Memory performance optimization, that is, active defragmentation.

MEMORY CommandIn Redis 3.0 and earlier versions, you can execute the INFO MEMORY command tolearn only the limited memory statistics. Redis 4.0 introduces the MEMORYcommand to help you better understand Redis memory usage.

127.0.0.1:6379[8]> memory help1) MEMORY <subcommand> arg arg ... arg. Subcommands are:2) DOCTOR - Return memory problems reports.3) MALLOC-STATS -- Return internal statistics report from the memory allocator.4) PURGE -- Attempt to purge dirty pages for reclamation by the allocator.5) STATS -- Return information about the memory usage of the server.6) USAGE <key> [SAMPLES <count>] -- Return memory in bytes used by <key> and its value. Nested values are sampled up to <count> times (default: 5).127.0.0.1:6379[8]>

usage

Enter memory usage [key]. If the key exists, the estimated memory used by thevalue of the key is returned. If the key does not exist, nil is returned.

127.0.0.1:6379[8]> set dcs "DCS is an online, distributed, in-memory cache service compatible with Redis, and Memcached."OK127.0.0.1:6379[8]> memory usage dcs(integer) 141127.0.0.1:6379[8]>

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 27

Page 33: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

1. usage collects statistics on the memory usage of the value and the key, excluding theExpire memory usage of the key.// The following is verified based on the Redis 5.0.2. Results may differ in other Redis versions.192.168.0.66:6379> set a "Hello, world!"OK192.168.0.66:6379> memory usage a(integer) 58192.168.0.66:6379> set abc "Hello, world!"OK192.168.0.66:6379> memory usage abc(integer) 60 //After the key name length changes, the memory usage also changes. This indicates that the usage statistics contain the usage of the key.192.168.0.66:6379> expire abc 1000000(integer) 1192.168.0.66:6379> memory usage abc(integer) 60 // After the expiration time is added, the memory usage remains unchanged. This indicates that the usage statistics do not contain the expire memory usage.192.168.0.66:6379>

2. For hashes, lists, sets, and sorted sets, the MEMORY USAGE command samples statisticsand provides the estimated memory usage.

Usage: memory usage keyset samples 1000In which keyset indicates the key of a set, and 1000 indicates the number of samples.

MEMORY STATS

Returns the detailed memory usage of the current instance.

Usage: memory stats

127.0.0.1:6379[8]> memory stats 1) "peak.allocated" 2) (integer) 2412408 3) "total.allocated" 4) (integer) 2084720 5) "startup.allocated" 6) (integer) 824928 7) "replication.backlog" ... ...

The following table describes the meanings of some return items.

Table 1-18 MEMORY STATS return values

Return Value Description

peak.allocated Peak memory allocated by the allocator during Redisinstance running It is the same as used_memory_peakof info memory.

total.allocated The number of bytes allocated by the allocator. It is thesame as used_memory of info memory

startup.allocated Initial amount of memory consumed by Redis at startupin bytes

replication.backlog Size in bytes of the replication backlog. It is specified inthe repl-backlog-size parameter. The default value is 1MB.

clients.slaves The total size in bytes of all replicas overheads

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 28

Page 34: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Return Value Description

clients.normal The total size in bytes of all clients overheads

overhead.total The sum of all overheads. overhead.total is the totalmemory total.allocated allocated by the allocator minusthe actual memory used for storing data.

keys.count The total number of keys stored across all databases inthe server

keys.bytes-per-key Average number of bytes occupied by each key. Notethat the overhead is also allocated to each key.Therefore, this value does not indicate the average keylength.

dataset.bytes Memory bytes occupied by Redis data, that is,overhead.total subtracted from total.allocated

dataset.percentage The percentage of dataset.bytes out of the net memoryusage

peak.percentage The percentage of peak.allocated out of total.allocated

fragmentation Memory fragmentation rate

MEMORY DOCTOR

Usage: memory doctor

If the value of used_memory (total.allocated) is less than 5 MB, MEMORYDOCTOR considers that the memory usage is too small and does not performfurther diagnosis. If any of the following conditions is met, Redis providesdiagnosis results and suggestions:

1. The peak allocated memory is greater than 1.5 times of the currenttotal_allocated, that is, peak.allocated/total.allocated > 1.5, indicating thatthe memory fragmentation rate is high, and that the RSS is much larger thanused_memory.

2. The value of high fragmentation/fragmentation is greater than 1.4, indicatingthat the memory fragmentation rate is high.

3. The average memory usage of each normal client is greater than 200 KB,indicating that the pipeline may be improperly used or the Pub/Sub clientdoes not process messages in time.

4. The average memory usage of each slave client is greater than 10 MB,indicating that the write traffic of the master is too high.

MEMORY PURGE

Usage: memory purge

Executes the jemalloc internal command to release the memory. The releasedobjects include the memory that is occupied but not used by Redis processes, thatis, memory fragments.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 29

Page 35: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

MEMORY PURGE applies only to the Redis instance that uses jemalloc as the allocator.

LazyfreeProblem

Redis is a single-thread program. When a time-consuming request is executed, allrequests are queued. Before the request is completed, Redis cannot respond toother requests. As a result, performance problems may occur. One of the time-consuming requests is deleting a large key.

Principle

The Lazyfree feature of Redis 4.0 avoids the blockage caused by deleting largekeys, ensuring performance and availability.

When deleting a key, Redis asynchronously releases the memory occupied by thekey. The key release operation is processed in the sub-thread of the backgroundI/O (BIO).

Usage

1. Active deletion– UNLINK

Similar to DEL, this command removes keys. If there are more than 64elements to be deleted, the memory release operation is executed in anindependent BIO thread. Therefore, the UNLINK command can delete alarge key containing millions of elements in a short time.

– FLUSHALL/FLUSHDBAn ASYNC option was added to FLUSHALL and FLUSHDB in order to letthe entire dataset or a single database to be freed asynchronously.

2. Deletion of Expired Keys and Eviction of Large KeysThere are four scenarios for passive deletion. Each scenario corresponds to aparameter, which is disabled by default.lazyfree-lazy-eviction no // Whether to enable Lazyfree when the Redis memory usage reaches maxmemory and the eviction policy is set.lazyfree-lazy-expire no // Whether to enable Lazyfree when the key with TTL is going to expire.lazyfree-lazy-server-del no // An implicit DEL key is used when an existing key is processed.slave-lazy-flush no // Perform full data synchronization for the standby node. Before loading the RDB file of the master, the standby node executes the FLUSHAL command to clear its own data.

To enable these configurations, contact customer service.

Other New Commands1. SWAPDB

Swaps two Redis databases.swapdb dbindex1 dbindex2

2. ZLEXCOUNTReturns the number of elements in the sorted set.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 30

Page 36: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

zlexcount key min max

Memory Usage and Performance Enhancement1. Stores the same amount of data using less memory.2. Defragment and gradually evict the used memory.

1.7.4 New Features of DCS Redis 5.0DCS Redis 5.0 is compatible with the new features of the open-source Redis 5.0, inaddition to all the improvements and new commands in Redis 4.0.

Stream Data StructureStream is a new data type introduced with Redis 5.0. It supports messagepersistence and multicast.

Figure 1-12 shows the structure of a Redis stream, which allows messages to beappended to the stream.

Streams have the following features:

1. A stream can have multiple consumer groups.2. Each consumer group contains a Last_delivered_id that points to the last

consumed item (message) in the consumer group.3. Each consumer group contains multiple consumers. All consumers share the

last_delivered_id of the consumer group. A message can be consumed byonly one consumer.

4. pending_ids in the consumer can be used to record the IDs of items that havebeen sent to the client, but have not been acknowledged.

5. For detailed comparison between stream and other Redis data structures, seeTable 1-19.

Figure 1-12 Stream data structure

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 31

Page 37: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 1-19 Differences between streams and existing Redis data structures

Feature Stream List, Pub/Sub, Zset

Complexityof seekingitems

O(log(N)) List: O(N)

Offset Supported. Each item hasa unique ID. The ID is notchanged as other itemsare added or evicted.

List: Not supported. If an item isevicted, the latest item cannot belocated.

Datapersistence

Supported. Streams arepersisted into AOF andRDB files.

Pub/Sub: Not supported.

Consumergroup

Supported. Pub/Sub: Not supported.

Acknowledgement

Supported. Pub/Sub: Not supported.

Performance Not related to thenumber of consumers.

Pub/Sub: Positively related to thenumber of clients.

Eviction Streams are memoryefficient by blocking toevict the data that is tooold and using a radix treeand listpack.

Zset consumes more memorybecause it does not support insertingsame items, blocking, or evictingdata

Randomlydeletingitems

Not supported. Zset: Supported.

Stream commands

Stream commands are described below in the order they are used. For details, seeTable 1-20.

1. Run the XADD command to add a stream item, that is, create a stream. Themaximum number of messages that can be saved can be specified whenadding the item.

2. Create a consumer group by running the XGROUP command.3. A consumer uses the XREADGROUP command to consume messages.4. After the consumption, the client runs the XACK command to confirm that

the consumption is successful.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 32

Page 38: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Figure 1-13 Stream commands

Table 1-20 Stream commands description

Command Description Syntax

XACK Deletes one or multiple messagesfrom the pending entry list (PEL) aconsumer group of the stream.

XACK key group ID [ID ...]

XADD Adds a specified entry to thestream at a specified key. If thekey does not exist, running thiscommand will result in a key to beautomatically created based onthe entry.

XADD key ID field string[field string ...]

XCLAIM Changes the ownership of apending message, so that the newowner is the consumer specified asthe command argument.

XCLAIM key groupconsumer min-idle-time ID[ID ...] [IDLE ms] [TIMEms-unix-time][RETRYCOUNT count][FORCE] [JUSTID]

XDEL Removes the specified entries froma stream, and returns the numberof entries deleted, that may bedifferent from the number of IDspassed to the command in casecertain IDs do not exist.

XDEL key ID [ID ...]

XGROUP Manages the consumer groupsassociated with a stream You canuse XGROUP to:● Create a new consumer group

associated with a stream.● Destroy a consumer group.● Remove a specified consumer

from a consumer group.● Set the consumer group last

delivery ID to something else.

XGROUP [CREATE keygroupname id-or-$] [SETIDkey id-or-$] [DESTROY keygroupname][DELCONSUMER keygroupnameconsumername]

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 33

Page 39: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Description Syntax

XINFO Retrieves different informationabout the streams and associatedconsumer groups.

XINFO [CONSUMERS keygroupname] key key[HELP]

XLEN Returns the number of entries in astream. If the specified key doesnot exist, 0 is returned, indicatingan empty stream.

XLEN key

XPENDING Obtains data from a streamthrough a consumer group. Thiscommand is the interface toinspect the list of pendingmessages in order to observe andunderstand what clients are active,what messages are pending to beconsumed, or to see if there areidle messages.

XPENDING key group[start end count][consumer]

XRANGE Returns entries matching a givenrange of IDs.

XRANGE key start end[COUNT count]

XREAD Reads data from one or multiplestreams, only returning entrieswith an ID greater than the lastreceived ID reported by the caller.

XREAD [COUNT count][BLOCK milliseconds]STREAMS key [key ...] ID[ID ...]

XREADGROUP

A special version of the XREADcommand, which is used to specifya consumer group to read from.

XREADGROUP GROUPgroup consumer [COUNTcount] [BLOCKmilliseconds] STREAMSkey [key ...] ID [ID ...]

XREVRANGE This command is exactly likeXRANGE, but with the notabledifference of returning the entriesin reverse order, and also takingthe start-end range in reverseorder.

XREVRANGE key end start[COUNT count]

XTRIM Trims the stream to a specifiednumber of items, if necessary,evicting old items (items withlower IDs).

XTRIM key MAXLEN [~]count

Message (Stream item) acknowledgement

Compared with Pub/Sub, streams not only support consumer groups, but alsomessage acknowledgement.

When a consumer invokes the XREADGROUP command to read or invokes theXCLAIM command to take over a message, the server does not know whether the

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 34

Page 40: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

message is processed at least once. Therefore, once successfully processed amessage, the consumer should invoke the XACK command to notify the stream sothat the message will not be processed again. In addition, the message is removedfrom PEL and the memory will be released from the Redis server.

In some cases, such as network faults, the client does not invoke XACK afterconsumption. In such cases, the item ID is retained in PEL. After the client isreconnected, set the start message ID of XREADGROUP to 0-0, indicating that allPEL messages and messages after last_id are read. In addition, repeated messagetransmission must be supported when consumers consume messages.

Figure 1-14 Acknowledgement mechanism

Memory Usage Optimization

The memory usage of the Redis 5.0 is optimized based on the previous version.

● Active DefragmentationIf a key is modified frequently and the value length changes constantly, Rediswill allocate additional memory for the key. To achieve high performance,Redis uses the memory allocator to manage memory. Memory is not alwaysfreed up to the OS. As a result, memory fragments occur. If the fragmentationratio (used_memory_rss/used_memory) is greater than 1.5, the memoryusage is inefficient.Therefore, properly planning and using cache data and standardizing datawriting help reduce memory fragments.Redis 3.0 and earlier versions: Memory fragmentation problems are resolvedby restarting the process regularly. It is recommended that the actual cachedata does not exceed 50% of the available memory.Redis 4.0: Active defragmentation is supported, and memory is defragmentedwhile online. In addition, Redis 4.0 supports manual memory defragmentationby running the memory purge command.Redis 5.0: Improved active defragmentation is supported with the updatedJemalloc, which is faster, more intelligent, and provides lower latency.

● HyperLogLog implementation improvements

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 35

Page 41: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

A HyperLogLog is a probabilistic data structure used to calculate thecardinality of a set while consuming little memory. Redis 5.0 improvesHyperLogLog by further optimizing its memory usage.For example: the B-tree is efficient in counting, but consumes a lot ofmemory. By using HyperLogLog, a lot of memory can be saved. While the B-tree requires 1 MB memory for counting, HyperLogLog needs only 1 KB.

● Enhanced memory statisticsThe information returned by the INFO command is more detailed.

New and Better Commands1. Enhanced client management

– Redis-cli supports cluster management.In Redis 4.0 and earlier versions, the redis-trib module needs to beinstalled to manage clusters.Redis 5.0 optimizes redis-cli, integrating all cluster managementfunctions. You can run the redis-cli --cluster help command for moreinformation.

– The client performance is enhanced in frequent connection anddisconnection scenarios.This optimization is valuable when your application needs to use shortconnections.

2. Simpler use of sorted setsZPOPMIN and ZPOPMAX commands are added for sorted sets.– ZPOPMIN key [count]

Removes and returns up to count members with the lowest scores in thesorted set stored at key. When returning multiple elements, the one withthe lowest score will be the first, followed by the elements with higherscores.

– ZPOPMAX key [count]Removes and returns up to count members with the highest scores in thesorted set stored at key. When returning multiple elements, the one withthe lowest score will be the first, followed by the elements with lowerscores.

3. More sub-commands were added to the help commandThe help command can be used to view help information, saving you thetrouble of visiting redis.io every time. For example, run the followingcommand to view the stream help information: xinfo help127.0.0.1:6379> xinfo help1) XINFO <subcommand> arg arg ... arg. Subcommands are:2) CONSUMERS <key> <groupname> -- Show consumer groups of group <groupname>.3) GROUPS <key> -- Show the stream consumer groups.4) STREAM <key> -- Show information about the stream.5) HELP -- Print this help.127.0.0.1:6379>

4. Redis-cli command input tipsAfter you enter a complete command, redis-cli displays a parameter tip tohelp you memorize the syntax format of the command.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 36

Page 42: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

As shown in the following figure, run the zadd command, and redis-clidisplays zadd syntax in light color.

RDB Storing LFU and LRU InformationIn Redis 5.0, storage key eviction policies LRU and LFU were added to the RDBsnapshot file.

● FIFO: First in, first out. The earliest stored data is evicted first.● LRU: Least recently used. Data that is not used for a long time is evicted first.● LFU: Least frequently used. Data that is least frequently used is evicted first.

The RDB file format of Redis 5.0 is modified and is backward compatible. Therefore, if asnapshot is used for migration, data can be migrated from the earlier Redis versions toRedis 5.0, but cannot be migrated from the Redis 5.0 to the earlier versions.

1.8 Command Compatibility

1.8.1 Redis Command CompatibilityThis section describes DCS's compatibility with Redis commands, includingsupported commands, disabled commands, unsupported scripts and commands oflater Redis versions, and restrictions on command usage.

For more information about the command syntax, visit the Redis official website.

DCS for Redis instances support most Redis commands. Any client compatible withthe Redis protocol can access DCS.

● For security purposes, some Redis commands are disabled in DCS. For details,see Commands Disabled by DCS for Redis 3.0 and Commands Disabled byDCS for Redis 4.0 and 5.0.

● Some Redis commands have usage restrictions, which are described in OtherCommand Usage Restrictions.

● Some Redis commands are supported by cluster DCS instances for multi-keyoperations in the same slot. For details, see Table 1-28.

Commands Supported by DCS for Redis 3.0The following lists commands supported by DCS for Redis 3.0.

Commands available since later Redis versions are not supported by earlier versions. Run acommand on redis-cli to check whether it is supported by DCS for Redis. If the message"(error) ERR unknown command" is returned, the command is not supported.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 37

Page 43: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 1-21 Commands supported by DCS for Redis 3.0

Category Command

Key DEL, DUMP, EXISTS, EXPIRE, MOVE, PERSISI, PTTL, RANDOMKEY,RENAME, RENAMENX, RESTORE, SORT, TTL, TYPE, SCAN,OBJIECT

String APPEND, BITCOUNT, BITOP, BITPOS, DECR, DECRBY, GET,GETRANGE, GETSET, INCR, INCRBY, INCRBYFLOAT, MGET, MSET,MSETNX, PSETEX, SET, SETBIT, SETEX, SETNX, SETRANGE,STRLEN

Hash HDEL, HEXISTS, HGET, HGETALL, HINCRBY, HINCRBYFLOAT,HKEYS, HMGET, HMSET, HSET, HSETNX, HVALS, HSCAN

List BLPOP, BRPOP, BRPOPLRUSH, LINDEX, LINSERT, LLEN, LPOP,LPUSHX, LRANGE, LREM, LSET, LTRIM, RPOP, RPOPLPU,RPOPLPUSH, RPUSH, RPUSHXSPOP (Supported by DCS Redis 4.0 and 5.0)NOTE

Proxy Cluster Redis 3.0 instances do not support BLPOP, BRPOP, andBRPOPLRUSH commands.

Set SADD, SCARD, SDIFF, SDIFFSTORE, SINTER, SINTERSTORE,SISMEMBER, SMEMBERS, SMOVE, SPOP, SRANDMEMBER, SREM,SUNION, SUNIONSTORE, SSCAN

Sorted set ZADD, ZCARD, ZCOUNT, ZINCRBY, ZRANGE, ZRANGEBYSCORE,ZRANK, ZREMRANGEBYRANK, ZREMRANGEBYCORE,ZREVRANGE, ZREVRANGEBYSCORE, ZREVRANK, ZSCORE,ZUNIONSTORE, ZINTERSTORE, ZSCAN, ZRANGEBYLEX

HyperLogLog

PFADD, PFCOUNT, PFMERGE

Pub/Sub PSUBSCRIBE, PUBLISH, PUBSUB, PUNSUBSCRIBE, SUBSCRIBE,UNSUBSCRIBE

Transaction DISCARD, EXEC, MULTI, UNWATCH, WATCH

Connection AUTH, ECHO, PING, QUIT, SELECT

Server FLUSHALL, FLUSHDB, DBSIZE, TIME, INFO, KEYS, CLIENT KILL,CLIENT LIST, CLIENT GETNAME, CLIENT SETNAME, CONFIG GET,MONITOR, SLOWLOG, ROLENOTE

● Proxy Cluster Redis 3.0 instances do not support CLIENT commands,including CLIENT KILL, CLIENT GETNAME, CLIENT LIST, CLIENTSETNAME, CLIENT PAUSE, and CLIENT REPLY.

● Proxy Cluster Redis 3.0 instances do not support the MONITORcommand.

Scripting EVAL, EVALSHA, SCRIPT EXISTS, SCRIPT FLUSH, SCRIPT KILL,SCRIPT LOAD

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 38

Page 44: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Category Command

Geo GEOADD, GEOHASH, GEOPOS, GEODIST, GEORADIUS,GEORADIUSBYMEMBER

New Commands Supported by DCS for Redis 4.0In addition to all the commands supported by DCS Redis 3.0, DCS Redis 4.0 addedsupport for the following commands.

Table 1-22 New commands and scripts supported by DCS for Redis 4.0

Category

Command/Script Description

List SPOP Removes and returns one or more randomelements. Available since Redis 3.2.

HSTRLEN Returns the string length of the value associatedwith field in the hash stored at key. Availablesince Redis 3.2.

BITFIELD Treats a Redis string as an array of bits. Availablesince Redis 3.2.

ZLEXCOUNT Returns the number of elements in the sorted set.

SWAPDB Swaps two Redis databases. Available since Redis4.0.

MEMORY Queries and manages memory usage, such asquerying memory usage of a key, queryingoverall memory usage, applying for releasingmemory, and querying the internal status of amemory allocator. Available since Redis 4.0.

For details about new commands supported by DCS for Redis 4.0, see New Features ofDCS for Redis 4.0.

New Commands Supported by DCS for Redis 5.0In addition to all the commands supported by DCS Redis 3.0 and 4.0, DCS Redis5.0 added support for the following commands.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 39

Page 45: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 1-23 New commands and scripts supported by DCS for Redis 5.0

Command/Script Description

Stream commands XACK, XADD, XCLAIM, XDEL, XGROUP, XINFO, XLEN,XPENDING, XRANGE, XREAD, XREADGROUP,XREVRANGE, XTRIMFor details about the description and syntax, seeTable 1-20.

ZPOPMIN Removes and returns multiple members with thelowest scores in the sorted set.

ZPOPMAX Removes and returns multiple members with thehighest scores in the sorted set.

Commands Disabled by DCS for Redis 3.0Redis APIs of single-node and master/standby DCS instances are compatible withopen-source Redis for data access. For ease of use and security purposes, somemanagement operations cannot be initiated from a Redis client. Relatedcommands are listed in Table 1-24.

Table 1-24 Redis commands disabled in single-node and master/standby Redis 3.0instances

Command Description

Key

MIGRATE Transfers a key from one Redis instance to another.

Server

SLAVEOF Changes the replication settings of a replica on the fly.

SHUTDOWN Stops all the clients and quits the Redis process.

LASTSAVE Returns the time of the last successful data persistence todisk.

DEBUG commands Debugging command that should not be used by clients.

COMMAND Returns array reply of details about all Redis commands.

SAVE Performs a synchronous save on disk, producing a point intime snapshot of all the data inside the Redis instance, inthe form of an RDB file.

BGSAVE Asynchronously saves the database on disk.

BGREWRITEAOF Starts an Append Only File (AOF) rewrite process.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 40

Page 46: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

In additional to these commands, Proxy Cluster Redis 3.0 instances do not supportthe commands listed in Table 1-25.

Table 1-25 Redis commands disabled in Proxy Cluster Redis 3.0 instances

Command Description

Server

SYNC An internal command used for full replication.

PSYNC An internal command used for partial replication.

MONITOR Streams back every command processed by the Redisserver for debugging.

CLIENT commands CLIENT KILL, CLIENT GETNAME, CLIENT LIST, CLIENTSETNAME, CLIENT PAUSE, and CLIENT REPLY.

OBJECT Debugging command that should not be used by clients.

ROLE Returns the role of the instance node.

Transaction

DISCARD Flushes all previously queued commands in a transaction.

EXEC Executes all previously queued commands in atransaction.

MULTI Marks the start of a transaction block.

UNWATCH Flushes all the previously watched keys for a transaction.

WATCH Marks the given key or keys to be watched. If the key orkeys are modified by other commands before WATCH isexecuted, the transaction is interrupted.

Connection

SELECT Selects the Redis database. Note: Parameters of theSELECT command can only be set to 0.

Key

MOVE Moves key of the currently selected database to thespecified destination database.

Cluster

CLUSTER Used for cluster management.

codis (Proxy Cluster)

TIME Returns the current server time.

SLOTSINFO Returns the number of slots and the size of each slot inRedis.

SLOTSDEL Deletes all key-value pairs in multiple slots in Redis.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 41

Page 47: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Description

SLOTSMGRTSLOT Randomly migrates a key-value pair in a slot to thedestination.

SLOTSMGRTONE Migrates a specified key-value pair to the destination.

SLOTSCHECK Checks whether slots meet the following consistencyrequirements:● All the keys in the slots have a corresponding value in

the database.● All the keys in the database have a value in the

corresponding slot.

SLOTSMGRTTAGSLOT

Migrates all key-value pairs with the same tag as arandomly selected key in a slot.

SLOTSMGRTTAGONE

Migrates all key-value pairs with the same tag as aspecified key.

List

BLPOP The blocking version of LPOP because it blocks theconnection when there are no elements to pop from anyof the given lists until the specified timeout has expiredor a non-empty element is popped.

BRPOP The blocking version of RPOP because it blocks theconnection when there are no elements to pop from anyof the given lists until the specified timeout has expiredor a non-empty element is popped.

BRPOPLPUSH The blocking variant of RPOPLPUSH. When sourcecontains elements, this command behaves exactly likeRPOPLPUSH.

Commands Disabled by DCS for Redis 4.0 and 5.0

Redis APIs of single-node and master/standby DCS instances are compatible withopen-source Redis for data access. For ease of use and security purposes, somemanagement operations cannot be initiated from a Redis client. Relatedcommands are listed in Table 1-26.

Table 1-26 Redis commands disabled in single-node and master/standby Redis 4.0and 5.0 instances

Command Description

Key

MIGRATE Transfers a key from one Redis instance to another.

Server

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 42

Page 48: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Description

SLAVEOF Changes the replication settings of a replica on the fly.

SHUTDOWN Stops all the clients and quits the Redis process.

DEBUG commands Debugging command that should not be used by clients.

CONFIG SET Reconfigures the server at run time without the need torestart Redis.

CONFIG REWRITE Rewrites the redis.conf file the server was started with.

CONFIG RESETSTAT Resets the statistics reported using the INFO command.

SAVE Performs a synchronous save on disk, producing a pointin time snapshot of all the data inside the Redisinstance, in the form of an RDB file.

BGSAVE Asynchronously saves the database on disk.

BGREWRITEAOF Starts an Append Only File (AOF) rewrite process.

In additional to these commands, Redis Cluster Redis 4.0 and 5.0 instances do notsupport the commands listed in Table 1-27.

Table 1-27 Redis commands disabled in Redis Cluster Redis 4.0 and 5.0 instances

Command Description

Server

SYNC An internal command used for full replication.

PSYNC An internal command used for partial replication.

Cluster

CLUSTER MEET Connects a new node to a cluster.

CLUSTERFLUSHSLOTS

Deletes all slots from a node.

CLUSTER ADDSLOTS Assigns hash slots to a node.

CLUSTER DELSLOTS Removes hash slots from a node.

CLUSTER SETSLOT Configures the state of a hash slot in a node.

CLUSTERBUMPEPOCH

Performed internally by the cluster.

CLUSTERSAVECONFIG

Performed internally by the cluster.

CLUSTER FORGET Removes a node from a cluster.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 43

Page 49: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Description

CLUSTER REPLICATE Configures a node as a replica of a master.

CLUSTER COUNT-FAILURE-REPORTS

Performed internally by the cluster.

CLUSTER FAILOVER Performs a master/replica switchover.

CLUSTER SET-CONFIG-EPOCH

Performed internally by the cluster.

CLUSTER RESET Resets a node in a cluster.

Restricted Redis CommandsSome Redis commands are supported by cluster DCS instances for multi-keyoperations in the same slot. For details, see Table 1-28.

Table 1-28 Redis commands restricted in cluster DCS instances.

Category Description

Set

SINTER Returns the members of the set resulting from theintersection of all the given sets.

SINTERSTORE Equal to SINTER, but instead of returning the result set,it is stored in destination.

SUNION Returns the members of the set resulting from the unionof all the given sets.

SUNIONSTORE Equal to SUNION, but instead of returning the result set,it is stored in destination.

SDIFF Returns the members of the set resulting from thedifference between the first set and all the successivesets.

SDIFFSTORE Equal to SDIFF, but instead of returning the result set, itis stored in destination.

SMOVE Moves member from the set at source to the set atdestination.

Sorted Set

ZUNIONSTORE Computes the union of numkeys sorted sets given by thespecified keys.

ZINTERSTORE Computes the intersection of numkeys sorted sets givenby the specified keys.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 44

Page 50: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Category Description

HyperLogLog

PFCOUNT Returns the approximated cardinality computed by theHyperLogLog data structure stored at the specifiedvariable.

PFMERGE Merges multiple HyperLogLog values into a uniquevalue.

Key

RENAME Renames key to newkey.

RENAMENX Renames key to newkey if newkey does not yet exist.

BITOP Performs a bitwise operation between multiple keys(containing string values) and stores the result in thedestination key.

RPOPLPUSH Returns and removes the last element (tail) of the liststored at source, and pushes the element at the firstelement (head) of the list stored at destination.

String

MSETNX Sets the given keys to their respective values.

While running commands that take a long time to run, such as FLUSHALL, DCS instancesmay not respond to other commands and change to the faulty state. After the commandfinishes executing, the instance will return to normal.

Other Command Usage RestrictionsKey commands:

In case of a large amount of cached data, running a Keys command may blockthe execution of other commands for a long time or occupy exceptionally largememory. Therefore, when running a Keys command, describe the exact patternand do not use fuzzy keys *. keys * can be used during commissioning or whenthe number of keys does not exceed 5 million. Otherwise, the service cannot runproperly.

Server commands:

● While running commands that take a long time to run, such as FLUSHALL,DCS instances may not respond to other commands and change to the faultystate. After the command finishes executing, the instance will return tonormal.

● When the FLUSHDB or FLUSHALL command is run, execution of other servicecommands may be blocked for a long time in case of a large amount ofcached data.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 45

Page 51: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

EVAL and EVALSHA commands:

● When the EVAL or EVALSHA command is run, at least one key must becontained in the command parameter. Otherwise, the error message "ERReval/evalsha numkeys must be bigger than zero in redis cluster mode" isdisplayed.

● When the EVAL or EVALSHA command is run, a cluster DCS Redis instanceuses the first key to compute slots. Ensure that the keys to be operated inyour code are in the same slot. For details, visit http://redis.io/commands.

● For the EVAL command:– You are advised to learn the Lua script features of Redis before running

the EVAL command. For details, see http://redisbook.readthedocs.io/en/latest/feature/scripting.html.

– The execution timeout time of a Lua script is 5 seconds. Time-consumingstatements such as long-time sleep and large loop statements should beavoided.

– When calling a Lua script, do not use random functions to specify keys.Otherwise, the execution results are inconsistent on the master andstandby nodes.

Others:

The time limit for executing a Redis command is 15 seconds. To prevent otherservices from failing, a master/replica switchover will be triggered after thecommand execution times out.

1.8.2 Web CLI Command CompatibilityWeb CLI is a command line tool provided on the DCS console. This sectiondescribes Web CLI's compatibility with Redis commands, including supported anddisabled commands. For details about the command syntax, visit the Redis officialwebsite.

Currently, only DCS Redis 4.0 and 5.0 support Web CLI.

Commands Supported in Web CLI

The following lists the commands supported when the using Web CLI.

Table 1-29 Commands supported in Web CLI

Category Command

Key DEL, DUMP, EXISTS, EXPIRE, MOVE, PERSISI, PTTL, RANDOMKEY,RENAME, RENAMENX, RESTORE, SORT, TTL, TYPE, SCAN,OBJIECT

String APPEND, BITCOUNT, BITOP, BITPOS, DECR, DECRBY, GET,GETRANGE, GETSET, INCR, INCRBY, INCRBYFLOAT, MGET, MSET,MSETNX, PSETEX, SET, SETBIT, SETEX, SETNX, SETRANGE,STRLEN

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 46

Page 52: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Category Command

Hash HDEL, HEXISTS, HGET, HGETALL, HINCRBY, HINCRBYFLOAT,HKEYS, HMGET, HMSET, HSET, HSETNX, HVALS, HSCAN

List BLPOP, BRPOP, BRPOPLRUSH, LINDEX, LINSERT, LLEN, LPOP,LPUSHX, LRANGE, LREM, LSET, LTRIM, RPOP, RPOPLPU,RPOPLPUSH, RPUSH, RPUSHX, SPOP, HSTRLEN, BITFIELD,ZLEXCOUNT, SWAPDB, MEMORY

Set SADD, SCARD, SDIFF, SDIFFSTORE, SINTER, SINTERSTORE,SISMEMBER, SMEMBERS, SMOVE, SPOP, SRANDMEMBER, SREM,SUNION, SUNIONSTORE, SSCAN

Sorted set ZADD, ZCARD, ZCOUNT, ZINCRBY, ZRANGE, ZRANGEBYSCORE,ZRANK, ZREMRANGEBYRANK, ZREMRANGEBYCORE,ZREVRANGE, ZREVRANGEBYSCORE, ZREVRANK, ZSCORE,ZUNIONSTORE, ZINTERSTORE, ZSCAN, ZRANGEBYLEX

HyperLogLog

PFADD, PFCOUNT, PFMERGE

Pub/Sub PSUBSCRIBE, PUBLISH, PUBSUB, PUNSUBSCRIBE, SUBSCRIBE,UNSUBSCRIBE

Transaction DISCARD, EXEC, MULTI, WATCH

Connection AUTH, ECHO, PING, QUIT, SELECT

Server FLUSHALL, FLUSHDB, DBSIZE, TIME, INFO, CLIENT KILL, CLIENTLIST, CLIENT GETNAME, CLIENT SETNAME, CONFIG GET,MONITOR, SLOWLOG, ROLE

Scripting EVAL, EVALSHA, SCRIPT EXISTS, SCRIPT FLUSH, SCRIPT KILL,SCRIPT LOAD

Geo GEOADD, GEOHASH, GEOPOS, GEODIST, GEORADIUS,GEORADIUSBYMEMBER

Commands Disabled in Web CLI

Table 1-30 and Table 1-31 list the command disabled in Web CLI. In additional tothe commands disabled by single-node and master/standby instance, thecommands listed in Table 1-31 are not supported when you access a single-nodeor master/standby Redis Cluster instance using Web CLI.

Table 1-30 Redis commands disabled in Web CLI for single-node and master/standby instances

Command Description

Key

MIGRATE Transfers a key from one Redis instance to another.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 47

Page 53: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Description

WAIT Blocks the current client until all the previous writecommands are successfully transferred and acknowledgedby at least the specified number of replicas.

Server

SLAVEOF Changes the replication settings of a replica on the fly.

SHUTDOWN Stops all the clients and quits the Redis process.

DEBUG commands Debugging command that should not be used by clients.

CONFIG SET Reconfigures the server at run time without the need torestart Redis.

CONFIG REWRITE Rewrites the redis.conf file the server was started with.

CONFIG RESETSTAT Resets the statistics reported using the INFO command.

SAVE Performs a synchronous save on disk, producing a point intime snapshot of all the data inside the Redis instance, inthe form of an RDB file.

BGSAVE Asynchronously saves the database on disk.

BGREWRITEAOF Starts an Append Only File (AOF) rewrite process.

COMMAND Returns array reply of details about all Redis commands.

KEYS Returns all keys matching the specified pattern (regularexpression)

MONITOR Monitors the Redis server in real time

Transaction

UNWATCH Flushes all the previously watched keys for a transaction.

REPLICAOF Changes the replication settings of a replica on the fly.

Table 1-31 Redis commands disabled in Web CLI for Redis Cluster instances

Command Description

Server

SYNC An internal command used for full replication.

PSYNC An internal command used for partial replication.

Cluster

CLUSTER MEET Connects a new node to a cluster.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 48

Page 54: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Description

CLUSTERFLUSHSLOTS

Deletes all slots from a node.

CLUSTER ADDSLOTS Assigns hash slots to a node.

CLUSTER DELSLOTS Removes hash slots from a node.

CLUSTER SETSLOT Configures the state of a hash slot in a node.

CLUSTERBUMPEPOCH

Performed internally by the cluster.

CLUSTERSAVECONFIG

Performed internally by the cluster.

CLUSTER FORGET Removes a node from a cluster.

CLUSTER REPLICATE Configures a node as a replica of a master.

CLUSTER COUNT-FAILURE-REPORTS

Performed internally by the cluster.

CLUSTER FAILOVER Performs a master/replica switchover.

CLUSTER SET-CONFIG-EPOCH

Performed internally by the cluster.

CLUSTER RESET Resets a node in a cluster.

1.8.3 Memcached Command CompatibilityMemcached supports the TCP-based text protocol and binary protocol. Any clientscompatible with a Memcached protocol can access DCS instances.

Memcached Text ProtocolThe Memcached text protocol uses ASCII text to transfer commands, which helpsyou compile clients and debug problems. DCS Memcached instances can even bedirectly connected using Telnet.

Compared with the Memcached binary protocol, the Memcached text protocol iscompatible with more open-source clients, but the text protocol does not supportauthentication.

Clients can use the Memcached text protocol to access DCS Memcached instances only ifpassword-free access is enabled. Password-free access means that access to DCSMemcached instances will not be username- and password-protected, and any Memcachedclients that satisfy security group rules in the same VPC can access the instances. Enablingpassword-free access poses security risks. Exercise caution when enabling password-freeaccess.

Table 1-32 lists the commands supported by the Memcached text protocol anddescribes whether these commands are supported by DCS Memcached instances.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 49

Page 55: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 1-32 Commands supported by the Memcached text protocol

Command Description Supportedby DCS

add Adds data. Yes

set Sets data, including adding or modifyingdata.

Yes

replace Replaces data. Yes

append Adds data after the value of a specified key. Yes

prepend Adds data before the value of a specifiedkey.

Yes

cas Checks and set data. Yes

get Queries data. Yes

gets Queries data details. Yes

delete Deletes data. Yes

incr Adds the specified amount to the requestedcounter.

Yes

decr Removes the specified amount to therequested counter.

Yes

touch Updates the expiration time of existingdata.

Yes

quit Closes the connection. Yes

flush_all Invalidates all existing data.NOTE

The value of the delay option (if any) must be 0.

Yes

version Queries Memcached version information. Yes

stats Manages operation statistics.NOTE

Currently, only basic statistics can be queried.Commands on optional parameters cannot bequeried.

Yes

cache_memlimit Adjusts the cache memory limit. No

slabs Queries usage of internal storagestructures.

No

lru Manages policies of deleting expired data. No

lru_crawler Manages threads of deleting expired data. No

verbosity Sets the verbosity level of the loggingoutput.

No

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 50

Page 56: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Description Supportedby DCS

watch Inspects what's going on internally. No

Memcached Binary ProtocolThe Memcached binary protocol encodes commands and operations into specificstructures before sending them. Commands are represented by predefinedcharacter strings.

The Memcached binary protocol provides more features but fewer clients than theMemcached text protocol. The Memcached binary protocol is more secure thanthe Memcached text protocol as it additionally supports simple authentication andsecurity layer (SASL) authentication.

Table 1-33 lists the commands supported by the Memcached binary protocol anddescribes whether these commands are supported by DCS Memcached instances.

Table 1-33 Commands supported by the Memcached binary protocol

Command Code

Command Description Supportedby DCS

0x00 GET Queries data. Yes

0x01 SET Sets data, including adding ormodifying data.

Yes

0x02 ADD Adds data. Yes

0x03 REPLACE Replaces data. Yes

0x04 DELETE Deletes data. Yes

0x05 INCREMENT Adds the specified amount to therequested counter.

Yes

0x06 DECREMENT

Removes the specified amount to therequested counter.

Yes

0x07 QUIT Closes the connection. Yes

0x08 FLUSH Invalidates all existing data.NOTE

The value of the delay option (if any)must be 0.

Yes

0x09 GETQ Queries data. The client will notreceive any response in case of failure.

Yes

0x0a NOOP No-operation instruction, equivalentto ping.

Yes

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 51

Page 57: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Code

Command Description Supportedby DCS

0x0b VERSION Queries Memcached versioninformation.

Yes

0x0c GETK Queries data and adds a key into theresponse packet.

Yes

0x0d GETKQ Queries data and returns a key. Theclient will not receive any response incase of failure.

Yes

0x0e APPEND Adds data after the value of thespecified key.

Yes

0x0f PREPEND Adds data before the value of aspecified key.

Yes

0x10 STAT Queries statistics of DCS Memcachedinstances.NOTE

Currently, only basic statistics can bequeried. Commands on optionalparameters cannot be queried.

Yes

0x11 SETQ Sets data, including adding ormodifying data.The client will not receive anyresponse in the case of success.

Yes

0x12 ADDQ Adds data. The client will not receiveany response in the case of success.

Yes

0x13 REPLACEQ Replaces data. The client will notreceive any response in the case ofsuccess.

Yes

0x14 DELETEQ Deletes data. The client will notreceive any response in the case ofsuccess.

Yes

0x15 INCREMENTQ

Adds the specified amount to therequested counter. The client will notreceive any response in the case ofsuccess.

Yes

0x16 DECREMENTQ

Removes the specified amount to therequested counter. The client will notreceive any response in the case ofsuccess.

Yes

0x17 QUITQ Closes the connection. Yes

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 52

Page 58: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Command Code

Command Description Supportedby DCS

0x18 FLUSHQ Clears data and returns noinformation.NOTE

The value of the delay option (if any)must be 0.

Yes

0x19 APPENDQ Adds data after the value of thespecified key. The client will notreceive any response in the case ofsuccess.

Yes

0x1a PREPENDQ Adds data before the value of aspecified key. The client will notreceive any response in the case ofsuccess.

Yes

0x1c TOUCH Updates the expiration time ofexisting data.

Yes

0x1d GAT Queries data and updates theexpiration time of existing data.

Yes

0x1e GATQ Queries data and returns a key. Theclient will not receive any response incase of failure.

Yes

0x23 GATK Queries data, adds a key into theresponse packet, and updates theexpiration time of existing data.

Yes

0x24 GATKQ Queries data, returns a key, andupdates the expiration time of existingdata. The client will not receive anyresponse in case of failure.

Yes

0x20 SASL_LIST_MECHS

Asks the server what SASLauthentication mechanisms itsupports.

Yes

0x21 SASL_AUTH Starts SASL authentication. Yes

0x22 SASL_STEP Further authentication steps arerequired.

Yes

1.9 Basic Concepts

DCS InstanceAn instance is the minimum resource unit provided by DCS.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 53

Page 59: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

You can select the Redis or Memcached cache engine. Instance types can besingle-node, master/standby, or cluster. For each instance type, multiplespecifications are available.

For details, see DCS Instance Specifications and DCS Instance Types.

ProjectProjects are used to group and isolate OpenStack resources (computing resources,storage resources, and network resources). A project can be a department or aproject team. Multiple projects can be created for one account.

ReplicaA replica is a node of a DCS instance. No replication indicates that the instancedoes not have a standby node. Master/Standby replication indicates that theinstance has a standby node. For example, a master/standby DCS instance has amaster/standby replication. Each node of a cluster DCS Redis instance has amaster/standby replication.

Maintenance Time WindowThe maintenance time window is the period when the DCS service team upgradeand maintain the instance.

DCS instance maintenance takes place only once a quarter and does not interruptservices. Even so, you are advised to select a time period when the service demandis low.

When creating an instance, you must specify a maintenance time window, whichcan be modified after the instance is created.

For details, see: Modifying an Instance's Maintenance Time Window.

Cross-AZ DeploymentMaster/Standby instances are deployed across different AZs with physicallyisolated power supplies and networks Applications can also be deployed acrossAZs to achieve HA for both data and applications.

When creating a master/standby DCS Redis or Memcached instance, you canselect a standby AZ for the standby node.

ShardA shard is a management unit of a cluster DCS Redis instance. Each shardcorresponds to a redis-server process. A cluster consists of multiple shards. Eachshard has multiple slots. Data is distributedly stored in the slots. The use of shardsincreases cache capacity and concurrent connections.

1.10 Related ServicesDCS is used together with other services, including VPC, ECS, IAM, Cloud Eye, CTS,and Object Storage Service (OBS).

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 54

Page 60: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Figure 1-15 Relationships between DCS and other services

VPCA VPC is an isolated virtual network environment on the public cloud. You canconfigure IP address ranges, subnets, and security groups in a VPC.

DCS runs in VPCs. The VPC service manages EIPs and bandwidth, and providessecurity groups. You can configure access rules for security groups to secure theaccess to DCS.

ECSAn ECS is a cloud server that provides scalable, on-demand computing resourcesfor secure, flexible, and efficient applications.

You can access and manage your DCS instances using an ECS.

IAMIAM provides identity authentication, permissions management, and accesscontrol.

With IAM, you can control access to DCS.

Cloud EyeCloud Eye is a secure, scalable, and integrated monitoring service. With Cloud Eye,you can monitor your DCS service and configure alarm rules and notifications.

Cloud Trace Service (CTS)CTS provides you with a history of operations performed on cloud serviceresources. With CTS, you can query, audit, and backtrack operations. The tracesinclude the operation requests sent using the management console or open APIsand the results of these requests.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 55

Page 61: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

OBSOBS provides secure, cost-effective storage service using objects as storage units.With OBS, you can store and manage the lifecycle of massive amounts of data.

You can store DCS instance backup files in OBS.

Distributed Cache ServiceUser Guide 1 Introduction

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 56

Page 62: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

2 Getting Started

2.1 Creating a DCS Instance

2.1.1 Identifying RequirementsBefore creating a DCS instance, identify your requirements and complete thefollowing preparations:

1. Decide on the required cache engine.Choose a cache engine based on service requirements. The cache enginecannot be changed once the instance is created.– For more information about Redis and Memcached cache engines, see

DCS Overview.– For more information about the differences between Redis and

Memcached, see Comparing Redis and Memcached.2. Decide on the required cache engine version.

Perform this step if you choose Redis as the cache engine.Different Redis versions have different features. For details, see ComparingDCS Redis Versions.

3. Decide on the required instance type.DCS provides single-node, master/standby, Proxy Cluster, and Redis Clustertypes of instances. Each type has its own architecture. For details about theinstance architectures, see DCS Instance Types.

4. Decide on the required instance specification.Each specification specifies the maximum available memory, number ofconnections, and bandwidth. For details, see DCS Instance Specifications.

5. Decide on the region and whether cross-AZ deployment is required.Choose a region closest to your application to reduce latency.A region consists of multiple availability zones (AZs) with physically isolatedpower supplies and networks. Master/Standby and cluster DCS instances canbe deployed across AZs. Applications can also be deployed across AZs toachieve high availability (HA) for both data and applications.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 57

Page 63: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● If a master/standby or cluster DCS instance is deployed across AZs, faults in an AZdo not affect cache nodes in other AZs. This is because when the master node isfaulty, the standby cache node will automatically become the master node toprovide services. Such deployment achieves better disaster recovery.

● Deploying a DCS instance across AZs slightly reduces network efficiency comparedwith deploying an instance within an AZ. Therefore, if a DCS instance is deployedacross AZs, synchronization between master and standby cache nodes is slightlyless efficient.

6. Decide whether backup policies are required.

Currently, backup policies can be configured only for master/standby andcluster DCS instances. For details about backup and restoration, seeOverview.

2.1.2 Preparing the EnvironmentTo access DCS instances through a Virtual Private Cloud (VPC), create a VPC andconfigure security groups and subnets for it before using DCS. A VPC provides anisolated virtual network environment which you can configure and manage. UsingVPCs enhances public cloud resource security and simplifies network deployment.

Once you have created a VPC, you can use it for all DCS instances yousubsequently create.

Creating a VPC

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

You are advised to select a region closest to your application.

Step 3 Click Service List, and choose Network > Virtual Private Cloud to launch theVPC console.

Step 4 On the Dashboard page, click Create VPC.

Step 5 Create a VPC as prompted, retaining the default values unless otherwise required.For more information on how to create a VPC, see the Virtual Private Cloud UserGuide.

After a VPC is created, a subnet is also created in the subnet. If the VPC needsmore subnets, go to 6. Otherwise, go to 7.

Step 6 Click the name of the VPC for which you want to create a subnet. On the Subnetstab page, click Create Subnet. Create a subnet as prompted, retaining the defaultvalues unless otherwise required.

For more information on how to create a subnet, see the Virtual Private CloudUser Guide.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 58

Page 64: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Step 7 In the navigation pane, choose Security Group. On the Security Group page, clickCreate Security Group. Create a security group as prompted, retaining the defaultvalues unless otherwise required.

For more information on how to create a security group, see the Virtual PrivateCloud User Guide.

----End

2.1.3 Creating a DCS Redis InstanceYou can create one or more DCS Redis instances with the required computingcapabilities and storage space based on service requirements.

Creating a DCS Redis Instance

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 Click Create DCS Instance.

Step 4 Select a region closest to your application to reduce latency and accelerate access.

Step 5 Specify the following instance parameters based on the information collected inIdentifying Requirements.

1. Cache Engine:Select Redis.

2. Version:Currently, 3.0, 4.0, and 5.0 versions are supported.

– If Instance Type is set to Proxy Cluster, you can only select 3.0 for Version.– If Instance Type is set to Redis Cluster, you can only select 4.0 or 5.0 for Version.

3. Set Instance Type to Single-node, Master/Standby, Proxy Cluster or RedisCluster.

4. Select an AZ.

To accelerate access, deploy your instance and your application in the same AZ.

If the instance type is master/standby, Proxy Cluster, or Redis Cluster, StandbyAZ is displayed. Select a standby AZ for the standby node of the instance.

5. If you have selected Redis 4.0 or 5.0 for the cache engine version and master/standby or Redis Cluster for the instance type, the Replicas parameter will bedisplayed.The default number of replicas is 2. You can set the number of replicas to 1 or2 for a Redis Cluster instance.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 59

Page 65: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

6. Instance Specification:The remaining quota is displayed on the console.To apply to increase quota, click Increase quota below the specifications.

Step 6 Configure the instance network parameters.

1. For VPC, select a created VPC, subnet, and specify the IP address.If the Version is 4.0 or 5.0, the IP address will be automatically assigned. Youcan specify a port numbering in the range from 1 to 65535. If no port isspecified, the default port 6379 will be used.If you selected 3.0 for Version, you can choose to obtain an automaticallyassigned IP address or manually specify an IP address that is available in theselected subnet. The port cannot be customized. Port 6379 will be used.

2. Select a security group.A security group is a set of rules that control access to ECSs. It provides accesspolicies for mutually trusted ECSs with the same security protectionrequirements in the same VPC.This parameter is displayed only for Redis 3.0 versions. DCS for Redis 4.0 and5.0 are based on VPC endpoints and do not support security groups.

Step 7 Set the instance password.

This password is used for accessing the DCS Redis instance.

For security purposes, you must enter an instance-specific password when you are accessingthe DCS Redis instance. Keep your instance password secure and change it periodically.

The password must meet the following complexity requirements:

● Cannot be left blank.● Must be 8 to 32 characters long.● Must contain at least three of the following character types:

– Lowercase letters– Uppercase letters– Digits– Special characters (`~!@#$%^&*()-_=+\|[{}]:'",<.>/?)

Step 8 Click More Settings to display more configurations, including backup policy andcritical command renaming.

1. Specify Name and Description.The value of Name must be a string consisting of 4 to 64 characters.

2. Specify backup and restoration policies.This parameter is displayed only when the instance type is master/standby orcluster. For more information on how to configure a backup policy, seeBacking Up and Restoring DCS Instances.

3. Rename critical commands.Command Renaming is displayed for Redis 4.0 and 5.0. Currently, you canonly rename the COMMAND, KEYS, FLUSHDB, FLUSHALL, and HGETALLcommands.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 60

Page 66: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

4. Specify the maintenance window.Choose a window for DCS O&M personnel to perform maintenance on yourinstance. You will be contacted before any maintenance activities areperformed.

Step 9 Click Next.

The displayed page shows the instance information you have specified.

Step 10 Confirm the instance information.

Step 11 Return to the Cache Manager page to view and manage your DCS instances.

1. Creating a single-node or master/standby DCS standard Redis instance takes 5to 15 minutes. Creating a cluster DCS standard Redis instance takes 30minutes.

2. After a DCS instance has been successfully created, it enters the Runningstate by default.

----End

2.1.4 Creating a DCS Memcached InstanceYou can create one or more DCS Memcached instances with the requiredcomputing capabilities and storage space based on service requirements.

Creating a DCS Memcached Instance

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click Create DCS Instance.

Step 5 Select a region closest to your application to reduce latency and accelerate access.

Step 6 Specify the following instance parameters based on the information collected inIdentifying Requirements.

1. Cache Engine:Select Memcached.

2. Instance Type:Select Single-node or Master/Standby.

3. Select an AZ.

To accelerate access, deploy your instance and your application in the same AZ. Toensure data reliability, deploy them in different AZs.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 61

Page 67: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

If the instance type is master/standby, Standby AZ is displayed. Select astandby AZ for the standby node of the instance.

4. Specify Instance Specification.The remaining quota is displayed on the console.To apply to increase quota, click Increase quota below the specifications.

Step 7 Configure the instance network parameters.

1. For VPC, select a created VPC, subnet, and specify the IP address.You can choose to obtain an automatically assigned IP address or manuallyspecify an IP address that is available in the selected subnet.

2. Select a security group.A security group is a set of rules that control access to ECSs. It provides accesspolicies for mutually trusted ECSs with the same security protectionrequirements in the same VPC.

Step 8 Set the instance password.● Select Yes or No for Password Protected.

– Password-free access carries security risks. Exercise caution when selecting thismode.

– After the instance is created, you can click reset its password.

– If password-free access is disabled, DCS Memcached instances must be accessedusing the Memcached binary protocol and through SASL authentication.

● Username required for accessing the new DCS instance. The username mustmeet the following requirements.

This parameter is displayed only if password-protected access is enabled.

– Cannot be left blank.– Must start with a letter.– Must be a string of 1 to 64 characters.– Must contain only letters, digits, hyphens (-), and underscores (_).

● Password and Confirm Password: These parameters indicate the password ofaccessing the DCS Memcached instance, and are displayed only whenPassword Protected is set to Yes.

For security purposes, if password-free access is disabled, the system prompts you toenter an instance-specific password when you are accessing the DCS Memcachedinstance. Keep your instance password secure and change it periodically.

The password must meet the following complexity requirements:– Cannot be left blank.– Must be 8 to 32 characters long.– Must contain at least three of the following character types:

▪ Lowercase letters

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 62

Page 68: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

▪ Uppercase letters

▪ Digits

▪ Special characters (`~!@#$%^&*()-_=+\|[{}]:'",<.>/?)

Step 9 Click More Settings to display more configurations, including backup policy andmaintenance window.

1. Specify Name and Description.The instance name must be a string of 4 to 64 characters.

2. Specify backup and restoration policies.This parameter is displayed only when the instance type is master/standby.For more information on how to configure a backup policy, see Backing Upand Restoring DCS Instances.

3. Specify the maintenance window.Choose a window for DCS O&M personnel to perform maintenance on yourinstance. Time windows 22:00–02:00, 02:00–06:00, 06:00–10:00, 10:00–14:00,14:00–18:00, and 18:00–22:00 are available for selection.

Step 10 Click Next.

The displayed page shows the instance information you have specified.

Step 11 Confirm the instance information.

Step 12 After the new DCS instance has been created, return to the Cache Manager pageto view and manage your DCS instances.

1. It takes 5 to 15 minutes to create a DCS instance.2. After a DCS instance has been successfully created, it enters the Running

state by default.

----End

2.2 Accessing a DCS Redis InstanceAccess a DCS Redis instance through redis-cli on an ECS in the same VPC. Formore information on how to use other Redis clients, visit https://redis.io/clients.

Redis 3.0 does not support port customization and allows only port 6379. For Redis 4.0 and5.0, you can specify a port or use the default port 6379. The following uses the default port6379. If you have specified a port, replace 6379 with the actual port.

Prerequisites● The DCS Redis instance you want to access is in the Running state.● An ECS has been created to serve as your Redis client. For more information

on how to create ECSs, see the Elastic Cloud Server User Guide.● If the ECS runs the Linux OS, ensure that the GCC compilation environment

has been installed on the ECS.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 63

Page 69: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Procedure (Linux)

Step 1 Obtain the IP address and port number of the DCS Redis instance to be accessed.

For details, see Viewing Details of a DCS Instance.

Step 2 Install redis-cli.

The following steps assume that your client is installed on the Linux OS.

1. Log in to the ECS.2. Run the following command to download the source code package of your

Redis client from http://download.redis.io/releases/redis-3.0.7.tar.gz:wget http://download.redis.io/releases/redis-3.0.7.tar.gz

3. Run the following command to decompress the redis-3.0.7 directory from thepackage:tar -xzf redis-3.0.7.tar.gz

4. Run the following commands to go to the redis-3.0.7 directory and compilethe source code of your Redis client:cd redis-3.0.7makecd src

Step 3 Access a DCS instance of a type other than Redis Cluster.

Perform the following procedure to access a DCS Redis 3.0 instance, or a single-node or master/standby DCS Redis 4.0 or 5.0 instance.

1. Run the following commands to access the chosen DCS Redis instance:./redis-cli -h {dcs_instance_address} -p 6379{dcs_instance_address} indicates the IP address of the DCS instance and 6379is the port used for accessing the instance. The IP address and port numberare obtained in Step 1.Example:[root@ecs--paas-h00407154 redis-3.0.7]# cd src[root@ecs--paas-h00407154 src]# ./redis-cli -h 192.168.0.148 -p 6379192.168.0.148:6379>

2. Enter the password. You can read and write cached data only after thepassword is verified.auth <password><password> indicates the password used for logging in to the chosen DCSRedis instance. This password is defined during DCS Redis instance creation.The command output is as follows:192.168.0.148:6379> auth *******OK192.168.0.148:6379>

Step 4 Access a DCS instance of the Redis Cluster type.

Perform the following procedure to access a DCS Redis 4.0 or 5.0 instance in RedisCluster type.

1. Run the following commands to access the chosen DCS Redis instance:

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 64

Page 70: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

./redis-cli -h {dcs_instance_address} -p 6379 -a {password} -c{dcs_instance_address} indicates the IP address of the DCS Redis instance,6379 is the port used for accessing the instance, {password} is the passwordof the instance, and -c is used for accessing Redis Cluster nodes. The IPaddress and port number are obtained in Step 1.Example:root@ecs-lwx636111:~/redis-3.0.7/src# ./redis-cli -h 192.168.0.85 -p 6379 -a ****** -c192.168.0.85:6379>

2. Run the following command to view the Redis Cluster node information:cluster nodesEach shard in a Redis Cluster has a master and a replica by default. Theproceeding command provides all the information of cluster nodes.192.168.0.85:6379> cluster nodes0988ae8fd3686074c9afdcce73d7878c81a33ddc 192.168.0.231:6379@16379 slave f0141816260ca5029c56333095f015c7a058f113 0 1568084030000 3 connected1a32d809c0b743bd83b5e1c277d5d201d0140b75 192.168.0.85:6379@16379 myself,master - 0 1568084030000 2 connected 5461-10922c8ad7af9a12cce3c8e416fb67bd6ec9207f0082d 192.168.0.130:6379@16379 slave 1a32d809c0b743bd83b5e1c277d5d201d0140b75 0 1568084031000 2 connected7ca218299c254b5da939f8e60a940ac8171adc27 192.168.0.22:6379@16379 master - 0 1568084030000 1 connected 0-5460f0141816260ca5029c56333095f015c7a058f113 192.168.0.170:6379@16379 master - 0 1568084031992 3 connected 10923-1638319b1a400815396c6223963b013ec934a657bdc52 192.168.0.161:6379@16379 slave 7ca218299c254b5da939f8e60a940ac8171adc27 0 1568084031000 1 connected

Write operations can only be performed on master nodes. The CRC16 of thekey modulo 16384 is taken to compute what is the hash slot of a given key.As shown in the following, the value of CRC16 (KEY) mode 16384determines the hash slot that a given key is located at and redirects the clientto the node where the hash slot is located at.192.168.0.170:6379> set hello world-> Redirected to slot [866] located at 192.168.0.22:6379OK192.168.0.22:6379> set happy dayOK192.168.0.22:6379> set abc 123-> Redirected to slot [7638] located at 192.168.0.85:6379OK192.168.0.85:6379> get hello-> Redirected to slot [866] located at 192.168.0.22:6379"world"192.168.0.22:6379> get abc-> Redirected to slot [7638] located at 192.168.0.85:6379"123"192.168.0.85:6379>

----End

Procedure (Windows)Download the Windows Redis client installation package. Decompress thepackage, open the CLI tool cmd.exe, and go to the directory where thedecompressed Redis client installation package is saved. Then, run the followingcommand to access the DCS Redis instance:

redis-cli -h XXX -p 6379

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 65

Page 71: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

XXX indicates the IP address of the DCS instance and 6379 is an example portnumber used for accessing a DCS instance. For details on how to obtain the IPaddress and port, see Viewing Details of a DCS Instance. Change the IP addressand port as required.

2.3 Accessing an Instance in Web CLIAccess a DCS Redis 4.0 or 5.0 instance through Web CLI. Only DCS Redis 4.0 or 5.0instances support access through Web CLI.

Do not enter sensitive information in Web CLI to avoid disclosure.

PrerequisitesThe DCS Redis 4.0 or 5.0 instance you want to access through Web CLI is in theRunning state.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 In the navigation pane, choose Cache Manager. In the Operation column of theinstance, choose More > Web CLI.

Step 4 Enter the password of the DCS instance. On Web CLI, select the current Redisdatabase, enter a Redis command in the command box, and press Enter.

----End

2.4 Accessing a DCS Memcached InstanceAccess a DCS Memcached instance using telnet on an ECS in the same VPC.

Prerequisites● The DCS Memcached instance you want to access is in the Running state.● An ECS has been created on which the client has been installed. For details on

how to create ECSs, see the Elastic Cloud Server User Guide.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 66

Page 72: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

1. An ECS can communicate with a DCS instance that belongs to the same VPC and isconfigured with the same security group.

2. If the ECS and DCS instance are not in the same VPC, you can establish a VPCpeering connection to achieve network connectivity between the ECS and DCSinstance. For details, see Does DCS Support Cross-VPC Access?

3. If different security groups have been configured for the ECS and DCS instance, youcan set security group rules to achieve network connectivity between the ECS andDCS instance. For details, see How to Select and Configure a Security Group?

● All annotations in example code have been deleted.● All command lines and code blocks are UTF-8 encoded. Using another

encoding scheme will cause compilation problems or even command failures.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 On the Cache Manager page, click the name of the DCS Memcached instance youwant to access. Obtain the IP address and port number of the instance.

Step 5 Access the chosen DCS Memcached instance.

1. Log in to the ECS.2. Run the following command to check whether telnet is installed on the ECS:

which telnetIf the directory in which the telnet is installed is displayed, telnet has beeninstalled on the ECS. If the client installation directory is not displayed, installthe telnet manually.

– If telnet has not been installed in Linux, run the yum -y install telnet command toinstall it.

– In the Windows OS, choose Start > Control Panel > Programs > Programs andFeatures > Turn Windows features on or off, and enable telnet.

3. Run the following command to access the chosen DCS Memcached instance:telnet {ip} {port}In this command: {ip} indicates the IP address of the DCS Memcachedinstance. {port} indicates the port number of the DCS Memcached instance.Both the IP address and the port number are obtained in Step 4.When you have successfully accessed the chosen DCS Memcached instance,information similar to the following is displayed:

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 67

Page 73: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Trying XXX.XXX.XXX.XXX...Connected to XXX.XXX.XXX.XXX.Escape character is '^]'.

– If Password-protected is not enabled for the instance, run the followingcommands directly after the instance is accessed successfully.

– If Password-protected is enabled for the instance, attempts to perform operationson the instance will result in the message "ERROR authentication required",indicating that you do not have the required permissions. In this case, enter authusername@password to authenticate first. username and password are that usedfor accessing the DCS Memcached instance.

Example commands for using the DCS Memcached instance (lines in red arethe commands and the other lines are the command output):set hello 0 0 6world!STOREDget helloVALUE hello 0 6world!END

----End

2.5 Viewing Details of a DCS InstanceOn the DCS console, you can view DCS instance details.

ProcedureStep 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Search for DCS instances using any of the following methods:● Search by keyword.

Enter a keyword to search.● Select attributes and enter their keywords to search.

Currently, you can search by name, ID, connection address (IP address:portnumber), AZ, status, instance type, cache engine, and CPU and memory type.For example, to filter DCS instances by cache engine or cache engine version,click the search box, select Cache Engine, and then choose Redis,Memcached, Redis 3.0, Redis 4.0, or Redis 5.0.

For more information on how to search, click the question mark to the right of thesearch box.

Step 5 On the DCS instance list, click the name of a DCS instance to display more detailsabout it. Table 2-1 describes the parameters.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 68

Page 74: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 2-1 Parameters on the Basic Information page of a DCS instance

Section Parameter Description

InstanceDetails

Name Name of the chosen instance. To modify theinstance name, click the icon.

Status State of the chosen instance.

ID ID of the chosen instance.

CacheEngine

Cache engine used by the DCS instance, which canbe Redis or Memcached. If the cache engine is Redis,it is followed by the version number, for example,Redis 3.0.

InstanceType

Type of the selected instance. Currently, supportedtypes include single-node, master/standby, ProxyCluster, and Redis Cluster.

Specification (GB)

Specification of the chosen instance.

Used/AvailableMemory(MB)

The used memory space and maximum availablememory space of the chosen instance.The used memory space includes:● Size of data stored on the DCS instance● Size of Redis-server buffers (including client

buffer and repl-backlog) and internal datastructures

CPU |MemoryType

CPU and memory architecture of the choseninstance. This parameter is displayed only for DCSRedis instances.

Created Time at which the chosen instance started to becreated.

Run Time at which the instance was created.

Maintenance

Time range for any scheduled maintenance activitieson cache nodes of this DCS instance. To modify thetime window, click the icon.

Description Description of the chosen DCS instance. To modifythe description, click the icon.

Connection

AccessMode

Password-protected or password-free access.

ConnectionAddress

IP address and port number of the chosen instance.

Network AZ Availability zone in which the cache node runningthe selected DCS instance resides.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 69

Page 75: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Section Parameter Description

VPC VPC in which the chosen instance resides.

Subnet Subnet in which the chosen instance resides.

SecurityGroup

Security group that controls access to the choseninstance. To modify the security group, click the icon. This parameter is displayed only for DCS Redis3.0 instances. DCS for Redis 4.0 and 5.0 are basedon VPCEndpoint and do not support security groups.

InstanceTopology

- Hover over a node to view its metrics, or click theicon of a node to view its historical metrics.Topologies are supported only for master/standbyand cluster instances.

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 70

Page 76: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

3 Operation Guide

3.1 Operating DCS Instances

3.1.1 Modifying DCS Instance SpecificationsOn the DCS console, you can modify a DCS Redis or Memcached instance to thedesired specification by scaling it up or down, or upgrade such an instance fromthe single-node type to the master/standby type.

For example, you can change a single-node DCS Redis 3.0 instance of 2 GB to amaster/standby instance with another cache size.

● Instance type change

– Single-node DCS Redis 3.0 and Memcached instances can be changed tothe master/standby type, while single-node DCS Redis 4.0 and 5.0instances cannot be changed to the master/standby type.

– Master/Standby DCS Redis 3.0 instances can be changed to the ProxyCluster type, while master/standby DCS Redis 4.0 and 5.0 instancescannot be changed to the Proxy Cluster type.

If a master/standby DCS Redis 3.0 instance has multiple databases, or ifits data is not stored on DB0, the instance cannot be changed to theProxy Cluster type. A master/standby instance can be changed to theProxy Cluster type only if its data is stored and only stored on DB0.

– Cluster DCS instances cannot be changed to other types.

● Instance memory change

Table 3-1 Memory change options supported by different DCS instances

Cache Engine Single-NodeInstance

Master/StandbyInstance

Cluster Instance

Redis 3.0 Scale-up andscale-down

Scale-up andscale-down

Scale-up

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 71

Page 77: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Cache Engine Single-NodeInstance

Master/StandbyInstance

Cluster Instance

Redis 4.0 Scale-up andscale-down

Scale-up andscale-down

Scale-up

Redis 5.0 Scale-up andscale-down

Scale-up andscale-down

Scale-up

Memcached Scale-up andscale-down

Scale-up andscale-down

N/A

If your DCS instances are too old to support scale-up or scale-down, contactcustomer service to upgrade the instances.

NO TICE

● After you change the specification of a DCS cluster instance, you cannot restorethe files backed up before the modification. You are advised to back up yourdata as soon as possible after changing the specification.

● It takes 5 to 30 minutes to change the specifications of single-node or master/standby DCS instances. Changing the specification of a cluster DCS instancetakes a longer time because data must be redistributed in the cluster. Duringthe specification modification, services are interrupted for seconds. You areadvised to modify the specification during off-peak hours.

● Normally during the specification modification, single-node, master/standby,and cluster DCS instances can be read from and written into. However, writingdata into single-node or master/standby instances may be temporarilyunavailable until the specification modification is completed.

PrerequisitesThe DCS instance you want to change the specification for is in the Running state.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Choose More > Modify Specification in the same row as the DCS instance.

Step 5 On the Modify Specification page, select the desired specification.

Step 6 Click Submit.

On the displayed Background Task Management page, view the modificationstatus. For more information, see Viewing Background Tasks.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 72

Page 78: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Specification modification of a single-node or master/standby DCS instance takesabout 5 to 30 minutes to complete, while that of a cluster DCS instance takes alonger time. After an instance is successfully modified, it changes to the Runningstate.

● If the specification modification of a single-node DCS instance fails, the instance istemporarily unavailable for use. The specification remains unchanged. Somemanagement operations (such as parameter configuration and specificationmodification) are temporarily not supported. After the specification modification iscompleted in the backend, the instance changes to the new specification and becomesavailable for use again.

● If the specification modification of a master/standby or cluster DCS instance fails, theinstance is still available for use with its original specifications. Some managementoperations (such as parameter configuration, backup, restoration, and specificationmodification) are temporarily not supported. Remember not to read or write more datathan allowed by the original specifications; otherwise, data loss may occur.

● After the specification modification is successful, the new specification of the instancetakes effect.

----End

3.1.2 Starting a DCS instanceOn the DCS console, you can start one or multiple DCS instances at a time.

When a cluster instance is started, status and data are synchronized between thenodes of the instance. If a large amount of data is continuously written into theinstance before the synchronization is complete, the synchronization will beprolonged and the instance remains in the Starting state. After thesynchronization is complete, the instance enters the Running state.

ProcedureStep 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click Start in the Operation column in the row as the instance you want to start.

Step 5 In the displayed dialog box, click Yes.● It takes 1 to 30 minutes to start DCS instances.● After DCS instances are started, their statuses change from Stopped to

Running.

----End

3.1.3 Restarting DCS InstancesOn the DCS console, you can restart one or multiple DCS instances at a time.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 73

Page 79: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● After a single-node DCS instance is restarted, data will be deleted from theinstance.

● While a DCS instance is restarting, it cannot be read from or written to.● An attempt to restart a DCS instance while it is being backed up may result in a

failure.

Prerequisites

The DCS instances you want to restart are in the Running or Faulty state.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 On the Cache Manager page, select one or more DCS instances you want torestart.

Step 5 Click Restart above the DCS instance list.

Step 6 In the displayed dialog box, click Yes.

It takes 1 to 30 minutes to restart DCS instances. After DCS instances arerestarted, their status changes to Running.

● By default, only the instance process will restart. However, selecting Forced Restart willrestart the VM on which the chosen DCS instance runs.

● To restart a single instance, you can also click Restart in the same row as the instance.

----End

3.1.4 Deleting DCS InstancesOn the DCS console, you can delete one or multiple DCS instances at a time. Youcan also delete all instance creation tasks that have failed to run.

NO TICE

● After a DCS instance is deleted, the instance data will also be deleted withoutbackup.

● If the instance is in cluster mode, all cluster nodes will be deleted.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 74

Page 80: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Prerequisites● The DCS instances you want to delete have been created.

● The DCS instances you want to delete are in the Running or Faulty state.

Procedure

Deleting DCS Instances

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 On the Cache Manager page, select one or more DCS instances you want todelete.

DCS instances in the Creating or Starting state cannot be deleted.

Step 5 Choose More > Delete above the instance list.

Step 6 In the displayed dialog box, click Yes.

It takes 1 to 30 minutes to delete DCS instances.

To delete a single instance, choose Operation > More > Delete in the same row as theinstance.

----End

Deleting Instance Creation Tasks That Have Failed to Run

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

If there are DCS instances that have failed to be created, Instance CreationFailures is displayed above the instance list.

Step 4 Click the icon or the number of failed tasks next to Instance Creation Failures.

The Instance Creation Failures dialog box is displayed.

Step 5 Choose failed instance creation tasks to delete.

● To delete all failed tasks, click Delete All above the task list.

● To delete a single failed task, click Delete in the same row as the task.

----End

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 75

Page 81: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

3.1.5 Performing a Master/Standby Switchover for a DCSInstance

On the DCS console, you can manually switch the master and standby nodes of aDCS instance. This operation is used for special purposes, for example, releasing allservice connections or terminating ongoing service operations.

Only master/standby DCS Redis 3.0 or Memcached instances support a master/standby node switchover.

NO TICE

● During a master/standby node switchover, services will be interrupted for up to10 seconds. Before performing this operation, ensure that your applicationsupports connection re-establishment in case of disconnection.

● During a master/standby node switchover, a large amount of resources will beconsumed for data synchronization between the master and standby nodes.You are advised to perform this operation during off-peak hours.

● Data of the maser and standby nodes is synchronized asynchronously.Therefore, a small amount of data that is being operated on during theswitchover may be lost.

Prerequisites

The DCS instance for which you want to perform a master/standby nodeswitchover is in the Running state.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 In the Operation column of the instance, choose More > Master/StandbySwitchover.

----End

3.1.6 Clearing DCS Instance DataOn the DCS console, you can clear data only for DCS Redis 4.0 and 5.0 instances.

Clearing instance data cannot be undone and cleared data cannot berecovered. Exercise caution when performing this operation.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 76

Page 82: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

PrerequisitesThe DCS Redis 4.0 or 5.0 instance is in the Running state.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Select one or more DCS2.0 instances to clear.

Step 5 Choose More > Clear data above the instance list.

Step 6 In the displayed dialog box, click Yes.

----End

3.1.7 Exporting DCS Instance ListOn the DCS console, you can export DCS instance information in full to an Excelfile.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Filter DCS instances to find the desired DCS instance.

Step 5 Click above the instance list.

Click the export result displayed in the lower left corner of the page.

----End

3.2 Managing DCS Instances

3.2.1 Configuration Notice● In most cases, different DCS instance management operations cannot proceed

concurrently. If you initiate a new management operation while the currentoperation is in progress, the DCS console prompts you to initiate the newoperation again after the current operation is complete. DCS instancemanagement operations include:

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 77

Page 83: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

– Creating a DCS instance– Configuring parameters– Restarting a DCS instance– Changing the instance password– Resetting the instance password– Scaling, backing up, or restoring an instance

● You can restart a DCS instance while it is being backed up, but the backuptask will be forcibly interrupted and is likely to result in a backup failure.

NO TICE

In the event that a cache node of a DCS instance is faulty:● The instance remains in the Running state and you can continue to read from

and write to the instance. This is achieved thanks to the high availability ofDCS.

● Cache nodes can recover from internal faults automatically. Manual faultrecovery is also supported.

● Certain operations (such as parameter configuration, password change orresetting, backup, restoration, and specification modification) in themanagement zone are not supported during fault recovery. You can contactcustomer service or perform these operations after the cache nodes recoverfrom faults.

3.2.2 Modifying Configuration ParametersOn the DCS console, you can configure parameters for an instance to achieveoptimal DCS performance.

Prerequisites

You can modify the parameters of single-node and master/standby DCS instancesin the Running state and cannot modify those of Proxy Cluster or Redis ClusterDCS instances.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 On the Cache Manager page, click the name of the DCS instance you want toconfigure.

Step 5 On the instance details page, click the Parameters tab.

Step 6 On the Parameters tab page, click Modify.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 78

Page 84: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Step 7 Modify parameters based on your requirements.

Table 3-2 and Table 3-3 describe the parameters. In most cases, default valuesare retained.

Table 3-2 DCS Redis instance configuration parameters

Parameter Description Value Range DefaultValue

timeout The maximum amountof time (in seconds) aconnection between aclient and the DCSinstance can be allowedto remain idle before theconnection isterminated. A setting of0 means that thisfunction is disabled.

0–7200 seconds 0

appendfsync Controls how oftenfsync() transfers cacheddata to the disk. Notethat some OSs willperform a complete datatransfer but some othersonly make a "best-effort" attempt.There are three settings:no: fsync() is nevercalled. The OS will flushdata when it is ready.This mode offers thehighest performance.always: fsync() is calledafter every write to theAOF. This mode is veryslow, but also very safe.everysec: fsync() is calledonce per second. Thismode provides acompromise betweensafety and performance.

● no● always● everysec

everysec

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 79

Page 85: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Parameter Description Value Range DefaultValue

appendonly Indicates whether to logeach modification of theinstance. By default,data is written to disksasynchronously in Redis.If this function isdisabled, recently-generated data might belost in the event of apower failure. Options:yes: enabledno: disabled

● yes● no

yes

client-output-buffer-limit-slave-soft-seconds

Number of seconds thatthe output bufferremains above client-output-buffer-slave-soft-limit before theclient is disconnected.

0–60 60

client-output-buffer-slave-hard-limit

Hard limit (in bytes) onthe output buffer ofreplica clients. Once theoutput buffer exceedsthe hard limit, the clientis immediatelydisconnected.

0–17,179,869,184 1,717,986,918

client-output-buffer-slave-soft-limit

Soft limit (in bytes) onthe output buffer ofreplica clients. Once theoutput buffer exceedsthe soft limit andcontinuously remainsabove the limit for thetime specified by theclient-output-buffer-limit-slave-soft-secondsparameter, the client isdisconnected.

0–17,179,869,184 1,717,986,918

maxmemory-policy

The policy applied whenthe maxmemory limit isreached.For more informationabout this parameter,see https://redis.io/topics/lru-cache.

volatile-lruallkeys-lruvolatile-randomallkeys-randomvolatile-ttlnoeviction

noeviction

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 80

Page 86: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Parameter Description Value Range DefaultValue

lua-time-limit Maximum time allowedfor executing a Luascript (in milliseconds).

5,000 100–5,000

master-read-only

Sets the instance to beread-only. All writeoperations will fail.

● yes● no

no

maxclients The maximum numberof clients allowed to beconcurrently connectedto a DCS instance.

1,000–10,000 10,000

proto-max-bulk-len

Maximum size of asingle element request(in bytes).

1,048,576–536,870,912 536,870,912

repl-backlog-size

The replication backlogsize (bytes). The backlogis a buffer thataccumulates replica datawhen replicas aredisconnected from themaster. When a replicareconnects, a partialsynchronization isperformed tosynchronize the datathat was missed whilereplicas weredisconnected.

16,384–1,073,741,824 1,048,576

repl-backlog-ttl

The amount of time, inseconds, before thebacklog buffer isreleased, starting fromthe last a replica wasdisconnected. The value0 indicates that thebacklog is neverreleased.

0–604,800 3,600

repl-timeout Replication timeout (inseconds).

30–3,600 60

hash-max-ziplist-entries

The maximum numberof hashes that can beencoded using ziplist, adata structure optimizedto reduce memory use.

1–10,000 512

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 81

Page 87: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Parameter Description Value Range DefaultValue

hash-max-ziplist-value

The largest valueallowed for a hashencoded using ziplist, aspecial data structureoptimized for memoryuse.

1–10,000 64

set-max-intset-entries

If a set is composedentirely of strings thatare integers in radix 10within the range of 64bit signed integers, theset is encoded usingintset, a data structureoptimized for memoryuse.

1–10,000 512

zset-max-ziplist-entries

The maximum numberof sorted sets that canbe encoded using ziplist,a data structureoptimized to reducememory use.

1–10,000 128

zset-max-ziplist-value

The largest valueallowed for a sorted setencoded using ziplist, aspecial data structureoptimized for memoryuse.

1–10,000 64

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 82

Page 88: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Parameter Description Value Range DefaultValue

latency-monitor-threshold

The minimum amountof latency that will belogged as latency spikesIf this parameter is set to0, latency monitoring isdisabled. If thisparameter is set to avalue greater than 0, allevents blocking theserver for a time greaterthan the configuredvalue will be logged.By running the LATENCYcommand, you canperform operationsrelated to latencymonitoring, such asobtaining statisticaldata, and configuringand enabling latencymonitoring. For moreinformation about thelatency-monitor-threshold, visit https://redis.io/topics/latency-monitor.

0–86,400,000 ms 0

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 83

Page 89: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Parameter Description Value Range DefaultValue

notify-keyspace-events

Controls which keyspaceevents notifications areenabled for. If thisparameter is configured,the Redis Pub/Subfeature will allow clientsto receive an eventnotification when aRedis data set ismodified.

A string of differentvalues can be used toenable notifications formultiple event types:Possible values include:K: Keyspace events,published with the__keyspace@__ prefixE: Keyevent events,published with__keyevent@__ prefixg: Generic commands(non-type specific) suchas DEL, EXPIRE, andRENAME$: String commandsl: List commandss: Set commandsh: Hash commandsz: Sorted set commandsx: Expired events (eventsgenerated every time akey expires)e: Evicted events (eventsgenerated when a key isevicted frommaxmemory)For more information,see the following note.

Ex

slowlog-log-slower-than

The maximum amountof time allowed, inmicroseconds, forcommand execution. Ifthis threshold isexceeded, Redis SlowLog will record thecommand.

0–1,000,000 10,000

slowlog-max-len

The maximum allowedlength of the Redis SlowLog logs. Slow Logconsumes memory, butyou can reclaim thismemory by running theSLOWLOG RESETcommand.

0–1,000 128

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 84

Page 90: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

1. For more information about the parameters described in Table 3-2, visit https://redis.io/topics/memory-optimization.

2. The latency-monitor-threshold parameter is usually used for fault location. Afterlocating faults based on the latency information collected, change the value of latency-monitor-threshold to 0 to avoid unnecessary latency.

3. More about the notify-keyspace-events parameter:

– The parameter setting must contain at least a K or E.

– A is an alias for "g$lshzxe" and cannot be used together with any of the charactersin "g$lshzxe".

– For example, the value Kl means that Redis will notify Pub/Sub clients aboutkeyspace events and list commands. The value AKE means Redis will notifyPub/Sub clients about all events.

Table 3-3 DCS Memcached instance configuration parameters

Parameter Description Value Range DefaultValue

timeout The maximum amount oftime (in seconds) aconnection between aclient and the DCS instancecan be allowed to remainidle before the connectionis terminated. A setting of0 means that this functionis disabled.

0–7200 seconds 0

maxclients The maximum number ofclients allowed to beconcurrently connected toa DCS instance.

1,000–10,000 10,000

maxmemory-policy

The policy applied whenthe maxmemory limit isreached.For more informationabout this parameter, seehttps://redis.io/topics/lru-cache.

volatile-lruallkeys-lruvolatile-randomallkeys-randomvolatile-ttlnoeviction

noeviction

reserved-memory-percent

Percentage of themaximum availablememory reserved forbackground processes, suchas data persistence andreplication.

0–80 30

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 85

Page 91: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Step 8 After you have finished setting the parameters, click Save.

Step 9 Click Yes to confirm the modification.

----End

3.2.3 Modifying an Instance's Maintenance Time WindowOn the DCS console, after creating a DCS instance, you can modify themaintenance time window of the DCS instance on the instance's BasicInformation page.

Prerequisites

At least one DCS instance has been created.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of the DCS instance for which you want to modify themaintenance time window.

Step 5 Click the Basic Information tab. In the Instance Details area, click the iconnext to the Maintenance parameter.

Step 6 Select a new maintenance time window from the drop-down list. Click to savethe modification or to discard the modification.

The modification will take effect immediately, that is, the new maintenance timewindow will appear on the Basic Information tab page immediately.

----End

3.2.4 Modifying an Instance's Security GroupOn the DCS console, after creating a DCS instance, you can modify the securitygroup of the DCS instance on the instance's Basic Information page.

You can modify the security groups of DCS Redis 3.0 instances but cannot modifythose of DCS Redis 4.0 or 5.0 instances.

Prerequisites

At least one DCS instance has been created.

Procedure

Step 1 Log in to the DCS console.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 86

Page 92: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of the DCS instance for which you want to modify the securitygroup.

Step 5 Click the Basic Information tab. In the Network area, click next to theSecurity Group parameter.

Step 6 Select a new security group from the drop-down list. Click to save themodification or to discard the modification.

Only the security groups that have been created can be selected from the drop-down list. Ifyou need to create a security group, follow the procedure described in How to Select andConfigure a Security Group?

The modification will take effect immediately, that is, the new maintenance timewindow will appear on the Basic Information tab page immediately.

----End

3.2.5 Viewing Background TasksAfter you initiate certain instance operations such as modifying instancespecifications and changing or resetting a password, a background task will startfor the operation. On the DCS console, you can view the background task statusand clear task information by deleting task records.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of the DCS instance whose background task you want to manage.

Step 5 Click the Background Tasks tab.

A list of background tasks is displayed.

Step 6 Click , specify Start Date and End Date, and click OK to view tasks started inthe corresponding time segment.

● Click to refresh the task status.● To clear the record of a background task, choose Operation > Delete.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 87

Page 93: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

You can only delete the records of tasks in the Successful or Failed state.

----End

3.2.6 Viewing Data Storage Statistics of a Proxy ClusterInstance

You can view the data storage statistics of all nodes of a Proxy cluster instance. Ifdata storage is unevenly distributed across nodes, you can scale up the instance orclear data.

You can only view data storage statistics of Proxy Cluster instances. Instances ofother types only have one node, and you can view the used memory on theinstance details page.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of a DCS Redis cluster instance to view the basic information.

Step 5 Click the Node Management tab.

The data volume of each node in the cluster instance is displayed.

When the data storage capacity of a node in a cluster is used up, you can scale upthe instance according to Modifying DCS Instance Specifications.

----End

3.3 Backing Up and Restoring DCS Instances

3.3.1 OverviewOn the DCS console, you can back up and restore DCS instances.

Importance of DCS Instance Backup

There is a small chance that dirty data could exist in a DCS instance owing toservice system exceptions or problems in loading data from persistence files. Inaddition, some systems demand not only high reliability but also data security,data restoration, and even permanent data storage.

Currently, data in DCS instances can be backed up to OBS. If a DCS instancebecomes faulty, data in the instance can be restored from backup so that servicecontinuity is not affected.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 88

Page 94: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Backup ModesDCS instances support the following backup modes:

● Scheduled backupYou can create a scheduled backup policy on the DCS console. Then, data inthe chosen DCS instances will be automatically backed up at the scheduledtime.You can choose the days of the week on which scheduled backup will run.Backup data will be retained for a maximum of seven days. Backup data olderthan seven days will be automatically deleted.The primary purpose of scheduled backups is to create complete data replicasof DCS instances so that the instance can be quickly restored if necessary.

● Manual backupBackup requests can also be issued manually. Then, data in the chosen DCSinstances will be permanently backed up to OBS. Backup data can be deletedmanually.Before performing high-risk operations, such as system maintenance orupgrade, back up DCS instance data.

Additional Information About Data Backup● Instance type

– Redis: Only master/standby, Proxy Cluster, and Redis Cluster instances canbe backed up and restored, while single-node instances cannot. However,you can export data of a single-node instance to an RDB file using redis-cli. For details, see How Do I Export DCS Redis Instance Data?

– Memcached: Only master/standby instances can be backed up andrestored, while single-node instances cannot.

● Backup mechanismsInstance data is persisted using the Redis Append Only Files (AOF) feature.Backup tasks are run on standby cache nodes. DCS instance data is backed upby compressing and storing the data persistence files from the standby cachenode to OBS.DCS checks instance backup policies once an hour. If a backup policy ismatched, DCS runs a backup task for the corresponding DCS instance.

● Impact on DCS instances during backupBackup tasks are run on standby cache nodes, without incurring anydowntime.In the event of full-data synchronization or heavy instance load, it takes a fewminutes to complete data synchronization. If instance backup starts beforedata synchronization is complete, the backup data will be slightly behind thedata in the master cache node.During instance backup, the standby cache node stops persisting the latestchanges to disk files. If new data is written to the master cache node duringbackup, the backup file will not contain the new data.

● Backup timeIt is advisable to back up instance data during off-peak periods.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 89

Page 95: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● Storage and pricing of backup filesBackup files are stored to OBS.

● Handling exceptions in scheduled backupIf a scheduled backup task is triggered while the DCS instance is restarting orbeing scaled up, the scheduled backup task will be run in the next cycle.If backing up a DCS instance fails or the backup is postponed because anothertask is in progress, DCS will try to back up the instance in the next cycle. Amaximum of three retries are allowed within a single day.

● Retention period of backup dataScheduled backup files are retained for up to seven days. You can configurethe retention period. At the end of the retention period, most backup files ofthe DCS instance will be automatically deleted, but at least one backup filewill be retained.Manual backup files are retained permanently and need to be manuallydeleted.

Data Restoration● Data restoration process

a. You can initiate a data restoration request using the DCS console.b. DCS obtains the backup file from OBS.c. Read/write to the DCS instance is suspended.d. The original data persistence file of the master cache node is replaced by

the backup file.e. The new data persistence file (that is, the backup file) is reloaded.f. Data is restored, and the DCS instance starts to provide read/write service

again.● Impact on service systems

Restoration tasks are run on master cache nodes. During restoration, datacannot be written into or read from instances.

● Handling data restoration exceptionsIf a backup file is corrupted, DCS will try to fix the backup file while restoringinstance data. If the backup file is successfully fixed, the restoration proceeds.If the backup file cannot be fixed, the master/standby DCS instance will bechanged back to the state in which it was before data restoration.

3.3.2 Configuring a Backup PolicyOn the DCS console, you can configure an automatic backup policy. The systemthen backs up data in your instances according to the backup policy.

If automatic backup is not required, disable the automatic backup function in thebackup policy.

Prerequisites

At least one master/standby DCS instance has been created.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 90

Page 96: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

ProcedureStep 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of the DCS instance to display more details about the DCSinstance.

Step 5 On the instance details page, click Backups & Restorations.

Step 6 Slide the to the right to enable automatic backup. Backup policies will bedisplayed.

Table 3-4 Parameters in a backup policy

Parameter Description

Backup Schedule Day of a week on which data in the chosen DCS instance isautomatically backed up.You can select one or multiple days of a week.

Retention Period(days)

The number of days that automatically backed up data isretained.Backup data will be permanently deleted at the end ofretention period and cannot be restored. Value range: 1–7.

Start Time Time at which automatic backup starts. Value: the full hourbetween 00:00 to 23:00The DCS checks backup policies once every hour. If thebackup start time in a backup policy has arrived, data inthe corresponding instance is backed up.NOTE

Instance backup takes 5 to 30 minutes. The data added or modifiedduring the backup process will not be backed up. To reduce theimpact of backup on services, it is recommended that data shouldbe backed up during off-peak periods.Only instances in the Running state can be backed up.

Step 7 Click OK.

----End

3.3.3 Manually Backing Up a DCS InstanceYou need to manually back up data in DCS instances in a timely manner. Thissection describes how to manually back up data in master/standby instances usingthe DCS console.

By default, manually backed up data is permanently retained. If backup data is nolonger in use, you can delete it manually.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 91

Page 97: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Prerequisites

At least one master/standby DCS instance is in the Running state.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of the DCS instance to display more details about the DCSinstance.

Step 5 On the instance details page, click Backups & Restorations.

Step 6 Click Create Backup.

Step 7 In the Create Backup dialog box, click OK.

Information in the Description text box cannot exceed 128 bytes.

Instance backup takes 10 to 15 minutes. The data added or modified during the backupprocess will not be backed up.

----End

3.3.4 Restoring a DCS InstanceOn the DCS console, you can restore backup data to a chosen DCS instance.

Prerequisites● At least one master/standby or cluster DCS instance is in the Running state.● A backup task has been run to back up data in the instance to be restored

and the status of the backup task is succeed.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of the DCS instance to display more details about the DCSinstance.

Step 5 On the instance details page, click Backups & Restorations.

A list of historical backup tasks is then displayed.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 92

Page 98: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Step 6 Click Restore in the same row as the chosen backup task.

Step 7 Click OK to start instance restoration.

Information in the Description text box cannot exceed 128 bytes.

The Restoration History tab page displays the result of the instance restorationtask.

Instance restoration takes 5 to 30 minutes.

While being restored, DCS instances do not accept data operation requests from clientsbecause existing data is being overwritten by the backup data.

----End

3.3.5 Downloading a Backup FileDue to the limitations of automatic and manual backups (automatically backedup data can be retained for a maximum of 7 days, and manually backed up datatakes space in OBS), you should download the backup files and permanently savethem on the local host.

Only backup files of master/standby or cluster DCS Redis 3.0 instances can bedownloaded.

Prerequisites● A DCS Redis 3.0 instance has been created.● The instance has been backed up and the backup is still valid.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Click the name of the DCS instance to display more details about the DCSinstance.

Step 5 On the instance details page, click Backups & Restorations.

A list of historical backup tasks is then displayed.

Step 6 Select the historical backup data to be downloaded, and click Download.

Step 7 In the displayed, Download Backup File dialog box, select either of the followingtwo download methods.

Download methods:● By URL

a. Step 1: Set the URL validity period and click Query.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 93

Page 99: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

b. Step 2: Download the backup file by using the URL list.

If you choose to copy URLs, use quotation marks to quote the URLs whenrunning the wget command in Linux. For example:wget 'https://obsEndpoint.com:443/redisdemo.rdb?parm01=value01&parm02=value02'This is because the URL contains the special character and (&), which willconfuse the wget command. Quoting the URL facilitates URL identification.

● By OBSFollow the displayed procedure.

----End

3.4 Migrating Data with DCS

3.4.1 Introduction to Migration with DCSDCS for Redis provides the following migration modes:

● Importing data from backup files: Download the source Redis data and thenupload the data to an OBS bucket in the same region as the destination DCSRedis instance. DCS will read the backup data from the OBS bucket andmigrate the data into the destination instance.This migration mode can be used for migrating data from other Redisvendors or self-hosted Redis to DCS for Redis.

● Migrating data online: If the source and destination instances areinterconnected and the SYNC and PSYNC commands are supported in thesource instance, data can be migrated online in full or incrementally from thesource to the destination.

Table 3-5 describes data migration modes supported by DCS.

Table 3-5 DCS data migration modes

MigrationMode

Source Destination: DCS

Single-Nodeand Master/Standby

Proxy Cluster Redis Cluster

Importingbackupfiles

OBS bucket:AOF files

√ √ ×

OBS bucket:RDB files

√ √ √

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 94

Page 100: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Migrating dataonline

Public cloudRedis: single-node ormaster/standby DCSinstance

√ √ √

Public cloudRedis: ProxyCluster DCSinstance

× × ×

Public cloudRedis: RedisCluster DCSinstance

√ √ √

Self-hostedsingle-nodeor master/standby Redis

√ √ √

Self-hostedproxy-basedcluster Redis

√ √ √

Self-hostedRedis Cluster

√ √ √

Other Redis:single-nodeor master/standby

× × ×

Other Redis:proxy-basedcluster

× × ×

Other Redis:Redis Cluster

× × ×

● Public cloud Redis refers to DCS for Redis.● Self-hosted Redis refers to self-hosted Redis on the public cloud, from other cloud

vendors, or in on-premises data centers.● Other cloud Redis refers to Redis services provided by other cloud vendors.● √: Supported. ×: Not supported.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 95

Page 101: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

3.4.2 Importing Backup Files

Application Scenarios

Use the DCS console to migrate Redis data from Redis of other vendors or self-hosted Redis to DCS for Redis.

Simply download the source Redis data and then upload the data to an OBSbucket in the same region as the destination DCS Redis instance. After you havecreated a migration task on the DCS console, DCS will read data from the OBSbucket and data will be migrated to the destination instance.

.aof, .rbb, .zip, and .tar.gz files can be uploaded to OBS buckets. You can directlyupload .aof and .rdb files or compress them into .zip or .tar.gz files beforeuploading.

Prerequisites● The OBS bucket must be in the same region as the destination DCS Redis

instance.● The data files to be uploaded must be in the .aof, .rdb, .zip, or .tar.gz format.● To migrate data from a single-node or master/standby Redis instance of other

cloud vendors, create a backup task and download the backup file.● To migrate data from a cluster Redis instance of other cloud vendors,

download all backup files and upload all of them to the OBS bucket. Eachbackup file contains data for a shard of the instance.

● .rdb backup files of self-hosted Redis 5.0 cannot be imported. .rdb backup filesof self-hosted Redis 3.0 or 4.0 can be exported using redis-cli. .rdb files ofother cloud Redis can be exported only by creating backup tasks, and cannotbe exported by running commands in redis-cli.

● Redis Cluster instances only support .rdb files and do not support .aof files.

Step 1: Prepare the Destination DCS Redis Instance● If a destination DCS Redis instance is not available, create one first. For

details, see Creating a DCS Redis Instance.The password for the destination instance cannot contain the followingspecial characters: `~!@#$^&*()-_=+\|{}:,<.>/?

● If a DCS Redis instance is available, you do not need to create a new one.However, the following operations must be performed before the migration:

a. Clear the instance data following instructions in Clearing DCS InstanceData.

b. Check whether the instance password meets complexity requirements.The password for the destination instance cannot contain the followingspecial characters: `~!@#$^&*()-_=+\|{}:,<.>/?If any of these characters is present in your password, change thepassword to meet complexity requirements. For details on how to changethe instance password, see Changing Instance Passwords.

You can use a DCS Redis 3.0, 4.0, or 5.0 instance as the destination instance.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 96

Page 102: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Step 2: Create an OBS Bucket and Upload Backup Files

Step 1 Create an OBS bucket.

1. Log in to the OBS Console and click Create Bucket.2. Select a region.

The OBS bucket must be in the same region as the destination DCS Redisinstance.

3. Specify Bucket Name.The bucket name must meet the naming rules specified on the console.

4. Set Storage Class to Standard or Infrequent Access.Do not select Archive. Otherwise, the migration will fail.

5. Set Bucket Policy to Private, Public Read, or Public Read and Write.6. Specify Multiple AZ Mode and Tags as instructed.7. Click Create Now.

Step 2 Upload the backup data files to the OBS bucket.

If the backup file to be uploaded is smaller than 50 MB, go to step Step 3 toupload the file using the OBS console.

If the backup file to be uploaded is larger than 50 MB, perform the following stepsto upload the file using OBS Browser.

1. Configure user permissions.For details, see the OBS Console Operation Guide > Getting Started >Configuring User Permissions.

2. Download OBS Browser.For details, see the OBS Browser Operation Guide > Getting Started >Downloading OBS Browser.

3. Create access keys (AK and SK).For details, see the OBS Browser Operation Guide > Getting Started >Creating Access Keys (AK and SK).

4. Log in to OBS Browser.For details, see the OBS Browser Operation Guide > Getting Started > LoggingIn to OBS Browser.

5. Add a bucket.For details, see the OBS Browser Operation Guide > Getting Started > Addinga Bucket.

6. Upload backup data.For details, see the OBS Browser Operation Guide > Getting Started >Uploading a File or Folder.

Step 3 On the OBS console, upload the backup data files to the OBS bucket.

The following steps are applicable if the backup files are smaller than 50 MB.

1. In the bucket list, click the name of the created bucket.2. In the navigation pane, choose Objects.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 97

Page 103: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

3. On the Objects tab page, click Upload Object.

4. If Upload Mode is set to Batch, a maximum of 100 files can be uploaded at atime. The total size cannot exceed 5 GB.

To upload objects, drag files or folders to the Upload Object area or click addfile.

5. If Upload Mode is set to Single, upload a single file at a time. The maximumsize of the file is 50 MB.

Click to open the local file browser, select the file to be uploaded, andclick Open.

6. Specify Storage Class.

Do not select Archive. Otherwise, the migration will fail.

7. (Optional) Select KMS encryption to encrypt the file you want to upload.

KMS encryption is not supported when a local backup file is uploaded to anOBS bucket.

8. Click Upload.

----End

Step 3: Create a Migration Task

Step 1 Log in to the DCS console.

Step 2 In the navigation pane, choose Data Migration.

Step 3 Click Create Migration Task.

Step 4 Specify Task Name and Description.

Step 5 Set Migration Mode to Import backup file.

Data Source is automatically set to OBS bucket.

Step 6 For OBS Bucket, select the OBS bucket to which you have uploaded backup files.

In the Backup Files table, the files you have uploaded are displayed.

You can upload files in the .aof, .rdb, .zip, or .tar.gz format.

Step 7 Select the backup files whose data is to be migrated.

Step 8 Select the destination instance created in Step 1: Prepare the Destination DCSRedis Instance.

Step 9 Enter the password of the destination instance. Click Test Connection to verify thepassword.

Step 10 Click Next.

Step 11 Confirm the migration task details and click Submit.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 98

Page 104: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Go back to the data migration task list. After the migration is successful, the taskstatus changes to Successful.

----End

3.4.3 Migrating Data Online

Application Scenarios

If the source and destination instances are interconnected and the SYNC andPSYNC commands are supported in the source instance, data can be migratedonline in full or incrementally from the source to the destination.

Prerequisites

Before migrating data, read through Introduction to Migration with DCS to learnabout the DCS data migration function and select an appropriate destinationinstance.

Step 1: Obtain the Source Instance Address

Step 1 Log in to the DCS console.

Step 2 Confirm the type and version of the source instance.

Step 3 On the details page of the source instance, obtain the connection address (IPaddress:port) of instance.

Step 4 Check whether the instance password meets complexity requirements.

The password for the source instance cannot contain the following specialcharacters: `~!@#$^&*()-_=+\|{}:,<.>/?

If any of these characters is present in your password, change the password tomeet complexity requirements. For details on how to change the instancepassword, see Changing Instance Passwords.

----End

Step 2: Prepare the Destination DCS Redis Instance● If a destination DCS Redis instance is not available, create one first. For

details, see Creating a DCS Redis Instance.The password for the destination instance cannot contain the followingspecial characters: `~!@#$^&*()-_=+\|{}:,<.>/?

● If a destination instance is available, you do not need to create a new one.However, the following operations must be performed before the migration:

a. Clear the instance data following instructions in Clearing DCS InstanceData.

b. Check whether the instance password meets complexity requirements.The password for the destination instance cannot contain the followingspecial characters: `~!@#$^&*()-_=+\|{}:,<.>/?

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 99

Page 105: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

If any of these characters is present in your password, change thepassword to meet complexity requirements. For details on how to changethe instance password, see Changing Instance Passwords.

Step 3: Check the Network Between the Source and Destination Instances

Step 1 Check whether the source and destination instances are in the same VPC.

If yes, go to Step 4: Create a Migration Task. If no, go to Step 2.

Step 2 Check whether the VPCs of the source and destination instances are connected.

If yes, go to Step 1. If no, create a VPC peering connection. For details, see "VPCPeering Connection" section in the VPC User Guide.

----End

Step 4: Create a Migration Task

Step 1 Log in to the DCS console.

Step 2 In the navigation pane, choose Data Migration.

Step 3 Click Create Migration Task.

Step 4 Specify Task Name and Description.

Step 5 Set Migration Mode to Migrate data online.

Step 6 Specify Migration Type.

Supported migration types are Full and Full+incremental, which are described inTable 3-6.

Table 3-6 Migration type description

Migration Type Description

Full Suitable for scenarios where services can be interrupted.Data is migrated at one time. Source instance dataupdated during the migration will not be migrated to thedestination instance.

Full+incremental Suitable for scenarios requiring minimal servicedowntime. The incremental migration parses logs toensure data consistency between the source anddestination instances.You can manually stop an ongoing migration.

Step 7 Enter the source instance address obtained in Step 1: Obtain the Source InstanceAddress.

Set Source Redis Type to either of the following:

● Intra-VPC Redis: The source Redis and the destination instance are in thesame VPC.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 100

Page 106: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● Self-hosted Redis using Direct Connect or VPN connection: The sourceRedis and the destination instance are interconnected through VPNconnection or Direct Connect connection.

Step 8 For Destination Instance, select the DCS Redis Instance prepared in Step 2:Prepare the Destination DCS Redis Instance.

If the instance is password-protected, you can click Test Connection to checkwhether the instance password meets the requirements.

Step 9 Click Next.

Step 10 Confirm the migration task details and click Submit.

Go back to the data migration task list. After the migration is successful, the taskstatus changes to Successful.

If the migration type is full+incremental, the migration task status will remain Migratinguntil you click Stop.

----End

3.5 Managing Passwords

3.5.1 DCS Instance PasswordsPasswords can be configured to control access to your DCS instances, ensuring thesecurity of your data.

Using Passwords Securely1. Hide the password when using redis-cli.

If the -a <password> option is used in redis-cli in Linux, the password is proneto leakage because it is logged and kept in the history. You are advised not touse -a <password> when running commands in redis-cli. After connecting toRedis, run the auth command to complete authentication as shown in thefollowing example:$ redis-cli -h 192.168.0.148 -p 6379redis 192.168.0.148:6379>auth yourPasswordOKredis 192.168.0.148:6379>

2. Use interactive password authentication or switch between users withdifferent permissions.If the script involves DCS instance access, use interactive passwordauthentication. To enable automatic script execution, manage the script asanother user and authorize execution using sudo.

3. Use an encryption module in your application to encrypt the password.

3.5.2 Changing Instance PasswordsOn the DCS console, you can change the password required for accessing yourDCS instance.

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 101

Page 107: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● The DCS instance for which you want to change the password is in the Running state.● The new password will not take effect in the client until the client is restarted.

PrerequisitesAt least one DCS instance has been created.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 Choose More > Change Password in the same row as the chosen instance.

Step 5 In the displayed dialog box, set Old Password, New Password, and ConfirmPassword.

After 5 consecutive incorrect password attempts, the account for accessing the chosen DCSinstance will be locked for 5 minutes. Passwords cannot be changed during the lockoutperiod.The password must meet the following complexity requirements:● Cannot be left blank.● Must be 8 to 32 characters long.● Contains at least three of the following character types:

– Lowercase letters– Uppercase letters– Digits– Special characters (`~!@#$%^&*()-_=+\|[{}]:'",<.>/?)

Step 6 In the Change Password dialog box, click OK to confirm the password change.

----End

Distributed Cache ServiceUser Guide 3 Operation Guide

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 102

Page 108: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

4 Monitoring

4.1 DCS Metrics

IntroductionThis section describes DCS metrics reported to Cloud Eye as well as theirnamespaces and dimensions. You can use the Cloud Eye console or call APIs toquery the DCS metrics and alarms.

NamespaceSYS.DCS

DCS Redis 3.0 Instance Metrics

The Monitored Objects and Dimensions column lists instances and dimensions thatsupport the corresponding metrics.

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 103

Page 109: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 4-1 DCS Redis 3.0 instance metrics

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

cpu_usage CPUUsage

CPU consumed bythe monitored objectUnit: %

0–100%

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

memory_usage

Memory Usage

Memory consumedby the monitoredobjectUnit: %

0–100%

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

net_in_throughput

Network InputThroughput

Inbound throughputper second on a portUnit: byte/s

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 104

Page 110: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

net_out_throughput

NetworkOutputThroughput

Outboundthroughput persecond on a portUnit: byte/s

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

connected_clients

ConnectedClients

Number ofconnected clients(excluding thosefrom slave nodes)

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

client_longest_out_list

ClientLongestOutputList

Longest output listamong current clientconnections

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

client_biggest_in_buf

ClientBiggestInputBuf

Maximum input datalength amongcurrent clientconnectionsUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 105

Page 111: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

blocked_clients

BlockedClients

Number of clientssuspended by blockoperations such asBLPOP, BRPOP, andBRPOPLPUSH

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory

UsedMemory

Number of bytesused by the RedisserverUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory_rss

UsedMemory RSS

Resident set size(RSS) memory thatthe Redis server hasused, which is thememory that actuallyresides in thememory, including allstack and heapmemory but notswapped-outmemoryUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 106

Page 112: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

used_memory_peak

UsedMemory Peak

Peak memoryconsumed by Redissince the Redis serverlast startedUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory_lua

UsedMemory Lua

Number of bytesused by the LuaengineUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

memory_frag_ratio

MemoryFragmentationRatio

Current memoryfragmentation, whichis the ratio betweenused_memory_rss/used_memory.

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

total_connections_received

NewConnections

Number ofconnections receivedduring themonitoring period

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 107

Page 113: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

total_commands_processed

CommandsProcessed

Number ofcommands processedduring themonitoring period

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

instantaneous_ops

Ops perSecond

Number ofcommands processedper second

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

total_net_input_bytes

Network InputBytes

Number of bytesreceived during themonitoring periodUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

total_net_output_bytes

NetworkOutputBytes

Number of bytessent during themonitoring periodUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 108

Page 114: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

instantaneous_input_kbps

InputFlow

Instantaneous inputtrafficUnit: kbit/s

≥ 0kbits/s

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

instantaneous_output_kbps

OutputFlow

Instantaneous outputtrafficUnit: kbit/s

≥ 0kbits/s

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

rejected_connections

RejectedConnections

Number ofconnections thathave exceededmaxclients and beenrejected during themonitoring period

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

expired_keys

ExpiredKeys

Number of keys thathave expired andbeen deleted duringthe monitoringperiod

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 109

Page 115: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

evicted_keys

EvictedKeys

Number of keys thathave been evictedand deleted duringthe monitoringperiod

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

keyspace_hits

Keyspace Hits

Number of successfullookups of keys inthe main dictionaryduring themonitoring period

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

keyspace_misses

KeyspaceMisses

Number of failedlookups of keys inthe main dictionaryduring themonitoring period

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

pubsub_channels

PubSubChannels

Number of Pub/Subchannels

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 110

Page 116: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

pubsub_patterns

PubSubPatterns

Number of Pub/Subpatterns

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

keyspace_hits_perc

HitRate

Ratio of the numberof Redis cache hits tothe number oflookupsUnit: %

0–100%

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

keys Keys Number of keys inRedis

≥ 0 Monitoredobject:Single-node ormaster/standbyDCS RedisinstanceDimension:dcs_instance_id

1minute

DCS Redis 4.0 and 5.0 Instance Metrics

The Monitored Objects and Dimensions column lists instances and dimensions thatsupport the corresponding metrics.

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 111

Page 117: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Table 4-2 DCS Redis 4.0 and 5.0 instance metrics

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

cpu_usage CPUUsage

CPU consumed bythe monitored objectUnit: %

0–100%

Monitoredobject:Single-node ormaster/standby DCSRedis instanceDimension:dcs_instance_id

1minute

memory_usage

Memory Usage

Memory consumedby the monitoredobjectUnit: %

0–100%

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

connected_clients

ConnectedClients

Number ofconnected clients(excluding thosefrom slave nodes)

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 112

Page 118: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

blocked_clients

BlockedClients

Number of clientssuspended by blockoperations

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory

UsedMemory

Total number ofbytes used by theRedis serverUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory_rss

UsedMemory RSS

Resident set size(RSS) memory thatthe Redis server hasused, which is thememory thatactually resides inthe memory,including all stackand heap memorybut not swapped-outmemoryUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 113

Page 119: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

used_memory_peak

UsedMemory Peak

Peak memoryconsumed by Redissince the Redisserver last startedUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory_lua

UsedMemory Lua

Number of bytesused by the LuaengineUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

memory_frag_ratio

MemoryFragmentationRatio

Ratio between UsedMemory RSS andUsed Memory

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

total_connections_received

NewConnections

Number ofconnections receivedduring themonitoring period

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 114

Page 120: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

instantaneous_ops

Ops perSecond

Number ofcommandsprocessed per second

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

instantaneous_input_kbps

InputFlow

Instantaneous inputtrafficUnit: KB/s

≥ 0KB/s

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

instantaneous_output_kbps

OutputFlow

Instantaneousoutput trafficUnit: KB/s

≥ 0KB/s

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

expired_keys ExpiredKeys

Number of keys thathave expired andbeen deleted duringthe monitoringperiod

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 115

Page 121: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

evicted_keys EvictedKeys

Number of keys thathave been evictedand deleted duringthe monitoringperiod

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

keyspace_misses

KeyspaceMisses

Number of failedlookups of keys inthe main dictionaryduring themonitoring period

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

pubsub_channels

PubSubChannels

Number of Pub/Subchannels

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

pubsub_patterns

PubSubPatterns

Number of Pub/Subpatterns

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 116

Page 122: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

keyspace_hits_perc

HitRate

Ratio of the numberof Redis cache hitsto the number oflookupsUnit: %

0–100%

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory_dataset

UsedMemoryDataset

Dataset memorythat the Redis serverhas usedUnit: byte

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

used_memory_dataset_perc

UsedMemoryDatasetRatio

Percentage ofdataset memory thatthe Redis server hasusedUnit: %

0–100%

Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

keys Keys Number of keys inRedis

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 117

Page 123: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

expires KeysWith anExpiration

Number of keys withan expiration inRedis

≥ 0 Monitoredobject:Single-node,master/standby, orcluster DCSRedis instanceDimension:dcs_instance_id

1minute

DCS Memcached Instance Metrics

Table 4-3 DCS Memcached instance metrics

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

cpu_usage CPUUsage

CPU consumedby the monitoredobjectUnit: %

0–100% Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 118

Page 124: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

memory_usage

MemoryUsage

Memoryconsumed by themonitored objectUnit: %

0–100% Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

net_in_throughput

NetworkInputThroughput

Inboundthroughput persecond on a portUnit: byte/s

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

net_out_throughput

NetworkOutputThroughput

Outboundthroughput persecond on a portUnit: byte/s

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_connected_clients

Connected Clients

Number ofconnected clients(excluding thosefrom slavenodes)

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 119

Page 125: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_used_memory

UsedMemory

Number of bytesused byMemcachedUnit: byte

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_used_memory_rss

UsedMemoryRSS

RSS memoryused is thememory thatactually residesin the memory,including allstack and heapmemory but notswapped-outmemoryUnit: byte

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_used_memory_peak

UsedMemoryPeak

Peak memoryconsumed sincethe server laststartedUnit: byte

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_memory_frag_ratio

MemoryFragmentationRatio

Current memoryfragmentation,which is the ratiobetweenused_memory_rss/used_memory.

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 120

Page 126: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_connections_received

NewConnections

Number ofconnectionsreceived duringthe monitoringperiod

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_commands_processed

CommandsProcessed

Number ofcommandsprocessed duringthe monitoringperiod

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_instantaneous_ops

Ops perSecond

Number ofcommandsprocessed persecond

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_net_input_bytes

NetworkInputBytes

Number of bytesreceived duringthe monitoringperiodUnit: byte

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 121

Page 127: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_net_output_bytes

NetworkOutputBytes

Number of bytessent during themonitoringperiodUnit: byte

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_instantaneous_input_kbps

InputFlow

Instantaneousinput trafficUnit: KB/s

≥ 0 KB/s Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_instantaneous_output_kbps

OutputFlow

Instantaneousoutput trafficUnit: KB/s

≥ 0 KB/s Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_rejected_connections

RejectedConnections

Number ofconnections thathave exceededmaxclients andbeen rejectedduring themonitoringperiod

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 122

Page 128: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_expired_keys

ExpiredKeys

Number of keysthat have expiredand been deletedduring themonitoringperiod

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_evicted_keys

EvictedKeys

Number of keysthat have beenevicted anddeleted duringthe monitoringperiod

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_cmd_get

NumberofRetrievalRequests

Number ofreceived dataretrieval requests

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_cmd_set

NumberofStorageRequests

Number ofreceived datastorage requests

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 123

Page 129: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_cmd_flush

Numberof FlushRequests

Number ofreceived dataclearancerequests

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_cmd_touch

Numberof TouchRequests

Number ofreceived requestsfor modifying thevalidity period ofdata

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_get_hits

NumberofRetrievalHits

Number ofsuccessful dataretrievaloperations

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_get_misses

NumberofRetrievalMisses

Number of faileddata retrievaloperations due tokey nonexistence

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 124

Page 130: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_delete_hits

Numberof DeleteHits

Number ofsuccessful datadeletionoperations

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_delete_misses

Numberof DeleteMisses

Number of faileddata deletionoperations due tokey nonexistence

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_incr_hits

NumberofIncrement Hits

Number ofsuccessfulincrementoperations

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_incr_misses

NumberofIncrement Misses

Number of failedincrementoperations due tokey nonexistence

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 125

Page 131: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_decr_hits

NumberofDecrement Hits

Number ofsuccessfuldecrementoperations

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_decr_misses

NumberofDecrement Misses

Number of faileddecrementoperations due tokey nonexistence

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_cas_hits

Numberof CASHits

Number ofsuccessful CASoperations

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_cas_misses

Numberof CASMisses

Number of failedCAS operationsdue to keynonexistence

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 126

Page 132: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_cas_badval

Numberof CASValuesNotMatched

Number of failedCAS operationsdue to CAS valuemismatch

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_touch_hits

Numberof TouchHits

Number ofsuccessfulrequests formodifying thevalidity period ofdata

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_touch_misses

Numberof TouchMisses

Number of failedrequests formodifying thevalidity period ofdata due to keynonexistence

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_auth_cmds

AuthenticationRequests

Number ofauthenticationrequests

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 127

Page 133: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_auth_errors

AuthenticationFailures

Number of failedauthenticationrequests

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_curr_items

Numberof ItemsStored

Number ofstored data items

≥ 0 Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_command_max_delay

MaximumCommand Latency

Maximumlatency ofcommandsUnit: ms

≥ 0 ms Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

mc_is_slow_log_exist

SlowQueryLogs

Existence of slowquery logs in theinstance

● 1: yes● 0: no

Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 128

Page 134: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Metric ID Metric Description ValueRange

MonitoredObject andDimension

MonitoringPeriod(RawData)

mc_keyspace_hits_perc

Hit Rate Ratio of thenumber ofMemcachedcache hits to thenumber oflookupsUnit: %

0–100% Monitoredobject:DCS MemcachedinstanceDimension:dcs_memcached_instance_id

1minute

Dimensions

Key Value

dcs_instance_id DCS Redis instance

dcs_memcached_instance_id DCS Memcached instance

4.2 Viewing DCS Monitoring MetricsThe public cloud platform provides the Cloud Eye service, which monitors therunning status of your DCS instances.

Procedure

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 In the same row as the DCS instance whose metrics you want to view, chooseMore > View Metric.

On the displayed Cloud Eye console, you can view all the metrics of the instance.

----End

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 129

Page 135: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

4.3 Setting Alarm Rules for Critical MetricsAs listed in DCS Metrics, Cloud Eye monitors a wide variety of DCS metrics.

Among all the metrics, the ones listed in the following table are of particularimportance. Configure alarm rules for these metrics to be notified immediatelyafter the set thresholds are reached.

Table 4-4 Metrics to set alarm rules for

Metric ID Metric RecommendedThreshold

Description

cpu_usage

CPU Usage 80 CPU consumed by the monitored objectThe recommended threshold indicatesthat an alarm will be triggered when theCPU usage of the instance reaches 80%for the set number of consecutiveperiods during the monitoring period.For example, an alarm may be triggeredif the average CPU usage ≥ 80% for 3consecutive periods of 1 minute.

memory_usage

MemoryUsage

80 Memory consumed by the monitoredobjectThe recommended threshold indicatesthat an alarm will be triggered when thememory usage of the instance reaches80% for the set number of consecutiveperiods during the monitoring period.For example, an alarm may be triggeredif the average memory usage ≥ 80% for3 consecutive periods of 1 minute.

connected_clients

ConnectedClients

8,000 Number of connected clients (excludingthose to standby nodes)The minimum threshold is 8,000. Set thethreshold to 80% of the maximumallowed connections indicated in theinstance specifications. For details, seeDCS Instance Specifications.For example, an alarm may be triggeredif the average number of connectedclients ≥ 8,000 for 3 consecutive periodsof 1 minute.

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 130

Page 136: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Procedure

In the following example, an alarm rule is set for the CPU Usage metric.

Step 1 Log in to the DCS console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 In the navigation pane, choose Cache Manager.

Step 4 In the same row as the DCS instance whose metrics you want to view, chooseMore > View Metric.

Figure 4-1 Viewing instance metrics

Step 5 Locate the CPU Usage metric. Hover over the metric and click to create analarm rule for the metric.

The Create Alarm Rule page is displayed.

Step 6 Specify the alarm information.

1. Specify the alarm policy and alarm severity.For example, the alarm policy shown in Figure 4-2 indicates that an alarmwill be triggered if the CPU usage exceeds the threshold for two consecutiveperiods.

Figure 4-2 Setting the alarm content

2. Set Alarm Notification configurations. If you enable Alarm Notification, setthe validity period, notification object, and trigger condition.

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 131

Page 137: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

3. Click Next.4. Under Specify Rules Name, set the alarm name and description.5. Click Create.

For more information about creating alarm rules, see the Cloud Eye User Guide >Using the Alarm Function > Creating Alarm Rules.

----End

Distributed Cache ServiceUser Guide 4 Monitoring

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 132

Page 138: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

5 Auditing

5.1 Operations That Can Be Recorded by CTSWith CTS, you can query, audit, and review operations performed on cloudresources. Traces include the operation requests sent using the managementconsole or open APIs as well as the results of these requests.

The following lists the DCS operations that can be recorded by CTS.

Table 5-1 DCS operations that can be recorded by CTS

Operation ResourceType

Trace Name

Creating aninstance

DCS createDCSInstance

Submittingan instancecreationrequest

DCS submitCreateDCSInstanceRequest

Deletingmultipleinstances

DCS batchDeleteDCSInstance

Deleting aninstance

DCS deleteDCSInstance

Modifyinginstanceinformation

DCS modifyDCSInstanceInfo

Modifyinginstanceconfigurations

DCS modifyDCSInstanceConfig

Distributed Cache ServiceUser Guide 5 Auditing

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 133

Page 139: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Operation ResourceType

Trace Name

Changinginstancepassword

DCS modifyDCSInstancePassword

Restartingan instance

DCS restartDCSInstance

Submittingan instancerestartingrequest

DCS submitRestartDCSInstanceRequest

Starting aninstance

DCS startDCSInstance

Submittingan instancestartingrequest

DCS submitStartDCSInstanceRequest

Clearinginstancedata

DCS flushDCSInstance

Restartinginstances inbatches

DCS batchRestartDCSInstance

Submitting arequest torestartinstances inbatches

DCS submitBatchRestartDCSInstanceRequest

Startingmultipleinstances

DCS batchStartDCSInstance

Submitting arequest tostartinstances inbatches

DCS submitBatchStartDCSInstanceRequest

Restoringinstancedata

DCS restoreDCSInstance

Submitting arequest torestoreinstancedata

DCS submitRestoreDCSInstanceRequest

Distributed Cache ServiceUser Guide 5 Auditing

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 134

Page 140: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Operation ResourceType

Trace Name

Backing upinstancedata

DCS backupDCSInstance

Submitting arequest toback upinstancedata

DCS submitBackupDCSInstanceRequest

Deletinginstancebackup files

DCS deleteInstanceBackupFile

Deletingbackgroundtasks

DCS deleteDCSInstanceJobRecord

Modifyinginstancespecifications

DCS modifySpecification

Submitting arequest tomodifyinstancespecifications

DCS submitModifySpecificationRequest

Creating aninstancesubscriptionorder

DCS createInstanceOrder

Switchingbetweenmaster andstandbynodes

DCS masterStandbySwitchover

Resettinginstancepassword

DCS resetDCSInstancePassword

Submitting arequest toclearinstancedata

DCS submitFlushDCSInstanceRequest

Distributed Cache ServiceUser Guide 5 Auditing

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 135

Page 141: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Operation ResourceType

Trace Name

AccessingWeb CLI

DCS webCliLogin

Runningcommandsin Web CLI

DCS webCliCommand

Exiting WebCLI

DCS webCliLogout

5.2 Viewing Traces on the CTS ConsoleAfter CTS is enabled, the tracker starts recording operations on cloud resources.Operation records for the last seven days can be viewed on the CTS console. Thissection describes how to query operation records of the last seven days on the CTSconsole.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a regionand a project.

Select the same region as your application service.

Step 3 Click Service List and choose Management & Deployment > Cloud TraceService.

Step 4 In the navigation pane, click Trace List.

Step 5 Specify the filters used for querying traces. The following filters are available:● Search By:

Select an option from the drop-down list. Select DCS from the Trace Sourcedrop-down list.When you select Trace name, you also need to select a specific trace name.When you select Resource ID, you also need to select a specific resource ID.When you select Resource name, you also need to select a specific resourcename.

● Operator: Select a specific operator (a user other than tenant).● Trace Status: Available options include All trace status, normal, warning,

and incident. You can select only one of them.● Start time and end time: You can specify the time period in which to query

traces.

Distributed Cache ServiceUser Guide 5 Auditing

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 136

Page 142: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Step 6 Click on the left of a trace to expand its details, as shown in Figure 5-1.

Figure 5-1 Expanding trace details

Step 7 Click View Trace in the Operation column. In the dialog box shown in Figure 5-2,the trace structure details are displayed.

Figure 5-2 Viewing traces

----End

Distributed Cache ServiceUser Guide 5 Auditing

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 137

Page 143: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

6 FAQs

6.1 Client and Network ConnectionThis section provides solutions to common problems related to client connectionto DCS instances.

● Does DCS Support Public Access?● Does DCS Support Cross-VPC Access?● Why Does a Redis Cluster DCS Instance Fail to Be Pinged?● What Should I Do If Access to DCS Fails After Server Disconnects?● Why Do Requests Sometimes Time Out in Clients?● What Should I Do If an Error Is Returned When I Use the Jedis Connection

Pool?● Why Is "ERR unknown command" Displayed When I Access a DCS Redis

Instance Through a Redis Client?● How Do I Access a DCS Redis Instance Through Redis Desktop Manager?● What If "ERR Unsupported CONFIG subcommand" is Displayed in Spring

Cloud?● How Do I Troubleshoot Redis Connection Failures?● What Should I Pay Attention to When Using Redis for Pub/Sub?

Does DCS Support Public Access?No. To ensure security, the ECS that serves as a client and the DCS instance thatthe client will access must belong to the same VPC.

In the application development and debugging phase, you can also use an SSHagent to access DCS instances in the local environment.

Does DCS Support Cross-VPC Access?Cross-VPC means the client and the instance are not in the same VPC.

Generally, VPCs are isolated from each other and ECSs cannot access DCSinstances that belong to a different VPC from these ECSs.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 138

Page 144: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

However, by establishing VPC peering connections between VPCs, ECSs can accesssingle-node and master/standby DCS instances across VPCs.

When using VPC peering connections to access DCS instances across VPCs, adhereto the following rules:

● If network segments 172.16.0.0/12 to 172.16.0.0/24 are used during DCSinstance creation, the client cannot be in any of the following networksegments: 192.168.1.0/24, 192.168.2.0/24, and 192.168.3.0/24.

● If network segments 192.168.0.0/16 to 192.168.0.0/24 are used during DCSinstance creation, the client cannot be in any of the following networksegments: 172.31.1.0/24, 172.31.2.0/24, and 172.31.3.0/24.

● If network segments 10.0.0.0/8 to 10.0.0.0/24 are used during DCS instancecreation, the client cannot be in any of the following network segments:172.31.1.0/24, 172.31.2.0/24, and 172.31.3.0/24.

For more information about VPC peering connection, see "VPC PeeringConnection" in the Virtual Private Cloud User Guide.

NO TICE

Cluster DCS Redis instances do not support cross-VPC access. ECSs in a VPC cannotaccess cluster DCS instances in another VPC by using VPC peering connections.

Why Does a Redis Cluster DCS Instance Fail to Be Pinged?The PING command is disabled on the Redis node.

What Should I Do If Access to DCS Fails After Server Disconnects?Analysis: If persistent connections ("pconnect" in Redis) or connection pooling isused and connections are closed after being used for connecting to DCS instances,errors will be returned at attempts to reuse the connections.

Solution: When using pconnect or connection pooling, do not close the connectionafter the end of a request. If the connection is dropped, re-establish it.

Why Do Requests Sometimes Time Out in Clients?Occasional timeout errors are normal because of network connectivity and clienttimeout configurations.

You are advised to include reconnection operations into your service code to avoidservice failure if a single request fails.

If timeout errors occur frequently, contact O&M personnel.

What Should I Do If an Error Is Returned When I Use the Jedis ConnectionPool?

The error message that will possibly be displayed when you use the Jedisconnection pool is as follows:

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 139

Page 145: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

If this error message is displayed, check whether your instance is running properly.If it is running properly, perform the following checks:

Step 1 Check the network.

1. Check the IP address configuration.Check whether the IP address configured on the Jedis client is the same as thesubnet address configured for your DCS instance.

2. Test the network.Use the ping command and telnet on the client to test the network.– If the network cannot be pinged:

For intra-VPC access, ensure that the client and your DCS instance belongto the same VPC and security group, or the security group of your DCSinstance allows access through port 6379. For details, see Security GroupConfigurations.

– If the IP address can be pinged but telnet failed, restart your instance. Ifthe problem persists after the restart, contact customer service.

Step 2 Check the number of connections.

Check whether the number of established network connections exceeds the upperlimit configured for the Jedis connection pool. If the number of establishedconnections approaches the configured upper limit, restart the DCS service andcheck whether the problem persists. If the number of established connections isfar from the upper limit, continue with the following checks.

In Unix or Linux, run the following command to query the number of establishednetwork connections:

netstat -an | grep 6379 | grep ESTABLISHED | wc -l

In Windows, run the following command to query the number of establishednetwork connections:

netstat -an | find "6379" | find "ESTABLISHED" /C

Step 3 Check the JedisPool code.

If the number of established connections approaches the upper limit, determinewhether the problem is caused by service concurrency or incorrect usage ofJedisPool.

When using JedisPool, you must call jedisPool.returnResource() or jedis.close()(recommended) to release the resources after you call jedisPool.getResource().

Step 4 Check the number of TIME_WAIT connections.

Run the ss -s command to check whether there are too many TIME_WAITconnections on the client.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 140

Page 146: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

If there are too many TIME_WAIT connections, modify the kernel parameters byrunning the /etc/sysctl.conf command as follows:

##Uses cookies to prevent some SYN flood attacks when the SYN waiting queue overflows.net.ipv4.tcp_syncookies = 1##Reuses TIME_WAIT sockets for new TCP connections.net.ipv4.tcp_tw_reuse = 1##Enables quick reclamation of TIME_WAIT sockets in TCP connections.net.ipv4.tcp_tw_recycle = 1##Modifies the default timeout time of the system.net.ipv4.tcp_fin_timeout = 30

After the modification, run the /sbin/sysctl -p command for the modification totake effect.

Step 5 If the problem persists after you perform the preceding checks, perform thefollowing steps.

Capture packets and send packet files along with the time and description of theexception to customer service for analysis.

Run the following command to capture packets:

tcpdump -i eth0 tcp and port 6379 -n -nn -s 74 -w dump.pcap

In Windows, you can also install the Wireshark tool to capture packets.

Change the NIC name to the actual one.

----End

Why Is "ERR unknown command" Displayed When I Access a DCS RedisInstance Through a Redis Client?

Possible causes and solutions:

1. The command is spelled incorrectly.As shown in the following figure, the error message is returned because thecorrect command for deleting a string should be del.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 141

Page 147: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

2. A command available in a higher Redis version is run in a lower version Redis.As shown in the following figure, the error message is returned because aStream command (available in Redis 5.0) is run in Redis 3.0.

3. Some commands are disabled.DCS Redis instance interfaces are fully compatible with the open-source Redisin terms of data access. However, for ease of use and security purposes, someoperations cannot be initiated through Redis clients. For details aboutdisabled commands, see Redis Command Compatibility.

How Do I Access a DCS Redis Instance Through Redis Desktop Manager?

You can access a DCS Redis instance through the Redis Desktop Manager within aVPC.

1. Enter the address, port number (6379), and authentication password of theDCS instance you want to access.

2. Click Test Connection.The system displays a success message if the connection is successful.

Figure 6-1 Accessing a DCS Redis instance through Redis Desktop Managerover the intranet

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 142

Page 148: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

When accessing a cluster DCS instance, the Redis command is run properly, but anerror message may display on the left because DCS clusters are based on Codis, whichdiffers from the native Redis in terms of the INFO command output.

What If "ERR Unsupported CONFIG subcommand" is Displayed in SpringCloud?

By using DCS Redis instances, Spring Session can implement session sharing.When interconnecting with Spring Cloud, the following error information may bedisplayed:

Figure 6-2 Spring Cloud error message

For security purposes, DCS does not support the CONFIG command initiated by aclient. You need to perform the following steps:

1. On the DCS console, set the value of the notify-keyspace-event parameter toEgx for the DCS Redis instance.

2. Add the following content to the XML configuration file of the Springframework:

<util:constant

static-field="org.springframework.session.data.redis.config.ConfigureRedisAction.NO_OP"/>

3. Modify the Spring Session configuration. Enable theConfigureRedisAction.NO_OP bean to forbid a client from invoking theCONFIG command.

@Bean

public static ConfigureRedisAction configureRedisAction() {

return ConfigureRedisAction.NO_OP;

}

For more information, see the Spring Session Documentation.

NO TICE

Session sharing is supported only by single-node and master/standby DCS Redisinstances, but not by cluster DCS Redis instances.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 143

Page 149: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

How Do I Troubleshoot Redis Connection Failures?

Preliminary checks:

● Check the connection address.Obtain the connection address from the instance basic information page onthe DCS console.

● Check the instance password.If the instance password is incorrect, the port can still be accessed but theauthentication will fail.

● Check the port.Port 6379 is the default port used in intra-VPC access to a DCS Redis instance.

● Check if the maximum bandwidth has been reached.If the bandwidth reaches the maximum bandwidth for the correspondinginstance specifications, Redis connection may time out.

● Check the inbound access rules of the security group.Intra-VPC access: If the Redis client and the Redis instance are bound withdifferent security groups, allow inbound access over port 6379 for the securitygroup of the instance.For details, see Security Group Configurations.

● Check the configuration parameter notify-keyspace-events.Set notify-keyspace-events to Egx.

Further checks:

● Jedis connection pool error● Error "Read timed out" or "Could not get a resource from the pool"

Check if the KEYS command has been used. This command consumes a lot ofresources and can easily block Redis. Instead, use the SCAN command andavoid executing the command frequently.

What Should I Pay Attention to When Using Redis for Pub/Sub?

Pay attention to the following issues when using Redis for pub/sub:

● Your client must process messages in a timely manner.Your client subscribes to a channel. If it does not receive messages in a timelymanner, DCS instance messages may be overstocked. If the size ofaccumulated messages reaches the threshold (32 MB by default) or remainsat a certain level (8 MB by default) for a certain period of time (1 minute bydefault), your client will be automatically disconnected to prevent servermemory exhaustion.

● Your client must support connection re-establishment in case ofdisconnection.In the event of a disconnection, you need to run the subscribe or psubscribecommand on your client to subscribe to a channel again. Otherwise, yourclient cannot receive messages.

● Do not use pub/sub in scenarios with high message reliability requirements.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 144

Page 150: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

The Redis pub/sub is not a reliable messaging system. Messages that are notretrieved will be discarded when your client is disconnected or a master/standby switchover occurs.

6.2 Redis UsageThis section provides solutions to common problems related to Redis.

● Why Is CPU Usage of a DCS Instance 100%?● Can I Change the VPC and Subnet for a DCS Redis Instance?● Why Aren't Security Groups Configured for DCS Redis 4.0 and 5.0

Instances?● Do DCS Redis Instances Limit the Size of a Key or Value?● Why Does a Cluster DCS Redis Instance Have Two Connection Addresses?● Can I Obtain the Addresses of the Nodes in a Cluster DCS Redis Instance?● Why Is Available Memory of a DCS Redis 3.0 Instance Smaller Than

Instance Cache Size?● Does DCS Support Data Read/Write in Multiple Databases?● Does DCS for Redis Support Redis Clusters?● Does DCS for Redis Support Sentinel?● What Is the Default Data Eviction Policy of Redis?● What Should I Do If an Error Occurs When Using Redis Exporter?● Why is Memory Usage More Than 100%?● Why Is Redisson Distributed Lock Not Supported by DCS Proxy Cluster

Redis 3.0 Instances?● Can I Customize or Change the Port for Accessing a DCS Instance?● Can I Modify the Connection Addresses for Accessing a DCS Instance?● Why Do I Fail to Delete an Instance?● Does DCS Support Cross-AZ Deployment?● Why Does It Take a Long Time to Start a Cluster DCS Instance?● What If Redis Commands Are Incompatible with DCS for Redis?● Does DCS for Redis Provide Backend Management Software?● Why Is Memory of a DCS Redis Instance Used Up by Just a Few Keys?● Can I Recover Data from Deleted DCS Instances?

Why Is CPU Usage of a DCS Instance 100%?● Possible cause 1:

The service QPS is so high that the CPU usage spikes to 100%.

● Possible cause 2:You have run commands that consume a lot of resources, such as KEYS. Thiswill make CPU usage too high and can easily trigger a master/standbyswitchover.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 145

Page 151: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Can I Change the VPC and Subnet for a DCS Redis Instance?

No. Once an instance is created, its VPC and subnet cannot be changed. If youwant to change them, create a same instance again.

Why Aren't Security Groups Configured for DCS Redis 4.0 and 5.0 Instances?

Currently, DCS Redis 4.0 and Redis 5.0 instances use VPCEndpoint and do notsupport security groups.

Do DCS Redis Instances Limit the Size of a Key or Value?● The maximum allowed size of a key is 512 MB.

To reduce memory usage and facilitate key query, ensure that each key doesnot exceed 1 KB.

● The maximum allowed size of a string is 512 MB.

● The maximum allowed size of a Set, List, or Hash is 512 MB.

In essence, a Set is a collection of Strings; a List is a list of Strings; a Hashcontains mappings between string fields and string values.

Prevent the client from constantly writing large values in Redis. Otherwise,network transmission efficiency will be lowered and the Redis server would take alonger time to process commands, resulting in higher latency.

Why Does a Cluster DCS Redis Instance Have Two Connection Addresses?

Redis Cluster DCS instances use distributed architecture and can be accessed usingthe Redis Cluster clients. Each DCS Redis 4.0 and 5.0 instance in the Redis Clustermode has two connection addresses. You can use either address to access such aninstance. In addition, each replica in a cluster has its own IP address.

Can I Obtain the Addresses of the Nodes in a Cluster DCS Redis Instance?

Cluster DCS Redis 3.0 instances (Proxy Cluster type) are used in the same way thatyou use single-node or master/standby instances. You do not need to know thebackend node addresses.

For a cluster DCS Redis 4.0 or 5.0 instance (Redis Cluster type), run the CLUSTERNODES command to obtain node addresses:

redis-cli -h {redis_address} -p {redis_port} -a {redis_password} cluster nodes

In the output similar to the following, obtain the IP addresses and port numbers ofall the master nodes.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 146

Page 152: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Why Is Available Memory of a DCS Redis 3.0 Instance Smaller Than InstanceCache Size?

DCS Redis 3.0 instances are deployed on VMs and some memory is reserved forsystem overheads.

Does DCS Support Data Read/Write in Multiple Databases?Both single-node and master/standby DCS instances support data read/write inmultiple databases. By default, single-node and master/standby DCS instances canread and write data in 256 databases (databases numbering 0–255).

Cluster DCS instances do not support data read/write in multiple databases.

Does DCS for Redis Support Redis Clusters?Yes. DCS for Redis 4.0 and 5.0 support Redis Clusters. DCS for Redis 3.0 supportsProxy Clusters.

Does DCS for Redis Support Sentinel?Yes. Redis Sentinel is supported by DCS for Redis 4.0 and 5.0 and is enabled bydefault. Sentinel constantly checks if master and replica nodes are runningproperly. If the master is not running properly, Sentinel starts a failover processand promotes a replica to master.

However, DCS for Redis 3.0 does not support Redis Sentinel. Instead, it useskeepalive to monitor master and replica nodes and to manage failovers.

What Is the Default Data Eviction Policy of Redis?Data is evicted from cache to make space for new data based on a user-definedspace limit. DCS for Redis allows you to select an eviction policy.

noeviction is the default eviction policy for single-node and master/standby DCSRedis instances. You can change the eviction policy by configuring the instanceparameters.

volatile-lru is the default eviction policy for cluster DCS Redis instances. Tochange the eviction policy for cluster instances, contact customer service.

When maxmemory is reached, you can select one of the following six evictionpolicies:

● noeviction: When the memory limit is reached, DCS instances return errors toclients and no longer process write requests and other requests that couldresult in more memory to be used. However, DEL and a few more exceptionrequests can continue to be processed.

● allkeys-lru: DCS instances try to evict the least recently used keys first, inorder to make space for new data.

● volatile-lru: DCS instances try to evict the least recently used keys with anexpire set first, in order to make space for new data.

● allkeys-random: DCS instances recycle random keys so that new data can bestored.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 147

Page 153: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● volatile-random: DCS instances evict random keys with an expire set, in orderto make space for new data.

● volatile-ttl: DCS instances evict keys with an expire set, and try to evict keyswith a shorter time to live (TTL) first, in order to make space for new data.

If no key can be recycled, volatile-lru, volatile-random, and volatile-ttl are the sameas noeviction. For details, see the description of noeviction.

What Should I Do If an Error Occurs When Using Redis Exporter?Start the Redis exporter using the CLI. Based on the output, check for errors andtroubleshoot accordingly.

Why is Memory Usage More Than 100%?This is normal due to Redis functions (such as master/replica replication andlazyfree). When the memory becomes full, scale up the instance or removeunnecessary data.

Why Is Redisson Distributed Lock Not Supported by DCS Proxy Cluster Redis3.0 Instances?

Redisson implements lock acquisition and unlocking in the following process:

1. Redisson lock acquisition and unlocking are implemented by running Luascripts.

2. During lock acquisition, the EXISTS, HSET, PEXPIRE, HEXISTS, HINCRBY,PEXPIRE, and PTTL commands must be executed in the Lua script.

3. During unlocking, the EXISTS, PUBLISH, HEXISTS, PEXIPRE, and DELcommands must be executed in the Lua script.

In a proxy-based cluster, the proxy processes PUBLISH and SUBSCRIBE commandsand forwards requests to the Redis server. The PUBLISH command cannot beexecuted in the Lua script.

As a result, Proxy Cluster DCS Redis 3.0 instances do not support Redissondistributed locks. To use Redisson, resort to Redis 4.0 or 5.0 instead.

Can I Customize or Change the Port for Accessing a DCS Instance?You cannot customize or change the port for accessing a DCS Redis 3.0 orMemcached instance. You can customize but cannot change the port for accessinga DCS Redis 4.0 or 5.0 instance.

● Redis 3.0Use port 6379 for intra-VPC access.

● MemcachedUse port 11211 for intra-VPC access.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 148

Page 154: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● Redis 4.0 and Redis 5.0You can specify a port (range from 1 to 65535) or use the default port (6379)for accessing a DCS Redis 4.0 or 5.0 instance. If no port is specified, thedefault port will be used.

If the instance and the client are in different security groups, you must configureaccess rules for the security groups, allowing access through the specified port. Fordetails, see Security Group Configurations.

Can I Modify the Connection Addresses for Accessing a DCS Instance?

After a DCS instance is created, its intra-VPC connection addresses cannot bemodified.

For details about accessing DCS instances through clients, see Accessing a DCSInstance.

Why Do I Fail to Delete an Instance?

Possible causes and solutions:

● The instance is not in the Running state.Only instances in the Running state can be deleted.

● Check whether the instance fails to be created.To delete instances that failed to be created, click the number next toInstance Creation Failures.

Does DCS Support Cross-AZ Deployment?

Yes. Master/Standby and cluster DCS Redis instances and DCS Memcachedinstances can be deployed across availability zones (AZs).

● If instance nodes in an AZ are faulty, nodes in other AZs will not be affected.The standby node automatically becomes the master node to resume serviceprovisioning, ensuring disaster recovery (DR).

● Cross-AZ deployment does not compromise the speed of data synchronizationbetween the master and standby nodes.

Why Does It Take a Long Time to Start a Cluster DCS Instance?

Possible cause: When a cluster instance is started, status and data aresynchronized between the nodes of the instance. If a large amount of data iscontinuously written into the instance before the synchronization is complete, thesynchronization will be prolonged and the instance remains in the Starting state.After the synchronization is complete, the instance enters the Running state.

Solution: Start writing data to an instance only after the instance has been started.

What If Redis Commands Are Incompatible with DCS for Redis?

You can verify whether the commands used by your applications are compatiblewith DCS by analyzing your service commands.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 149

Page 155: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

1. DCS for Redis 3.0 has integrated Redis 4.0 commands, which are expected tobe used properly. However, some commands are not supported or aredisabled. For details, see Redis Command Compatibility.

2. DCS for Redis 3.0 does not support Redis 5.0 commands, such as Streamcommands.

Does DCS for Redis Provide Backend Management Software?No. If you wish to query Redis configurations and usage information, use redis-cli.If you wish to monitor DCS Redis instance metrics, go to the Cloud Eye console.For details on how to configure and view the metrics, see Monitoring.

Why Is Memory of a DCS Redis Instance Used Up by Just a Few Keys?Possible cause: The output buffer may have occupied an excessive amount ofmemory.

Solution: After connecting to the instance using redis-cli, run the redis-cli --bigkeys command to scan for big keys. Then, run the info command to check theoutput buffer size.

Can I Recover Data from Deleted DCS Instances?If a DCS instance is automatically deleted or manually deleted through the Redisclient, its data cannot be retrieved. If you have backed up the instance, you canrestore its data from the backup. However, the restoration will overwrite the datawritten in during the period from the backup and the restoration.

By default, data is not evicted from DCS instances. You can modify the instanceconfiguration parameters to adjust the eviction policy so that the instance canevict key values.

6.3 Redis CommandsThis section provides solutions to common problems related to Redis commands.

● Why is "permission denied" Returned When I Run the Keys Command inWeb CLI?

● How Do I Clear Redis Data?● How Do I Rename High-Risk Commands?● Does DCS for Redis Support Pipelining?● Does DCS for Redis Support the INCR and EXPIRE Commands?● Why Do I Fail to Execute Some Redis Commands?● Why Does a Redis Command Fail to Take Effect?● Is There a Time Limit on Executing Redis Commands? What Will Happen

If a Command Times Out?

Why is "permission denied" Returned When I Run the Keys Command inWeb CLI?

The KEYS command is disabled in Web CLI. Run this command in redis-cli.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 150

Page 156: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

How Do I Clear Redis Data?● Single-node or master/standby instances:

By default, a single-node or master/standby instance has 256 DBs. Run one ofthe following commands to clear data:FLUSHALL: clear data in all DBs of the instance.FLUSHDB: clear the data in the currently selected DB.

● Cluster instances:Cluster DCS instances do not support data read/write in multiple databases.Each cluster consists of multiple shards. To clear data for a cluster, you needto run the FLUSHDB or FLUSHALL command for each shard. Alternatively,you can use the DCS console to clear the instance data at once.

Exercise caution when running the commands for clearing data.

How Do I Rename High-Risk Commands?Currently, you can only rename the following critical commands: COMMAND,KEYS, FLUSHDB, FLUSHALL, and HGETALL for DCS Redis 4.0 and 5.0 instances.

You can rename the commands when creating an instance on the console.

Does DCS for Redis Support Pipelining?Yes. For DCS Redis 4.0 and 5.0 instances in the Redis Cluster mode, ensure that allcommands in a pipeline are executed on the same shard.

Does DCS for Redis Support the INCR and EXPIRE Commands?Yes. Yes. For more information about Redis command compatibility, see RedisCommand Compatibility.

Why Do I Fail to Execute Some Redis Commands?Possible causes include the following:

● The command is incorrect.● The command is disabled in DCS.

For security purposes, some Redis commands are disabled in DCS. For detailsabout disabled and restricted Redis commands, see Redis CommandCompatibility.

● The command cannot be executed in Web CLI.In addition to the disabled and restricted Redis commands, the KEYScommands is also restricted in Web CLI.

● The LUA script fails to be executed.For example, the error message "ERR unknown command 'EVAL'" indicatesthat your DCS Redis instance is of a lower version that does not support theLUA script. In this case, contact customer service for the instance to beupgraded.

● The CLIENT SETNAME and CLIENT GETNAME commands fail to be executed.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 151

Page 157: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

This is because the DCS Redis instance is of a lower version that does notsupport these commands. In this case, contact customer service for theinstance to be upgraded.

Why Does a Redis Command Fail to Take Effect?

Run the command in redis-cli to check whether the command is run properly.

The following describes two scenarios:

● Scenario 1: Set and query the value of a key to check whether the SET andGET commands work.The SET command is used to set the string value. If the value is not changed,run the following commands in redis-cli to access the instance:

● Scenario 2: If the timeout set using the EXPIRE command is incorrect, performthe following operations:Set the timeout to 10 seconds and run the TTL command to view theremaining time. As shown in the following example, the remaining time is 7seconds.

Redis clients (including redis-cli, Jedis clients, and Python clients) communicate with Redisserver using a binary protocol.

If Redis commands are run properly in redis-cli, the problem may lie in the service code. Inthis case, create logs in the code for further analysis.

Is There a Time Limit on Executing Redis Commands? What Will Happen If aCommand Times Out?

The time limit for executing a Redis command is 1 minute, but this limit cannot beconfigured. After the execution of a command times out, your client will beautomatically disconnected.

6.4 Instance Scaling and UpgradeThis section provides solutions to common problems related to instance scaling up,scaling down, type change, and upgrade.

● Can DCS Redis Instances Be Upgraded, for Example, from Redis 3.0 toRedis 4.0 or 5.0?

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 152

Page 158: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

● Are Services Interrupted If Maintenance is Performed During theMaintenance Window?

● Are Instance Resources Affected During Specification Modification?● Can I Change a Single-Node DCS Redis Instance to the Master/Standby or

Cluster Type?● Are Services Interrupted During Specification Modification?● Why Do I Fail to Modify the Specifications for a DCS Instance?

Can DCS Redis Instances Be Upgraded, for Example, from Redis 3.0 to Redis4.0 or 5.0?

No. The underlying architecture differs by Redis versions. The Redis version usedby a DCS instance cannot be changed once the instance is created. You will beinformed of any defects or problems found in Redis.

If your service requires the features of higher Redis versions, create a new DCSRedis instance of a higher version and then migrate data from the originalinstance to the new one. For details on how to migrate data, see Migrating Datawith DCS.

Are Services Interrupted If Maintenance is Performed During theMaintenance Window?

O&M personnel will contact you before maintenance activities to inform you ofupcoming operations and their impacts. You do not need to worry about instancerunning exceptions.

Are Instance Resources Affected During Specification Modification?No. Specification modifications can take place while the instance is running anddoes not affect any other resources.

Can I Change a Single-Node DCS Redis Instance to the Master/Standby orCluster Type?

A single-node DCS Redis 3.0 instance can be changed to the master/standby type.A master/standby DCS Redis 3.0 instance can be changed to the Proxy Clustertype.

The instance type of a DCS Redis 4.0 and 5.0 instance cannot be changed.

To check whether you can change the instance type for an instance, see theparameters displayed on the Modify Specifications page on the DCS console.

Are Services Interrupted During Specification Modification?● It takes 5 to 30 minutes to change the specifications of single-node or

master/standby DCS instances. Changing the specifications of a cluster DCSinstance takes a longer time because data must be redistributed in the cluster.During the specification modification, services are interrupted for severalseconds. You are advised to modify the specification during off-peak hours.

● Normally, data can be read from and written into single-node, master/standby, and cluster DCS instances during specification modification. However,

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 153

Page 159: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

writing data into single-node or master/standby instances may be temporarilyunavailable until the specification modification is completed.

Why Do I Fail to Modify the Specifications for a DCS Instance?Specifications of a DCS instance cannot be modified if another task of the instanceis still running. For example, you cannot delete or scale up an instance while it isbeing restarted. Likewise, you cannot delete an instance while it is being scaled up.

If the specification modification fails, try again later. If it fails again, contactcustomer service.

6.5 Monitoring and AlarmThis section provides solutions to common problems related to monitoring DCSinstances.

● Does Redis Support Command Audits?● What Should I Do If the Monitoring Data of a DCS Redis Instance Is

Abnormal?● Why Is Available Memory of Unused DCS Instances Less Than Total

Memory and Why Is Memory Usage of Unused DCS Instances GreaterThan Zero?

● Why Is Used Memory Greater Than Available Memory?

Does Redis Support Command Audits?No. To ensure high-performance reads and writes, Redis does not auditcommands. Commands are not printed.

What Should I Do If the Monitoring Data of a DCS Redis Instance IsAbnormal?

If you have any doubt on the monitoring data of a DCS Redis instance, you canaccess the instance through redis-cli and run the INFO ALL command to view themetrics. For details about the output of the INFO ALL command, see http://www.redis.io/commands/info.

Why Is Available Memory of Unused DCS Instances Less Than Total Memoryand Why Is Memory Usage of Unused DCS Instances Greater Than Zero?

The available memory is less than the total memory because some memory isreserved for system overhead and data persistence (supported by master/standbyinstances). DCS instances use a certain amount of memory for Redis-server buffersand internal data structures. This is why memory usage of unused DCS instances isgreater than zero.

Why Is Used Memory Greater Than Available Memory?For single-node and master/standby DCS instances, the used instance memory ismeasured by the Redis-server process. For cluster DCS instances, the used clustermemory is the sum of used memory of all shards in the cluster.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 154

Page 160: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Due to the internal implementation of the open-source redis-server, the usedinstance memory is normally slightly higher than the available instance memory.

Why is used_memory higher than max_memory?

Redis allocates memory using zmalloc. It does not check whether used_memoryexceeds max_memory every time the memory is allocated. Instead, it checkswhether the current used_memory exceeds max_memory at the beginning of aperiodic task or command processing. If used_memory exceeds max_memory,eviction is triggered. Therefore, the restriction implementation of themax_memory policy is not real-time or rigid. A case in which the used_memory isgreater than the max_memory may occur occasionally.

6.6 Data Backup, Export, and MigrationThis section provides solutions to common problems related to DCS data backupand migration.

● How Do I Export DCS Redis Instance Data?● Can I Export Backup Data of DCS Redis Instances to RDB Files Using the

Console?● Why Are Processes Frequently Killed During Data Migration?● Is All Data in a DCS Redis Instance Migrated During Online Migration?● Does DCS Support Data Persistence?

How Do I Export DCS Redis Instance Data?● Master/standby or cluster instances support data backup.

Perform the following operations to export the data:

a. On the Backups and Restorations tab page, view the backup tasks.b. If there is no backup, create a backup manually and download the

backup file as prompted.

If your DCS instances were created a long time ago, the versions of these instancesmay not be advanced enough to support some new functions (such as backup andrestoration). You can contact customer service to upgrade your DCS instances. Afterthe upgrade, you can back up and restore your instances.

● Single-node instances do not support data backup.Run the following command to export data from a single-node instance:redis-cli -h {source_redis_address} -p 6379 [-a password] --rdb{output.rdb}

Can I Export Backup Data of DCS Redis Instances to RDB Files Using theConsole?

No. You can only use the console to export backup data to AOF files. To exportdata to RDB files, run the following command in redis-cli:

redis-cli -h {redis_address} -p 6379 [-a password] --rdb {output.rdb}

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 155

Page 161: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

Why Are Processes Frequently Killed During Data Migration?Possible cause: The memory is insufficient.

Solution: Expand the memory of the server on which the migration command isexecuted.

Is All Data in a DCS Redis Instance Migrated During Online Migration?Migration between single-node and master/standby instances involves the full setof data. After the migration, a given key will remain in the same DB as it wasbefore the migration.

By contrast, a cluster instance only has one DB, which is DB0. During themigration, data in all slots of DB0 is migrated.

Does DCS Support Data Persistence?1. DCS Redis instances:

– Single-node: Not supported– Master/Standby and cluster: Supported

2. DCS Memcached instances:– Single-node: Not supported– Master/Standby: Supported

6.7 Master/Standby SwitchoverThis section provides solutions to common problems related to master/standbyswitchover.

● When Does a Master/Standby Switchover Occur?● How Does Master/Standby Switchover Affect Services?● Does the Client Need to Switch the Connection Address After a Master/

Standby Switchover?● How Does Redis Master/Standby Replication Work?

When Does a Master/Standby Switchover Occur?A master/standby switchover may occur in the following scenarios:

● You perform a Master/Standby Switchover operation on the DCS Console.● If the master node of a master/standby instance fails, a master/standby

switchover will be triggered.For example, running commands that consume a lot of resources, such asKEYS commands will cause CPU usage to spike and as result triggers amaster/standby switchover.

● If you restart a master/standby instance on the DCS console, a master/standby switchover will be triggered.

After a master/standby switchover occurs, you will receive a notification. Checkwhether the client services are running properly. If not, check whether the TCP

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 156

Page 162: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

connection is normal and whether it can be re-established after the master/standby switchover to restore the services.

How Does Master/Standby Switchover Affect Services?If a fault occurs in a master/standby or cluster DCS instance, a failover is triggeredautomatically. Services may be interrupted for less than half a minute duringexception detection and failover.

Does the Client Need to Switch the Connection Address After a Master/Standby Switchover?

No. If the master fails, the standby node will be promoted to master and takes theoriginal IP address.

How Does Redis Master/Standby Replication Work?Redis master/standby instances are also called master/slave instances. Generally,updates to the master cache node are automatically and asynchronouslyreplicated to the standby cache node. This means that data in the standby cachenode may not always be consistent with data in the master cache node. Theinconsistency is typically seen when the I/O write speed of the master node isfaster than the synchronization speed of the standby node or a network latencyoccurs between the master and standby nodes. If a failover happens when somedata is not yet replicated to the standby node, such data may be lost after thefailover.

6.8 Security Group ConfigurationsThis section describes how to configure a security group for accessing a DCSinstance within a VPC.

An ECS can communicate with a DCS instance if they belong to the same VPC andsecurity group rules are configured correctly.

In addition, you must configure correct rules for the security groups of both theECS and DCS instance so that you can access the instance through your client.

● If the ECS and DCS instance are configured with the same security group,network access in the group is not restricted by default.

● If the ECS and DCS instance are configured with different security groups, addsecurity group rules to ensure that the ECS and DCS instance can access eachother.

● Suppose that the ECS on which the client runs belongs to security group sg-ECS,and the DCS instance that the client will access belongs to security group sg-DCS.

● Suppose that the port number of the DCS service is 6379.● The remote end is a security group or an IP address.

a. Configuring security group for the ECS.Add the following outbound rule to allow the ECS to access the DCSinstance. Skip this rule if there are no restrictions on the outbound traffic.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 157

Page 163: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

b. Configuring security group for the DCS instance.To ensure that your client can access the DCS instance, add the followinginbound rule to the security group configured for the DCS instance:

NO TICE

For the source IP address, use the specified IP address of the DCSinstance. Avoid using 0.0.0.0/0 to prevent ECSs bound with the samesecurity group from being attacked by Redis vulnerability exploits.

6.9 Memcached UsageThis section provides solutions to common problems related to Memcached.

● Can I Dump DCS Memcached Instance Data for Analysis?● What Memcached Version Is Compatible with DCS for Memcached?● What Data Structures Does DCS for Memcached Support?● Do DCS Memcached Instances Support Public Access?● Can I Modify Configuration Parameters of DCS Memcached Instances?● What Are the Differences Between DCS for Memcached and Self-Hosted

Memcached?● What Policies Does DCS for Memcached Use to Deal with Expired Data?● How Should I Select AZs When Creating a DCS Memcached Instance?

Can I Dump DCS Memcached Instance Data for Analysis?

No.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 158

Page 164: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

What Memcached Version Is Compatible with DCS for Memcached?

DCS for Memcached is based on Redis 3.0.7 and is compatible with Memcached1.5.1.

What Data Structures Does DCS for Memcached Support?

Only the key-value structure is supported.

Do DCS Memcached Instances Support Public Access?

No. The ECS that serves as a client and the DCS instances that the client willaccess must belong to the same VPC. In the application development anddebugging phase, you can also use an SSH agent to access DCS instances in thelocal environment.

Can I Modify Configuration Parameters of DCS Memcached Instances?

Parameter configuration is allowed only when DCS instances are in the Runningstate.

For details, see Modifying Configuration Parameters.

What Are the Differences Between DCS for Memcached and Self-HostedMemcached?

Table 6-1 describes the differences between DCS for Memcached and self-hostedMemcached.

Table 6-1 Comparing DCS for Memcached and self-hosted Memcached

Item DCS for Memcached Self-Hosted Memcached

Deployment

Easy to use. DCS for Memcachedcan be used right out of the boxwithout requiring you to worryabout the hardware or software.

Involves complicated operationsand settings.

Availability

Master/Standby instances use hotstandby to ensure stable services.If the master node is faulty, thestandby cache node willautomatically become the masternode to prevent a single point offailure.

Requires additionalconfigurations.

Security Uses the VPC and security groupsfor network access securitycontrol.

Requires you to design andimplement a securitymechanism by yourself.

Scale-up Supports online scale-up on theconsole.

Requires additional hardwareand restarting your service.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 159

Page 165: User Guide - Huawei · Distributed Cache Service User Guide Issue 01 Date 2020-04-20 HUAWEI TECHNOLOGIES CO., LTD

What Policies Does DCS for Memcached Use to Deal with Expired Data?DCS for Memcached allows you to set the expiration time for stored data basedon service requirements. For example, you can set the expire time whenperforming the add operation.

By default, data is not evicted from DCS Memcached instances, but you cancustomize an eviction policy.

For details about the six types of data eviction policies, see What Is the DefaultData Eviction Policy of Redis?

How Should I Select AZs When Creating a DCS Memcached Instance?There are no function differences between DCS Memcached instances deployed indifferent AZs within a region.

Generally, instance deployment within an AZ features lower network latency whilecross-AZ deployment ensures disaster recovery. If your application requires lowernetwork latency, choose single-AZ deployment.

DCS for Memcached supports cross-AZ deployment. When creating a DCSMemcached instance on the DCS console, you can select any AZ in the sameregion as your ECS for communication between your ECS and instance. For lowernetwork latency, select the same AZ as your ECS.

Note that there may be only one available AZ due to insufficient resources whenyou create a DCS Memcached instance. This does not affect the normal use ofDCS.

Distributed Cache ServiceUser Guide 6 FAQs

Issue 01 (2020-04-20) Copyright © Huawei Technologies Co., Ltd. 160