115
Distributed Cache Service User Guide Issue 13 Date 2018-10-18

User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Distributed Cache Service

User Guide

Issue 13

Date 2018-10-18

Page 2: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Contents

1 Accessing DCS............................................................................................................................... 11.1 DCS................................................................................................................................................................................ 11.2 How to Access DCS....................................................................................................................................................... 31.3 Related Services............................................................................................................................................................. 31.4 Related Concepts............................................................................................................................................................ 4

2 Getting Started............................................................................................................................... 62.1 Setting Up Environments................................................................................................................................................62.2 Buying a DCS Instance...................................................................................................................................................72.2.1 Buying a DCS Redis Instance..................................................................................................................................... 72.2.2 Buying a DCS2.0 Redis Instance.............................................................................................................................. 122.2.3 Buying a DCS Memcached Instance......................................................................................................................... 152.2.4 Buying a DCS IMDG Instance..................................................................................................................................192.3 Accessing a DCS Instance............................................................................................................................................222.3.1 Restrictions................................................................................................................................................................ 222.3.2 Accessing a DCS Redis Instance Through redis-cli..................................................................................................222.3.3 Accessing a DCS Redis Instance Through Jedis....................................................................................................... 242.3.4 Accessing a DCS Redis Instance Through phpredis................................................................................................. 252.3.5 Accessing a DCS Redis Instance Through hiredis.................................................................................................... 282.3.6 Accessing a DCS Redis Instance Through redis-py..................................................................................................302.3.7 Accessing a DCS Redis Instance Through Node.js Client ioredis............................................................................ 322.3.8 Accessing a DCS Redis Instance Through C# Client StackExchange.Redis............................................................352.3.9 Accessing a DCS Redis Instance Over a Public Network.........................................................................................372.3.10 Accessing a DCS Memcached Instance.................................................................................................................. 422.3.11 Accessing a DCS IMDG Instance........................................................................................................................... 552.3.12 Accessing a DCS2.0 Instance Through WebCli...................................................................................................... 552.4 Viewing Details of a DCS Instance.............................................................................................................................. 57

3 Operating DCS Instances...........................................................................................................603.1 Starting DCS Instances.................................................................................................................................................603.2 Stopping DCS Instances............................................................................................................................................... 613.3 Restarting DCS Instances............................................................................................................................................. 623.4 Deleting DCS Instances................................................................................................................................................633.5 Clearing DCS Instances................................................................................................................................................65

Distributed Cache ServiceUser Guide Contents

Issue 13 (2018-10-18) ii

Page 3: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

4 Managing DCS Instances...........................................................................................................674.1 Configuration Notice.................................................................................................................................................... 674.2 Configuring Parameters................................................................................................................................................684.3 Modifying an Instance's Maintenance Time Window.................................................................................................. 754.4 Modifying an Instance's Security Group...................................................................................................................... 764.5 Enabling Public Access to a DCS Redis Instance........................................................................................................ 774.6 Managing Background Tasks....................................................................................................................................... 78

5 Scaling Up DCS Instances......................................................................................................... 80

6 Backing Up and Restoring DCS Instances............................................................................. 826.1 Overview...................................................................................................................................................................... 826.2 Configuring a Backup Policy....................................................................................................................................... 846.3 Manually Backing Up a DCS Instance.........................................................................................................................866.4 Restoring a DCS Instance.............................................................................................................................................87

7 Managing Passwords.................................................................................................................. 897.1 Changing Instance Passwords...................................................................................................................................... 897.2 Resetting Instance Passwords.......................................................................................................................................907.3 Enabling Password-free Access to a DCS Redis Instance............................................................................................927.4 Enabling Password-free Access to a DCS Memcached Instance................................................................................. 93

8 Monitoring.................................................................................................................................... 958.1 DCS Metrics................................................................................................................................................................. 958.2 Setting DCS Alarm Rules...........................................................................................................................................1048.3 Viewing DCS Running Status.................................................................................................................................... 105

9 Auditing...................................................................................................................................... 1079.1 Operations That Can Be Recorded by CTS................................................................................................................1079.2 Viewing Traces on the CTS Console..........................................................................................................................108

A Change History......................................................................................................................... 110

Distributed Cache ServiceUser Guide Contents

Issue 13 (2018-10-18) iii

Page 4: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

1 Accessing DCS

1.1 DCSDistributed Cache Service (DCS) is an online, distributed, in-memory cache service. It isreliable, scalable, usable out of the box, and easy to manage. Compatible with Redis,Memcached, and in-memory data grid (IMDG), DCS supports three instance types: single-node, master/standby, and cluster. It can meet your requirements for high read/writeperformance and fast data access.

1.2 How to Access DCSYou can access DCS from the web-based management console provided by the public cloud,or by using application programming interfaces (APIs) through HTTPS requests.

1.3 Related ServicesDCS is used together with other HUAWEI CLOUD services, including Virtual Private Cloud(VPC), Elastic Cloud Server (ECS), Identity and Access Management (IAM), and Cloud Eye.

1.4 Related Concepts

1.1 DCSDistributed Cache Service (DCS) is an online, distributed, in-memory cache service. It isreliable, scalable, usable out of the box, and easy to manage. Compatible with Redis,Memcached, and in-memory data grid (IMDG), DCS supports three instance types: single-node, master/standby, and cluster. It can meet your requirements for high read/writeperformance and fast data access.

l Redis: a storage system that supports multiple types of data structures, including key-value pairs. It can be used in scenarios such as caching, event pub/sub, and high-speedqueuing. Redis is networked and written in ANSI C. It supports direct read/write ofstrings, hashes, lists, queues, and sets. Redis works with in-memory datasets andprovides persistence. For more information about Redis, visit https://redis.io/.

l Memcached: an in-memory key-value caching system that supports read/write of simplestrings. It is commonly used to accelerate web applications by caching content of back-end databases to alleviate load on backend databases. In addition to full compatibilitywith Memcached, DCS provides the master/standby instance type and data persistence,which are not supported by Memcached. For more information about Memcached, visithttps://memcached.org/.

Distributed Cache ServiceUser Guide 1 Accessing DCS

Issue 13 (2018-10-18) 1

Page 5: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

l IMDG: an in-memory database that uses key-value pairs. IMDGs provide high-performance data organization and management between applications and different datasources based on distributed memory. The IMDGs that DCS uses are industry-leadingmemory computing platform GridGain and open-source platform Apache Ignite. TheseIMDGs enable DCS to provide distributed cache, SQL query, computing, and transactionprocessing capabilities, and are fully compatible with standard JCache (JSR107) andSQL ANSI-99 access interfaces.– For more information about GridGain, visit https://www.gridgain.com.– For more information about Ignite, visit https://ignite.apache.org.

NOTE

IMDG is supported only in some regions. The DCS console prevails.

DCS does not provide built-in encryption. Encrypt any sensitive data before transmitting orstoring it. The purpose, scope, processing method, and time limits of data processed by DCSmust comply with local laws and regulations.

Figure 1-1 describes access to DCS instances through different clients.

Figure 1-1 Accessing DCS instances

NOTE

Currently, a DCS instance can be accessed over an internal network through an ECS in the same VPCand subnet as the DCS instance. If public access is enabled, a DCS Redis instance can be accessedthrough an elastic IP address (EIP) over a public network.

Distributed Cache ServiceUser Guide 1 Accessing DCS

Issue 13 (2018-10-18) 2

Page 6: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

1.2 How to Access DCSYou can access DCS from the web-based management console provided by the public cloud,or by using application programming interfaces (APIs) through HTTPS requests.

l Using the management consoleThe public cloud provides a web-based management console. To launch the DCSconsole, create an account on the management console and log in, and then chooseService List > Database > Distributed Cache Service on the homepage. On the DCSconsole, you can create, start, stop, restart, and delete DCS instances, and change theirpasswords.

l Using APIsIf you want to integrate DCS into a third-party system for secondary development, useAPIs to access DCS. For more information about available APIs, see the DistributedCache Service API Reference.

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

1.3 Related ServicesDCS is used together with other HUAWEI CLOUD services, including Virtual Private Cloud(VPC), Elastic Cloud Server (ECS), Identity and Access Management (IAM), and Cloud Eye.

Virtual Private Cloud (VPC)

The VPC service enables users to create private, isolated virtual networks. DCS instances runin VPCs and use the IP addresses and bandwidths of VPCs. VPCs are based on security

Distributed Cache ServiceUser Guide 1 Accessing DCS

Issue 13 (2018-10-18) 3

Page 7: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

groups. A security group is a set of access control rules that implements access control formutually trusted ECSs with the same security protection requirements in the same VPC.

Elastic Cloud Server (ECS)

The ECS service provides scalable, on-demand cloud servers for secure, flexible, and efficientapplication environments, ensuring service reliability. After you create DCS instances, youcan connect to them through ECSs.

Cloud Trace Service (CTS)

CTS provides a history of operations performed on cloud service resources. With CTS, youcan query, audit, and review operations. Traces include operation time, resource objects,resource IDs, requesters' IP addresses, resource operation requests, and responses. For details,see Auditing.

Identity and Access Management (IAM)

IAM provides identity authentication and permission management. It is used to authenticateaccess to DCS.

Cloud Eye

Cloud Eye is a secure, scalable monitoring platform in the public cloud. It monitors DCSservice metrics, and sends notifications if alarms are triggered or events occur. For details, seeMonitoring.

Related Products and Documents

Products Documents

Distributed Cache Service for RedisDistributed Cache Service forMemcachedElastic Cloud ServerVirtual Private CloudIdentity and Access ManagementCloud EyeCloud Trace Service

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

1.4 Related Concepts

Region

A region is a geographic area in which DCS is located.

DCS services in the same region can communicate with each other over an intranet, but thosein different regions cannot.

Distributed Cache ServiceUser Guide 1 Accessing DCS

Issue 13 (2018-10-18) 4

Page 8: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Public cloud data centers are deployed in different places around the world. DCS is thereforeavailable in different regions. For example, applications can be designed to meet requirementsof users in specific regions or comply with local laws or regulations.

Availability ZoneEach region contains many availability zones (AZs), in which power and networks arephysically isolated. AZs in the same region can communicate with each other over an intranet.Each AZ provides cost-effective and low-latency network connections that are unaffected byfaults that may occur in other AZs. Using DCS deployed in an independent AZ protects yourapplications against failures that occur in a single place.

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

Distributed Cache ServiceUser Guide 1 Accessing DCS

Issue 13 (2018-10-18) 5

Page 9: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

2 Getting Started

2.1 Setting Up EnvironmentsTo access DCS instances through a VPC, create a VPC and configure security groups andsubnets for it before using DCS.

2.2 Buying a DCS InstanceTo use DCS, buy a DCS instance. DCS supports three deployment modes for DCS instances:single-node, master/standby, and cluster.

2.3 Accessing a DCS InstanceYou can access DCS instances either through a Redis or Memcached client. In addition,applications can be developed and deployed through IMDG APIs.

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

2.1 Setting Up EnvironmentsTo access DCS instances through a VPC, create a VPC and configure security groups andsubnets for it before using DCS.

A VPC provides an isolated, user-configurable, and user-manageable virtual networkenvironment for DCS. Using VPCs enhances public cloud resource security and simplifiesnetwork deployment.

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

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

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

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 6

Page 10: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 4 On the Dashboard page, click Create VPC.

Step 5 Create a VPC as guided by the VPC console, retaining the default values of the VPCparameters unless otherwise required.

For more information on how to create a VPC, see the Virtual Private Cloud User Guide.

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

Step 6 In the navigation pane, choose Virtual Private Cloud. On the Virtual Private Cloud page,click the name of the VPC in which you intend to create a subnet. On the Subnets tab page,click Create Subnet.

Create a subnet as guided by the VPC console, retaining the default values of the subnetparameters unless otherwise required.

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

Step 7 In the navigation pane, choose Security Group. On the Security Group page, click CreateSecurity Group.

Create a security group for the VPC, retaining the default values of the security groupparameters unless otherwise required.

For more information on how to create a security group, see the Virtual Private Cloud UserGuide.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.2 Buying a DCS InstanceTo use DCS, buy a DCS instance. DCS supports three deployment modes for DCS instances:single-node, master/standby, and cluster.

2.2.1 Buying a DCS Redis InstanceCurrently, you can buy a DCS Redis instance in yearly/monthly subscription or pay-per-usemode, and customize the computing capabilities and storage space of the instance based onyour service requirements. You can buy multiple DCS Redis instances at a time.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 7

Page 11: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Prerequisites

The VPC where the DCS instance is to be created is available. Security groups and subnetshave been configured for the VPC.

For more information on how to create VPCs, security groups, and subnets, see 2.1 SettingUp Environments or the Virtual Private Cloud User Guide.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 Click Buy DCS Instance.

Step 5 Set Billing Mode to either Yearly/Monthly or Pay-per-use.

Step 6 Specify DCS instance parameters, such as the name, AZ, VPC, security group, and subnet.

Table 2-1 DCS instance parameters

Parameter Description

Region Region in which DCS is located. To select a different region, use theregion selector at the upper left of the main menu bar.

Name Name of the new DCS instance.A DCS instance name cannot be left unspecified and must:l Consist of only letters, digits, hyphens (-), and underscores (_).l Start with an uppercase or lowercase letter.When you create only one instance at a time, the value of this parametermust be a string consisting of 4 to 64 characters.When you create more than one instance at a time, the value of thisparameter must be a string consisting of 4 to 56 characters. Theseinstances are named in the format of "name-n", in which n starts from 000and is incremented by 1. For example, if you create two instances and setname to dcs_demo, the two instances are respectively named asdcs_demo-000 and dcs_demo-001.

Description Description of the new DCS instance.

Cache Engine Cache engine used. Select Redis.

EngineVersion

Cache engine version.Currently, only version 3.0.7 is supported.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 8

Page 12: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

Instance Type Type of the DCS instance being created. DCS Redis instances support thesingle-node, master/standby, and cluster types.NOTE

Cluster DCS instances do not support cross-VPC access through VPC peeringconnections.

Select an instance type based on your service scenario. For moreinformation, see DCS Instance Type.

AZ AZ in which the new DCS instance resides.NOTE

l If a master/standby or cluster DCS instance is deployed across AZs, faults in anAZ do not affect the cache node in the other AZ. This is because when themaster node is faulty, the standby cache node will automatically become themaster node to provide services externally. This structure achieves betterdisaster recovery.

l Deploying a DCS instance across AZs slightly reduces network efficiencycompared with deploying a DCS instance in the same AZ. Therefore, if a DCSinstance is deployed across AZs, synchronization between master and standbycache nodes is slightly less efficient.

Cross-AZDeployment

An indicator of whether to enable cross-AZ deployment.

Standby AZ Standby AZ in which the new DCS instance resides.NOTE

This parameter is displayed if the following conditions are true:

l Cross-AZ Deployment is enabled.

l The DCS instance is of the master/standby or cluster type.

l Multiple AZs exist.

Standby AZ Standby AZ in which the new DCS instance resides.NOTE

This parameter is displayed if the following conditions are true:

l The DCS instance is of the master/standby or cluster type.

l Multiple AZs exist.

InstanceSpecification

Total memory of the new DCS instance.Specifications of DCS Redis instances are as follows:l Single-node or master/standby instances: 2 GB, 4 GB, 8 GB, 16 GB,

32 GB, and 64 GB.l Cluster instances in pay-per-use mode: 64 GB, 128 GB, and 256 GB;

cluster instances in yearly/monthly subscription mode: 64 GB, 128GB, 256 GB, 512 GB, and 1024 GB.

By default, each user can create a maximum of five DCS instances anduse a total of 400 GB memory.If you need more memory, click Increase quota below the InstanceSpecification field. On the displayed page, fill in the quota applicationform and click Submit.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 9

Page 13: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

VPC VPC in which the new DCS instance resides.Click View VPC to show more details of the chosen VPC, includingsecurity group rules.

Subnet Name and IP address range of the subnet in which the new DCS instanceresides.

SecurityGroup

Security group that controls access to the new DCS instance.

Public Access An indicator of whether to enable or disable public access.NOTE

l In comparison with intra-VPC access, packet loss and jitter may occur and theaccess latency increases during public access. Therefore, you are advised toenable public access only during the service development and test phase.

l Currently, public access is applicable only to the Redis password mode and notthe password-free mode.

Elastic IPAddress

EIP through which the DCS Redis instance is accessed over a publicnetwork.Select an existing EIP from the drop-down list, or click Create Elastic IPand create an EIP on the Buy EIP page of VPC.NOTE

l This parameter is displayed only when Public Access is enabled.

l If you manually unbind or delete an EIP from the VPC console, the publicaccess function of the corresponding DCS instance is automatically disabled.

Password-Free Access

An indicator of whether to enable or disable password-free access.NOTE

l Password-free access may compromise security. Exercise caution when usingthis mode.

l You must set a password if you enable public access.

l After creating a DCS Redis instance in password-free mode, you can set apassword by using the password reset function. For details, see 7.3 EnablingPassword-free Access to a DCS Redis Instance.

PasswordConfirmPassword

Password required for accessing the new DCS instance.NOTE

l These parameters are displayed only when Password-Free Access is disabled.

l For security purposes, if password-free access is disabled, the system promptsyou to enter an instance-specific password when you are accessing the DCSinstance. Keep your instance password secure and change it periodically.

Passwords for DCS Redis instances must:l Consist of 6 to 32 characters.l Contain at least two of the following character types: uppercase letters,

lowercase letters, digits, and special characters (`~!@#$^&*()-_=+\|{}:,<.>/?).

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 10

Page 14: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

Time Window Time range for any scheduled maintenance activities for cache nodes ofthis DCS instance.Values:l 22:00-02:00l 02:00-06:00l 06:00-10:00l 10:00-14:00l 14:00-18:00l 18:00-22:00

BackupPolicy

Data backup policy. This parameter is displayed only when the instancetype is master/standby. For more information on how to configure abackup policy, see Backing Up and Restoring DCS Instances.

Price If the billing mode is Yearly/Monthly, the Price parameter indicates thepayment for using the new DCS instance with the chosen specificationsfor the preset period.If the billing mode is Pay-per-use, the Price parameter indicates thehourly fee of the new DCS instance with the chosen specifications.

RequiredDuration &Quantity

l If the billing mode is Yearly/Monthly, specify the usage duration andnumber of instances to be purchased.

l If the billing mode is Pay-per-use, specify the number of DCSinstances to be purchased.

Step 7 Review the instance information and click Next.

A confirmation page is displayed, providing information about the new DCS instance,including instance name, cache engine version, and instance specifications.

Step 8 On the confirmation page, confirm that information about the new DCS instance on theconfirmation page is correct.l For yearly/monthly billing, after you click Pay Now, you will be redirected to the

payment page. Once you have made the payment, the DCS console starts to create theDCS instance.If you do not want to pay at this time, you can close the page and then pay or cancel theorder in My Orders.

l For pay-per-use billing, after you click Submit, you will be redirected to the Finishpage, and the DCS console starts to create the DCS instance.

Step 9 After the new DCS instance has been created, return to the Cache Manager page to view andmanage your DCS instances.

It takes 5 to 15 minutes to create a DCS instance. However, it will take up to approximately30 minutes if the DCS instance is in cluster mode.

After a DCS instance has been successfully created, it enters the Running state by default.

l If the billing mode is Pay-per-use:

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 11

Page 15: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

– If the new DCS instance failed to be created, delete the unsuccessful instancecreation task by following the procedure in Deleting Instance Creation TasksThat Have Failed to Run. Then, create the DCS instance again. If the DCSinstance still fails to be created, contact customer service.

l If the billing mode is Yearly/Monthly:– The new DCS instances can be created only after you make the required payment.– If the new DCS instance failed to be created, this is because required resources are

not available. Contact customer service or go to My Orders to cancel the order.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.2.2 Buying a DCS2.0 Redis InstanceCurrently, you can buy a DCS2.0 instance, and deploy it by using bare metal servers (BMSs).You can customize the computing capabilities and storage space of the Redis instance basedon your service requirements.

NOTE

This operation is supported only in some regions. The DCS console prevails.

PrerequisitesThe VPC where the DCS instance is to be created is available. Security groups and subnetshave been configured for the VPC.

For more information on how to create VPCs, security groups, and subnets, see 2.1 SettingUp Environments or the Virtual Private Cloud User Guide.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 12

Page 16: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 4 Click Buy DCS2.0 Instance.

Step 5 Set Billing Mode to Pay-per-use.

Step 6 Specify DCS instance parameters, such as the name, AZ, VPC, security group, and subnet.Table 2-2 lists the parameters.

Table 2-2 DCS instance parameters

Parameter Description

Region Region in which DCS is located. To select a different region, use theregion selector at the upper left of the main menu bar.

AZ AZ in which the new DCS instance resides.NOTE

l If a master/standby or cluster DCS instance is deployed across AZs, faults in anAZ do not affect the cache node in the other AZ. This is because when themaster node is faulty, the standby cache node will automatically become themaster node to provide services externally. This structure achieves betterdisaster recovery.

l Deploying a DCS instance across AZs slightly reduces network efficiencycompared with deploying a DCS instance in the same AZ. Therefore, if a DCSinstance is deployed across AZs, synchronization between master and standbycache nodes is slightly less efficient.

Name Name of the new DCS instance.A DCS instance name cannot be left unspecified and must:l Consist of 4 to 64 characters.l Consist of only letters, digits, hyphens (-), and underscores (_).l Start with an uppercase or lowercase letter.

InstanceSpecification

Total memory of the new DCS instance.Specifications of DCS2.0 Redis instances are as follows:l Single-node instances: 128 MB, 256 MB, 512 MB, and 1–64 GB

(with an increment of 1 GB)l Master/standby instances: 1–64 GB (with an increment of 1 GB)l Cluster instances: 64 GB, 128 GB, 256 GB, 512 GB, and 1024 GBNOTE

l Before creating a DCS instance with memory size greater than 8 GB, submit aservice ticket.

l If the instance specifications exceed your available quota, submit a service ticketto increase your quota.

VPC VPC in which the new DCS instance resides.Click View VPC to show more details of the chosen VPC, includingsecurity group rules.

Subnet Name and IP address range of the subnet in which the new DCS instanceresides.

SecurityGroup

Security group that controls access to the new DCS instance.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 13

Page 17: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

PasswordConfirmPassword

Password required for accessing the new DCS instance.NOTE

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

Passwords for DCS Redis instances must:l Consist of 6 to 32 characters.l Contain at least two of the following character types: uppercase letters,

lowercase letters, digits, and special characters (`~!@#$^&*()-_=+\|{}:,<.>/?).

Time Window Time range for any scheduled maintenance activities for cache nodes ofthis DCS instance.Values:l 22:00-02:00l 02:00-06:00l 06:00-10:00l 10:00-14:00l 14:00-18:00l 18:00-22:00

Step 7 After specifying the preceding information, click Buy Now.

You will be redirected to the Cache Manager page to 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 bydefault.

3. If the new DCS instance failed to be created, delete the unsuccessful instance creationtask by following the procedure in Deleting Instance Creation Tasks That HaveFailed to Run. Then, create the DCS instance again. If the DCS instance still fails to becreated, contact customer service.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 14

Page 18: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

2.2.3 Buying a DCS Memcached InstanceCurrently, you can buy a DCS Memcached instance in yearly/monthly subscription or pay-per-use mode, and customize the computing capabilities and storage space of the instancebased on your service requirements.

Prerequisites

The VPC where the DCS instance is to be created is available. Security groups and subnetshave been configured for the VPC.

For more information on how to create VPCs, security groups, and subnets, see 2.1 SettingUp Environments or the Virtual Private Cloud User Guide.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 Click Buy DCS Instance.

Step 5 Set Billing Mode to either Yearly/Monthly or Pay-per-use.

Step 6 Specify DCS instance parameters, such as the name, AZ, VPC, security group, and subnet.

Table 2-3 DCS instance parameters

Parameter Description

Region Region in which DCS is located. To select a different region, use theregion selector at the upper left of the main menu bar.

Name Name of the new DCS instance.A DCS instance name cannot be left unspecified and must:l Consist of only letters, digits, hyphens (-), and underscores (_).l Start with an uppercase or lowercase letter.When you create only one instance at a time, the value of this parametermust be a string consisting of 4 to 64 characters.When you create more than one instance at a time, the value of thisparameter must be a string consisting of 4 to 56 characters. Theseinstances are named in the format of "name-n", in which n starts from 000and is incremented by 1. For example, if you create two instances and setname to dcs_demo, the two instances are respectively named asdcs_demo-000 and dcs_demo-001.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 15

Page 19: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

Description Description of the new DCS instance.

Cache Engine Cache engine used. Select Memcached.

Instance Type Type of the DCS instance being created. DCS Memcached instancessupport the single-node and master/standby types.Select an instance type based on your service scenario. For moreinformation, see DCS Instance Type.

AZ AZ in which the new DCS instance resides.NOTE

l If a master/standby DCS instance is deployed across AZs, faults in an AZ do notaffect the cache node in the other AZ. This is because when the master node isfaulty, the standby cache node will automatically become the master node toprovide services externally. This structure achieves better disaster recovery.

l Deploying a DCS instance across AZs slightly reduces network efficiencycompared with deploying a DCS instance in the same AZ. Therefore, if a DCSinstance is deployed across AZs, synchronization between master and standbycache nodes is slightly less efficient.

Cross-AZDeployment

An indicator of whether to enable cross-AZ deployment.

Standby AZ Standby AZ in which the new DCS instance resides.NOTE

This parameter is displayed if the following conditions are true:

l Cross-AZ Deployment is enabled.

l The DCS instance is of the master/standby type.

l Multiple AZs exist.

InstanceSpecification

Total memory of the new DCS instance.Specifications of DCS Memcached instances: 2, 4, 8, 16, 32, or 64 GB.By default, each user can create a maximum of five DCS instances anduse a total of 400 GB memory.If you need more memory, click Increase quota below the InstanceSpecification field. On the displayed page, fill in the quota applicationform and click Submit.

VPC VPC in which the new DCS instance resides.Click View VPC to show more details of the chosen VPC, includingsecurity group rules.

Subnet Name and IP address range of the subnet in which the new DCS instanceresides.

SecurityGroup

Security group that controls access to the new DCS instance.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 16

Page 20: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

Password-Free Access

An indicator of whether to enable or disable password-free access.NOTE

l Password-free access may compromise security. Exercise caution when usingthis mode.

l After creating a DCS Memcached instance in password-free mode, you can set apassword by using the password reset function. For details, see 7.4 EnablingPassword-free Access to a DCS Memcached Instance.

l If password-free access is disabled, clients will access DCS instances using theMemcached binary protocol and be authenticated using SASL.

User Username required for accessing the new DCS instance.NOTE

This parameter is displayed only when Password-Free Access is disabled.

A username cannot be left unspecified and must:l Consist of 1 to 64 characters.l Consist of only uppercase or lowercase letters, digits, hyphens (-), and

underscores (_).l Start with an uppercase or lowercase letter.

PasswordConfirmPassword

Password required for accessing the new DCS instance.NOTE

l These parameters are displayed only when Password-Free Access is disabled.

l For security purposes, if password-free access is disabled, the system promptsyou to enter an instance-specific password when you are accessing the DCSinstance. Keep your instance password secure and change it periodically.

Passwords for DCS Memcached instances must:l Consist of 6 to 32 characters.l Contain at least two of the following character types: uppercase letters,

lowercase letters, digits, and special characters (`~!@#$^&*()-_=+\|{}:,<.>/?).

l Cannot be the username or the username spelled backwards.

Time Window Time range for any scheduled maintenance activities for cache nodes ofthis DCS instance.Values:l 22:00-02:00l 02:00-06:00l 06:00-10:00l 10:00-14:00l 14:00-18:00l 18:00-22:00

BackupPolicy

Data backup policy. This parameter is displayed only when the instancetype is master/standby. For more information on how to configure abackup policy, see Backing Up and Restoring DCS Instances.

Price Fee required for purchasing the new DCS instance.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 17

Page 21: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

RequiredDuration &Quantity

l If the billing mode is Yearly/Monthly, specify the usage duration andnumber of instances to be purchased.

l If the billing mode is Pay-per-use, specify the number of DCSinstances to be purchased.

Step 7 Review the instance information and click Next.

A confirmation page is displayed, providing information about the new DCS instance,including instance name, cache engine version, and instance specifications.

Step 8 On the confirmation page, confirm that information about the new DCS instance on theconfirmation page is correct.l For yearly/monthly billing, after you click Pay Now, you will be redirected to the

payment page. Once you have made the payment, the DCS console starts to create theDCS instance.If you do not want to pay at this time, you can close the page and then pay or cancel theorder in My Orders.

l For pay-per-use billing, after you click Submit, you will be redirected to the Finishpage, and the DCS console starts to create the DCS instance.

Step 9 After the new DCS instance has been created, return to the Cache Manager page to view andmanage your DCS instances.

It takes 5 to 15 minutes to create a DCS instance.

After a DCS instance has been successfully created, it enters the Running state by default.

l If the billing mode is Pay-per-use:– If the new DCS instance failed to be created, delete the unsuccessful instance

creation task by following the procedure in Deleting Instance Creation TasksThat Have Failed to Run. Then, create the DCS instance again. If the DCSinstance still fails to be created, contact customer service.

l If the billing mode is Yearly/Monthly:– The new DCS instances can be created only after you make the required payment.– If the new DCS instance failed to be created, this is because required resources are

not available. Contact customer service or go to My Orders to cancel the order.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 18

Page 22: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

2.2.4 Buying a DCS IMDG InstanceCurrently, you can buy a DCS IMDG instance in pay-per-use mode, and customize thecomputing capabilities and storage space of the DCS IMDG instance based on your servicerequirements.

NOTE

This operation is supported only in some regions. The DCS console prevails.

Prerequisites

The VPC where the DCS instance is to be created is available. Security groups and subnetshave been configured for the VPC.

For more information on how to create VPCs, security groups, and subnets, see 2.1 SettingUp Environments or the Virtual Private Cloud User Guide.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 Click Buy Cache Instance.

Step 5 Set Billing Mode to Pay-per-use.

Step 6 Specify DCS instance parameters, such as the name, AZ, VPC, security group, and subnet.

Table 2-4 DCS instance parameters

Parameter Description

Region Region in which DCS is located. To select a different region, use theregion selector at the upper left of the main menu bar.

Name Name of the new DCS instance.A DCS instance name cannot be left unspecified and must:l Consist of 4 to 64 characters.l Consist of only letters, digits, hyphens (-), and underscores (_).l Start with an uppercase or lowercase letter.

Description Description of the new DCS instance.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 19

Page 23: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

Cache Engine Cache engine used. Select IMDG.

Instance Type Type of the DCS instance being created. DCS IMDG instances support thesingle-node and cluster types.Select an instance type based on your service scenario.

AZ AZ in which the new DCS instance resides.NOTE

Deploying a DCS instance across AZs slightly reduces network efficiency comparedwith deploying a DCS instance in the same AZ. Therefore, if a DCS instance isdeployed across AZs, synchronization between master and standby cache nodes isslightly less efficient.

Cross-AZDeployment

An indicator of whether to enable cross-AZ deployment.

Standby AZ Standby AZ in which the new DCS instance resides.NOTE

This parameter is displayed if the following conditions are true:

l Cross-AZ Deployment is enabled.

l The DCS instance is of the cluster type.

l Multiple AZs exist.

InstanceSpecification

Total memory of the new DCS instance.Specifications of DCS IMDG instances are as follows:l Single-node instances: 2 GB, 4 GB, and 8 GB.l Cluster instances: 16 GB.By default, each user can create a maximum of five DCS instances anduse a total of 400 GB memory.If you need more memory, click Increase quota below the InstanceSpecification field. On the displayed page, fill in the quota applicationform and click Submit.

VPC VPC in which the new DCS instance resides.Click View VPC to show more details of the chosen VPC, includingsecurity group rules.

Subnet Name and IP address range of the subnet in which the new DCS instanceresides.

SecurityGroup

Security group that controls access to the new DCS instance.

User Username required for accessing the new DCS instance.The username must:l Consist of 1 to 64 characters.l Consist of only uppercase or lowercase letters, digits, and hyphens (-).l Start with an uppercase or lowercase letter.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 20

Page 24: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter Description

PasswordConfirmPassword

Password required for accessing the new DCS instance.NOTE

l These parameters are displayed only when Password-Free Access is disabled.

l For security purposes, if password-free access is disabled, the system promptsyou to enter an instance-specific password when you are accessing the DCSinstance. Keep your instance password secure and change it periodically.

Passwords for DCS IMDG instances must:l Consist of 6 to 32 characters.l Contain at least two of the following character types: uppercase letters,

lowercase letters, digits, and special characters (`~!@#$^&*()-_=+\|{}:,<.>/?).

l Cannot be the username or the username spelled backwards.

Time Window Time range for any scheduled maintenance activities for cache nodes ofthis DCS instance.Values:l 22:00-02:00l 02:00-06:00l 06:00-10:00l 10:00-14:00l 14:00-18:00l 18:00-22:00

BackupPolicy

Data backup policy. This parameter is displayed only when the instancetype is master/standby. For more information on how to configure abackup policy, see 6 Backing Up and Restoring DCS Instances.

Step 7 Review the instance information and click Next.

A confirmation page is displayed, providing information about the new DCS instance,including instance name, cache engine version, and instance specifications.

Step 8 Confirm the instance information, and click Submit.

Step 9 After the new DCS instance has been created, return to the Cache Manager page to view andmanage 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 bydefault.

3. If the new DCS instance failed to be created, delete the unsuccessful instance creationtask by following the procedure in Deleting Instance Creation Tasks That HaveFailed to Run. Then, create the DCS instance again. If the DCS instance still fails to becreated, contact customer service.

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 21

Page 25: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

2.3 Accessing a DCS InstanceYou can access DCS instances either through a Redis or Memcached client. In addition,applications can be developed and deployed through IMDG APIs.

2.3.1 RestrictionsRestrictions are imposed on clients for accessing DCS instances.

When accessing a DCS instance through a client on an ECS in the same VPC, note that:

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

l If the ECS and DCS instance are in different VPCs, establish a VPC peering connectionto achieve network connectivity between the ECS and DCS instance. For details, see DoDCS Instances Support Cross-VPC Access?

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

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.2 Accessing a DCS Redis Instance Through redis-cliAccess a DCS Redis instance through redis-cli on an ECS in the same VPC. For moreinformation on how to use other Redis clients, visit https://redis.io/clients.

Prerequisitesl The DCS Redis instance you want to access is in the Running state.l 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.l If the ECS runs the Linux OS, ensure that the GCC compilation environment has been

installed on the ECS.

Procedure

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 22

Page 26: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Access the DCS Redis instance by using redis-cli.

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

1. Download the source code package of your Redis client from http://download.redis.io/releases/redis-3.0.7.tar.gz.

2. Upload the source code package of your Redis client to the ECS serving as your Redisclient.

3. Log in to the ECS that serves as your Redis client.

4. Run the following command to decompress the redis-3.0.7 directory from the sourcecode package of your Redis client:

tar -xzf redis-3.0.7.tar.gz5. Run the following commands to go to the redis-3.0.7 directory and compile the source

code of your Redis client:

cd redis-3.0.7make

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

cd src./redis-cli -h XXX -p 6379In this command, XXX is an example IP address/domain name of DCS instance and6379 is an example port number of DCS instance, which are obtained in Step 1.

7. If you have set a password for the DCS instance, enter the password in this step. You canread and write cached data only after the password is verified.

auth passwordIn this command, password indicates the password used for login to the chosen DCSRedis instance. This password is defined during DCS Redis instance creation.

If information similar to the following is displayed, access to the chosen DCS Redisinstance is granted, and you can now read from and write to the chosen DCS Redisinstance:[root@dcs-vm ~]# ./redis-cli -h 192.168.0.148 -p 6379192.168.0.148:6379> auth ******OK192.168.0.148:6379>

NOTE

Download the Windows Redis client installation package. Decompress the Redis installation package,open the CLI tool cmd.exe, and go to the directory where the decompressed Redis client installationpackage is saved. Then, run the following command to access the DCS Redis instance:

redis-cli -h XXX -p 6379 -a <password>

In this command:

l XXX is an example IP address/domain name of DCS instance and 6379 is an example port numberof DCS instance, which are obtained in Step 1. Specify these parameters as required before runningthe command.

l <password> is an example password of DCS instance. Specify an actual password before runningthe command.

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 23

Page 27: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.3 Accessing a DCS Redis Instance Through JedisAccess a DCS Redis instance through Jedis on an ECS in the same VPC. For moreinformation on how to use other Redis clients, visit https://redis.io/clients.

Prerequisitesl The DCS Redis instance you want to access is in the Running state.l 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.l If the ECS runs the Linux OS, ensure that the GCC compilation environment has been

installed on the ECS.

Procedure

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Log in to the ECS that serves as your Redis client.

Step 3 Access the DCS instance by using Jedis.

1. Obtain the source code of the Jedis client from https://github.com/xetorthio/jedis.2. Write code.

a. Example code for a single Jedis connection//Create a connection String host = "192.168.0.150"; int port = 6379; String pwd = "passwd"; Jedis client = new Jedis(host, port); client.auth(pwd); client.connect(); //Run the set command String result = client.set("key-string", "Hello, Redis!"); System.out.println( String.format("set command result:%s", result) ); //Run the get command String value = client.get("key-string"); System.out.println( String.format("get command result:%s", value) );

b. Example code for a Jedis pool//Generate configuration information of a Jedis pool String ip = "192.168.0.150"; int port = 6379; String pwd = "passwd";

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 24

Page 28: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setTestOnBorrow(false); config.setTestOnReturn(false); config.setMaxTotal(100); config.setMaxIdle(100); config.setMaxWaitMillis(2000); JedisPool pool = new JedisPool(config, ip, port, 100000, pwd);//Generate a Jedis pool when the application is being initialized //Get a Jedis connection from the Jedis pool when a service operation occurs Jedis client = pool.getResource(); try { //Run commands String result = client.set("key-string", "Hello, Redis!"); System.out.println( String.format("set command result:%s", result) ); String value = client.get("key-string"); System.out.println( String.format("get command result:%s", value) ); } catch (Exception e) { // TODO: handle exception } finally { //Return the Jedis connection to the Jedis pool when the service operation is completed if (null != client) { pool.returnResource(client); } } // end of try block //Destroy the Jedis pool when the application is closed pool.destroy();

In the example code, ip is an example IP address/domain name of DCS instance andport is an example port number of DCS instance, which are obtained in Step 1. pwd isan example password of DCS instance. Specify these parameters as required beforerunning the code.

3. Compile code according to the readme file in the source code of the Jedis client. Run theJedis client to access the chosen DCS Redis instance.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.4 Accessing a DCS Redis Instance Through phpredisAccess a DCS Redis instance through phpredis on an ECS in the same VPC. For moreinformation on how to use other Redis clients, visit https://redis.io/clients.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 25

Page 29: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Prerequisitesl The DCS Redis instance you want to access is in the Running state.l 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.l If the ECS runs the Linux OS, ensure that the GCC compilation environment has been

installed on the ECS.

Procedure

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Log in to the ECS that serves as your Redis client.

Step 3 Install GCC-C++ and Make compilation components.

yum install gcc-c++ make

Step 4 Install the PHP development package and CLI tool.

Run the following yum command to install the PHP development package:

yum install php-devel php-common php-cli

After the installation is complete, run the following command to query the PHP version andcheck whether the installation is successful:

php -version

Step 5 Install the phpredis client.

1. Run the following command to download the source phpredis package:wget http://pecl.php.net/get/redis-4.1.0RC3.tgzThe phpredis client downloaded by running the preceding command is of the latestversion. To download phpredis clients of other versions, visit the Redis or PHP officialwebsite.

2. Run the following commands to decompress the source phpredis package:tar -zxvf redis-4.1.0RC3.tgzcd redis-4.1.0RC3

3. Run the following extension command before compilation:phpize

4. Run the following command to configure the php-config file:./configure --with-php-config=/usr/bin/php-configThe location of the file varies depending on the OS and PHP installation mode. You areadvised to locate the directory where the file is saved before the configuration.find / -name php-config

5. Run the following command to compile and install the phpredis client:make && make install

6. After the installation, add the extension configuration in the php.ini file to reference theRedis module.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 26

Page 30: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

vim /usr/local/php/etc/php.ini

Add the following configuration:extension = "/usr/lib64/php/modules/redis.so"

NOTE

The redis.so file may be saved in another directory. Locate the directory before you add theextension configuration.

7. Save the configuration and exit. Then, run the following command to check whether theextension takes effect:

php -m |grep redis

If the command output contains redis, the phpredis client environment has been set up.

Step 6 Access the DCS instance by using phpredis.

1. Edit a redis.php file.<?php $redis_host = "{redis_instance_address}"; $redis_port = 6379; $user_pwd = "{password}"; $redis = new Redis(); if ($redis->connect($redis_host, $redis_port) == false) { die($redis->getLastError()); } if ($redis->auth($user_pwd) == false) { die($redis->getLastError()); } if ($redis->set("welcome", "Hello, DCS for Redis!") == false) { die($redis->getLastError()); } $value = $redis->get("welcome"); echo $value; $redis->quit();?>

In the example code, {redis_instance_address} is an example IP address/domain nameof DCS instance and 6379 is an example port number of DCS instance, which areobtained in Step 1. {password} is an example password of DCS instance. Specify theseparameters as required before running the code.

2. Run the php redis.php command to access the DCS instance.

NOTE

l If an error is reported after the preceding command is executed, the configurations are incorrect. Inthis case, perform the preceding steps to check and reconfigure the parameters.

l If there is no response after the command is executed, the network connection may be abnormal. Inthis case, check the following:

– Whether the IP address and port number of the DCS instance are correct.

– Whether the ECS and DCS instance belong to the same VPC and security group.

If the ECS and DCS instance are in different VPCs, establish a VPC peering connection toachieve network connectivity between the ECS and DCS instance. For details, see Do DCSInstances Support Cross-VPC Access?

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

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 27

Page 31: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.5 Accessing a DCS Redis Instance Through hiredisAccess a DCS Redis instance through hiredis on an ECS in the same VPC. For moreinformation on how to use other Redis clients, visit https://redis.io/clients.

Prerequisitesl The DCS Redis instance you want to access is in the Running state.l 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.l If the ECS runs the Linux OS, ensure that the GCC compilation environment has been

installed on the ECS.

Procedure

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Log in to the ECS that serves as your Redis client.

Step 3 Install GCC, Make, and hiredis.

If the system does not provide a compiling environment, run the following yum command toinstall the environment:

yum install gcc make

Step 4 Run the following command to download and decompress the hiredis package:

wget https://github.com/redis/hiredis/archive/master.zip;

Step 5 Go to the directory where the decompressed hiredis package is saved, and compile and installhiredis.

make

make install

Step 6 Access the DCS instance by using hiredis.

The following describes connection and password authentication of hiredis. For moreinformation on how to use hiredis, visit the Redis official website.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 28

Page 32: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

1. Edit the sample code for connecting to a DCS instance, and then save the code and exit.

vim connRedis.c

Example:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <hiredis.h>int main(int argc, char **argv) { unsigned int j; redisContext *conn; redisReply *reply; if (argc < 3) { printf("Usage: example {instance_ip_address} 6379 {password}\n"); exit(0); } const char *hostname = argv[1]; const int port = atoi(argv[2]); const char *password = argv[3]; struct timeval timeout = { 1, 500000 }; // 1.5 seconds conn = redisConnectWithTimeout(hostname, port, timeout); if (conn == NULL || conn->err) { if (conn) { printf("Connection error: %s\n", conn->errstr); redisFree(conn); } else { printf("Connection error: can't allocate redis context\n"); } exit(1); } /* AUTH */ reply = redisCommand(conn, "AUTH %s", password); printf("AUTH: %s\n", reply->str); freeReplyObject(reply);

/* Set */ reply = redisCommand(conn,"SET %s %s", "welcome", "Hello, DCS for Redis!"); printf("SET: %s\n", reply->str); freeReplyObject(reply);

/* Get */ reply = redisCommand(conn,"GET welcome"); printf("GET welcome: %s\n", reply->str); freeReplyObject(reply);

/* Disconnects and frees the context */ redisFree(conn); return 0;}

2. Run the following command to compile the code:

gcc connRedis.c -o connRedis -I /usr/local/include/hiredis -lhiredis

If an error is reported, locate the directory where the hiredis.h file is saved and modifythe compilation command.

After the compilation, an executable connRedis file is obtained.

3. Run the following command to access the chosen DCS Redis instance:

./connRedis {redis_ip_address} 6379 {password}

In this command, {redis_instance_address} is an example IP address/domain name ofDCS instance and 6379 is an example port number of DCS instance, which are obtainedin Step 1. {password} is an example password of DCS instance. Specify theseparameters as required before running the command.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 29

Page 33: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

You have successfully accessed the instance if the following command output isdisplayed:AUTH: OKSET: OKGET welcome: Hello, DCS for Redis!

If an error is reported, indicating that the hiredis library files cannot be found, run thefollowing commands to copy related files to the system directories and add dynamic links:

mkdir /usr/lib/hiredis

cp /usr/local/lib/libhiredis.so.0.13 /usr/lib/hiredis/

mkdir /usr/include/hiredis

cp /usr/local/include/hiredis/hiredis.h /usr/include/hiredis/

echo '/usr/local/lib' &gt;&gt;/etc/ld.so.conf

ldconfig

Replace the locations of the so and .h files with actual ones before running the commands.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.6 Accessing a DCS Redis Instance Through redis-pyAccess a DCS Redis instance through redis-py on an ECS in the same VPC. For moreinformation on how to use other Redis clients, visit https://redis.io/clients.

Prerequisitesl The DCS Redis instance you want to access is in the Running state.

l 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.

l If the ECS runs the Linux OS, ensure that the GCC compilation environment has beeninstalled on the ECS.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 30

Page 34: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Procedure

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Log in to the ECS that serves as your Redis client.

Step 3 Install Python and redis-py.

1. If the system does not provide Python, run the following yum command to installPython:

yum install python

2. Run the following command to download and decompress the redis-py package:

wget https://github.com/andymccurdy/redis-py/archive/master.zip;

3. Go to the directory where the decompressed redis-py package is saved, and install redis-py.

python setup.py install

After the installation, run the python command. redis-py have been successfullyinstalled if the following command output is displayed:Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import redis>>>

Step 4 Access the DCS Redis instance by using redis-py.

In the following steps, commands are executed in CLI mode. (Alternatively, write thecommands into a Python script and then execute the script.)

1. Run the python command to enter the CLI mode.

You have entered CLI mode if the following command output is displayed:Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import redis>>>

2. Run the following command to access the chosen DCS Redis instance:r = redis.StrictRedis(host='192.168.0.171', port=6379, password='******');

In this command, 192.168.0.171 is the IP address/domain name of the chosen DCSinstance and 6379 is the port number of this instance, which are obtained in Step 1.****** indicates the password of the chosen DCS instance. Replace these values withactual ones before running the command.

You have successfully accessed the instance if the following command output isdisplayed:Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import redis>>> r = redis.StrictRedis(host='192.168.0.171', port=6379, password='******');>>>

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 31

Page 35: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.7 Accessing a DCS Redis Instance Through Node.js Clientioredis

Access a DCS Redis instance through ioredis on an ECS in the same VPC. For moreinformation on how to use other Redis clients, visit https://redis.io/clients.

Prerequisitesl The DCS Redis instance you want to access is in the Running state.l 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.l If the ECS runs the Linux OS, ensure that the GCC compilation environment has been

installed on the ECS.

Procedurel For client servers running Ubuntu (Debian series):

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Install Node.js.

apt install nodejs-legacy

If the preceding command does not work, run the following commands:

wget https://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz --no-check-certificate ;

tar -xvf node-v0.12.4.tar.gz;

cd node-v0.12.4;

./configure;

make;

make install;

NOTE

After the installation is complete, run the node --version command to query the Node.js version tocheck whether the installation is successful.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 32

Page 36: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 3 Install the node package manager (npm).

apt install npm

Step 4 Install the Redis client ioredis.

npm install ioredis

Step 5 Edit the sample script for connecting to a DCS instance.

Add the following content to the ioredisdemo.js script, including information aboutconnection and data reading.

var Redis = require('ioredis');var redis = new Redis({ port: 6379, // Redis port host: '192.168.0.196', // Redis host family: 4, // 4 (IPv4) or 6 (IPv6) password: '******', db: 0}); redis.set('foo', 'bar');redis.get('foo', function (err, result) { console.log(result);}); // Or using a promise if the last argument isn't a functionredis.get('foo').then(function (result) { console.log(result);});// Arguments to commands are flattened, so the following are the same:redis.sadd('set', 1, 3, 5, 7);redis.sadd('set', [1, 3, 5, 7]);// All arguments are passed directly to the redis server:redis.set('key', 100, 'EX', 10);

In the script, host is the IP address/domain name and port is the port number of this instance,which are obtained in Step 1. ****** indicates the password of the chosen DCS instance.Specify these parameters as required before running the script.

Step 6 Run the sample script to access the chosen DCS instance.

node ioredisdemo.js

----End

l For client servers running CentOS (Red Hat series):

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Install Node.js.

yum install nodejs

If the preceding command does not work, run the following commands:

wget https://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz --no-check-certificate ;

tar -xvf node-v0.12.4.tar.gz;

cd node-v0.12.4;

./configure;

make;

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 33

Page 37: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

make install;

NOTE

After the installation is complete, run the node --version command to query the Node.js version tocheck whether the installation is successful.

Step 3 Install npm.

yum install npm

Step 4 Install the Redis client ioredis.

npm install ioredis

Step 5 Edit the sample script for connecting to a DCS instance.

Add the following content to the ioredisdemo.js script, including information aboutconnection and data reading.

var Redis = require('ioredis');var redis = new Redis({ port: 6379, // Redis port host: '192.168.0.196', // Redis host family: 4, // 4 (IPv4) or 6 (IPv6) password: '******', db: 0});redis.set('foo', 'bar');redis.get('foo', function (err, result) { console.log(result);});// Or using a promise if the last argument isn't a functionredis.get('foo').then(function (result) { console.log(result);}); // Arguments to commands are flattened, so the following are the same:redis.sadd('set', 1, 3, 5, 7);redis.sadd('set', [1, 3, 5, 7]); // All arguments are passed directly to the redis server:redis.set('key', 100, 'EX', 10);

In the script, host is the IP address/domain name and port is the port number of this instance,which are obtained in Step 1. ****** indicates the password of the chosen DCS instance.Specify these parameters as required before running the script.

Step 6 Run the sample script to access the chosen DCS instance.

node ioredisdemo.js

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 34

Page 38: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

2.3.8 Accessing a DCS Redis Instance Through C# ClientStackExchange.Redis

Access a DCS Redis instance through StackExchange.Redis on an ECS in the same VPC. Formore information on how to use other Redis clients, visit https://redis.io/clients.

Prerequisitesl The DCS Redis instance you want to access is in the Running state.l 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.l If the ECS runs the Linux OS, ensure that the GCC compilation environment has been

installed on the ECS.

Procedure

Step 1 View the IP address/domain name and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Log in to the ECS that serves as your Redis client.

For this example, the Windows OS is used on the ECS.

Step 3 Install Visual Studio Community 2017 on the ECS.

Step 4 Start Visual Studio 2017 and create a project.

Set the project name to redisdemo.

Step 5 Install StackExchange.Redis by using the NuGet package manager of Visual Studio.

Access the NuGet package manager console, and enter Install-PackageStackExchange.Redis -Version 1.2.6 (the version number is optional) on the console.

Figure 2-1 Accessing the NuGet package manager console

Step 6 Write the following code, and use the String Set and Get methods to test the connection.using System;using StackExchange.Redis;

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 35

Page 39: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

namespace redisdemo{ class Program { // redis config private static ConfigurationOptions connDCS = ConfigurationOptions.Parse("10.10.38.233:6379,password=********,connectTimeout=2000"); //the lock for singleton private static readonly object Locker = new object(); //singleton private static ConnectionMultiplexer redisConn; //singleton public static ConnectionMultiplexer getRedisConn() { if (redisConn == null) { lock (Locker) { if (redisConn == null || !redisConn.IsConnected) { redisConn = ConnectionMultiplexer.Connect(connDCS); } } } return redisConn; } static void Main(string[] args) { redisConn = getRedisConn(); var db = redisConn.GetDatabase(); //set get string strKey = "Hello"; string strValue = "DCS for Redis!"; Console.WriteLine( strKey + ", " + db.StringGet(strKey));

Console.ReadLine(); } }}

In the example code, 10.10.38.233:6379 is the chosen IP address/domain name of the chosenDCS instance, which is obtained in Step 1. ******** indicates the password of the chosenDCS instance. Specify these parameters as required before running the code.

Step 7 Run the code. You have successfully accessed the instance if the following command outputis displayed:Hello, DCS for Redis!

For more information about other commands of StackExchange.Redis, visit https://stackexchange.github.io/StackExchange.Redis/.

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 36

Page 40: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.9 Accessing a DCS Redis Instance Over a Public NetworkAccessing a DCS Redis instance over a public network helps R&D personnel to establish alocal development or test environment, thereby improving development efficiency. In theproduction environment (formal environment), access a DCS Redis instance through a VPCto ensure efficient access.

This section describes how to establish a network channel between the local environment anda DCS Redis instance, and all examples assume you are using redis-cli to access the instanceover the public network. For details on how to use other Redis clients, visit https://redis.io/clients.

Prerequisites

Before using redis-cli to access a DCS Redis instance over a public network, ensure that:

l A DCS Redis instance has been created in password mode and is in the Running state.

l Public access has been enabled for the DCS instance. For details, see 4.5 EnablingPublic Access to a DCS Redis Instance.

l If a certificate is required for accessing the DCS instance, download the certificate inadvance on the DCS instance details page. For details, see 2.4 Viewing Details of a DCSInstance.

l Correct rules (permitting external access to port 36379) have been configured for thesecurity group of the DCS instance. For details, see How to Select and Configure aSecurity Group?

Installing and Configuring the Stunnel Client (Windows)

Step 1 View the EIP and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Create an encrypted connection by using Stunnel.

1. Download the latest Windows Stunnel installation package (for example, stunnel-5.44-win32-installer.exe) from http://www.stunnel.org/downloads.html to the localWindows device.

2. Run the Stunnel installation program and install the Stunnel client.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 37

Page 41: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

3. Configure the Stunnel client: Right-click on the taskbar, choose Edit Configurationfrom the shortcut menu, add the following configuration, and then save the configurationand exit.[redis-client]client = yesCAfile = D:\tmp\dcs\dcs-ca.ceraccept = 8000connect = {EIP}:{port number}In the configuration:– client: indicates the Stunnel client. The fixed value is yes.– CAfile: specifies a CA certificate, which is optional. If a CA certificate is required,

download the certificate on the DCS instance details page by referring to 2.4Viewing Details of a DCS Instance. If it is not required, delete this parameter.

– accept: specifies the user-defined listening port number of the Stunnel client.Specify this parameter when accessing a DCS instance by using a Redis client.

– connect: specifies the forwarding address and port number of the Stunnel client. Setthis parameter to the IP address and port number of the DCS Redis instance to beaccessed. EIP and port number are replaced with those obtained in Step 1.

4. Right-click on the taskbar and choose Reload Configuration from the shortcutmenu.

5. Open the CLI tool cmd.exe and run the following command to check whether port127.0.0.1:8000 is being listened:netstat -an |find "8000"Assume that port 8000 is configured as the listening port on the client.If 127.0.0.1:8000 is displayed in the returned result and its status is LISTENING, theStunnel client is running properly. When the Redis client connects to port127.0.0.1:8000, the Stunnel client will forward requests to the DCS Redis instance.

----End

Installing and Configuring the Stunnel Client (Linux)

Step 1 View the EIP and port number of the DCS Redis instance to be accessed.

For details, see 2.4 Viewing Details of a DCS Instance.

Step 2 Create an encrypted connection by using Stunnel.

1. Log in to the local Linux device.2. Install the Stunnel client.

The following describes how to install Stunnel clients in different ways.

NOTE

Installation methods apt and yum are recommended. Any common Linux OSs should support atleast one of the installation methods.

For details on how to install a Stunnel client in other common OSs, see:

How to Install a Stunnel Client in the MAC OS?

a. apt-get method: apt-get is used to manage DEB software packages and applicableto Debian OSs such as Ubuntu. Run the following command to install the Stunnelclient:

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 38

Page 42: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

apt install stunnel or apt-get install stunnelIf you cannot find the Stunnel client after running the command, run the apt updatecommand to update the configuration and then install the Stunnel client again.

b. yum method: yum is used to manage RPM software packages and applicable toOSs such as Fedora, CentOS, and Red Hat. Run the following command to installthe Stunnel client:yum install stunnel

c. Use other general methods to install the Stunnel client. For the UNIX OS, you canalso download a Stunnel installation package and install it after compilation. Asprerequisites to installing the Stunnel client, the GCC compilation environment andopenssl-devel tool must be available. If you encounter difficulties during theinstallation, seek help on the official Stunnel website.After downloading and decompressing the Stunnel package, go to the directorywhere the decompressed package is saved and run the following commands tocompile and install the Stunnel client:./configure;make && make install;

3. After installing the Stunnel tool, edit the /etc/default/stunnel4 file, and set ENABLEDto 1.

NOTE

The name of the configuration file may vary depending on the version of the Linux OS. You canfind the file in the /etc/default/ directory.

... ENABLED=1...

4. Open the configuration file.The Stunnel configuration file is named stunnel.conf and can be stored in any directory.Specify this configuration file when starting the Stunnel client.Alternatively, add a configuration file by using the following default methods:

a. apt-getIf the /etc/stunnel/stunnel.conf directory storing the configuration file does notexist or no configuration file exists in the directory, add a directory or configurationfile.

b. yumIf the /usr/local/stunnel/stunnel.conf directory storing the configuration file doesnot exist or no configuration file exists in the directory, add a directory orconfiguration file.

c. Other general methodsIf the /usr/local/stunnel/stunnel.conf directory storing the configuration file doesnot exist or no configuration file exists in the directory, add a directory orconfiguration file.

NOTE

If you are not sure where to store the configuration file, enter the stunnel command after theinstallation to view the directory for storing the configuration file.

5. Add the following content to the configuration file, and then save and exit.debug = 4output = /var/log/stunnel.log

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 39

Page 43: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

sslVersion = all[redis-client]client = yesaccept = 8000connect = {EIP}:{port number}CAfile = /etc/stunnel/dcs-ca.cerIn the configuration:– client: indicates the Stunnel client. The fixed value is yes.– CAfile: specifies a CA certificate, which is optional. If a CA certificate is required,

download the certificate on the DCS instance details page. For details, see 2.4Viewing Details of a DCS Instance. If it is not required, delete this parameter.

– accept: specifies the user-defined listening port number of the Stunnel client.Specify this parameter when accessing a DCS instance by using a Redis client.

– connect: specifies the forwarding address and port number of the Stunnel client. Setthis parameter to the IP address and port number of the DCS Redis instance to beaccessed. EIP and port number are replaced with those obtained in Step 1.

6. Start the Stunnel service.

a. If you use the default Stunnel configuration file, run the following command:stunnel

b. If you customize the directory for storing the configuration file, run the followingcommand:stunnel /{customdir}/stunnel.conf/{customdir} /stunnel.conf indicates the customized file storage directory.

c. For the Ubuntu OS, run the service stunnel4 start or systemctl start stunnel4command to start the Stunnel client. The service or process name is stunnel4 for theStunnel4.x version.

After starting the Stunnel client, run the ps -ef|grep stunnel command to check whetherthe process is running properly.

7. Run the following command to check whether port 127.0.0.1:8000 is being listened:netstat -plunt |grep 8000|grep "LISTEN"If 127.0.0.1:8000 is displayed in the returned result, the Stunnel client is runningproperly. When the Redis client connects to port 127.0.0.1:8000, the Stunnel client willforward requests to the DCS Redis instance.

----End

Accessing a DCS Redis InstanceThis section describes how to use redis-cli to access a DCS Redis instance.

Step 1 Perform the following steps to access a DCS Redis instance in the Windows OS.

1. Download the Redis client installation package to the local Windows device anddecompress the package.To download the Windows Redis client installation package, click here.

2. Open the CLI tool cmd.exe and run commands to go to the directory where thedecompressed Redis client installation package is saved.For example, to go to the D:\redis-64.3.0.503 directory, run the following commands:D:

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 40

Page 44: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

cd D:\redis-64.3.0.503

3. Run the following command to access the chosen DCS Redis instance:

redis-cli -p 8000 -a <password>

8000 indicates the user-defined listening port number of the Stunnel client configured inthe accept field in Step 2.3 and <password> indicates the password you define whencreating the DCS instance. Specify an actual password before running the command.

You have successfully accessed the instance if the following command output isdisplayed:127.0.0.1:8000>

After you enter info, the DCS instance information is returned. If no information isreturned or the connection is interrupted, right-click the Stunnel icon on the taskbar andchoose Show Log Window from the shortcut menu to show logs of the Stunnel clientfor cause analysis.

Step 2 Perform the following steps to access a DCS Redis instance in the Linux OS.

1. Download source code of your Redis client from http://download.redis.io/releases/redis-3.0.7.tar.gz.

2. Upload the downloaded source code package of your Redis client to the local Linuxdevice.

3. Log in to the local Linux device.

4. Run the following command to decompress the source code package of your Redisclient:

tar -xzf redis-3.0.7.tar.gz

5. Run the following commands to go to the redis-3.0.7 directory and compile the sourcecode of your Redis client:

cd redis-3.0.7

make

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

cd src

./redis-cli -p 8000

8000 indicates the user-defined listening port number of the Stunnel client configured inthe accept field in Step 2.5.

7. Enter the password. You can read and write cached data only after the password isverified.

auth <password>

<password> indicates the password you define when creating the DCS instance. Specifyan actual password before running the command.

You have successfully accessed the instance if the following command output isdisplayed:OK 127.0.0.1:8000>

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 41

Page 45: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.10 Accessing a DCS Memcached InstanceAny client compatible with the Memcached protocol can access DCS Memcached instances.DCS can work with any Memcached client that supports text or binary protocol.

This section describes how to access a DCS Memcached instance using Telnet, Java, andPython clients.

Prerequisitesl The DCS Memcached instance you want to access is in the Running state.

l Password-free access is enabled.This is required only when a Telnet client is used to access the Memcached instance.Other clients support both password-free and password-protected access.For details on how to enable password-free access, see 7.4 Enabling Password-freeAccess to a DCS Memcached Instance.

l An ECS has been created to serve as your Memcached client.For details on how to create ECSs, see the Elastic Cloud Server User Guide.

NOTE

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

If the ECS and DCS instance are in different VPCs, establish a VPC peering connection to achievenetwork connectivity between the ECS and DCS instance. For details, see Do DCS InstancesSupport Cross-VPC Access?

If different security groups have been configured for the ECS and DCS instance, set security grouprules to achieve network connectivity between the ECS and DCS instance. For details, see How toSelect and Configure a Security Group?

l All annotations in example code have been deleted.

l All command lines and code blocks are UTF-8 encoded.Using another encoding scheme will cause compilation problems or even commandfailures.

Procedure for Telnet Clients

Telnet clients' access to DCS Memcached instances must be password-protected. Telnetclients must use the Memcached binary protocol to access DCS Memcached instances.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 42

Page 46: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

For details on how to enable password-free access, see 7.4 Enabling Password-free Accessto a DCS Memcached Instance.

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Obtain the Connection Address (IP address:port number) of the DCS Memcached instance.

1. On the Cache Manager page, click the name of the DCS Memcached instance you wantto access.A page with details of the DCS instance is displayed.

2. On the Summary tab page of the instance details page, view the Connection Address ofthe DCS instance.

Step 6 Access the chosen DCS Memcached instance.

1. Log in to the ECS that serves as your Telnet client.2. Run the following command to check whether the Telnet client is installed on the ECS:

which telnetIf the directory in which the Telnet client is installed is displayed, the Telnet client hasbeen installed on the ECS. If the client installation directory is not displayed, install theTelnet client manually.

NOTE

In the Windows OS, choose Start > Control Panel > Programs > Programs and Features >Turn Windows features on or off, and enable the Telnet client.

3. Run the following command to access the chosen DCS Memcached instance:telnet {ip address} {port}In this command:– {ip address} indicates the IP address of the DCS Memcached instance.– {port} indicates the port number of the DCS Memcached instance.Both the IP address or domain name and the port number are obtained in Step 5.When you have successfully accessed the chosen DCS Memcached instance, informationsimilar to the following is displayed:Trying XXX.XXX.XXX.XXX...Connected to XXX.XXX.XXX.XXX.Escape character is '^]'.Example commands for using the DCS Memcached instance (lines starting with set andget are the commands and the other lines are the command output):set hello 0 0 6world!STOREDget hello

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 43

Page 47: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

VALUE hello 0 6world!END

----End

Procedure for Java ClientsPrerequisites

l The Java development kit (JDK) and common integrated development environments(IDEs) such as Eclipse have been installed on the ECS.

l You have obtained the spymemcached-x.y.z.jar dependency package.

NOTE

x.y.z indicates the version of the dependency package. The latest version is recommended.

Step 1 Obtain the Connection Address (IP address/domain name:port number) of the DCS instance.

1. Log in to the management console.

2. Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

3. Click Service List, and choose Database > Distributed Cache Service to launch theDCS console.

4. In the navigation pane, choose Cache Manager.5. On the Cache Manager page, click the name of the DCS instance you want to access.

A page with details of the DCS instance is displayed.6. On the Summary tab page of the instance details page, view the Connection Address of

the DCS instance.

Step 2 Upload the obtained spymemcached-x.y.z.jar dependency package to the created ECS.

Step 3 Log in to the ECS.

Step 4 Create a Java project on Eclipse and import the spymemcached-x.y.z.jar dependencypackage. The project name is customizable..

Step 5 Create a ConnectMemcached1 class, copy the following Java code to the class, and modifythe code.l Example code for the password mode

Change ip address or domain name:port to the IP address and port number obtained inStep 1, and change userName and password respectively to the actual username andpassword of the DCS instance.

//Connect to the encrypted Memcached code using Java.import java.io.IOException;import java.util.concurrent.ExecutionException;

import net.spy.memcached.AddrUtil;import net.spy.memcached.ConnectionFactoryBuilder;import net.spy.memcached.ConnectionFactoryBuilder.Protocol;import net.spy.memcached.MemcachedClient;import net.spy.memcached.auth.AuthDescriptor;import net.spy.memcached.auth.PlainCallbackHandler;

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 44

Page 48: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

import net.spy.memcached.internal.OperationFuture;

public class ConnectMemcached1{ public static void main(String[] args) { final String connectionaddress = "ip address:port"; final String username = "userName";//Indicates the username. final String password = "password";//Indicates the password. MemcachedClient client = null; try { AuthDescriptor authDescriptor = new AuthDescriptor(new String[] {"PLAIN"}, new PlainCallbackHandler(username, password)); client = new MemcachedClient( new ConnectionFactoryBuilder().setProtocol(Protocol.BINARY) .setAuthDescriptor(authDescriptor) .build(), AddrUtil.getAddresses(connectionaddress)); String key = "memcached";//Stores data with the key being memcached in Memcached. String value = "Hello World";//The value is Hello World. int expireTime = 5; //Specifies the expiration time, measured in seconds. The countdown starts from the moment data is written. After the expireTime elapses, the data expires and can no longer be read. doExcute(client, key, value, expireTime);//Executes the operation. } catch (IOException e) { e.printStackTrace(); } }

/** *Method of writing data to Memcached */ private static void doExcute(MemcachedClient client, String key, String value, int expireTime) { try { OperationFuture<Boolean> future = client.set(key, expireTime, value); future.get();//spymemcached set () is asynchronous. future.get () waits until the cache.set () operation is completed, or does not need to wait. You can select based on actual requirements. System.out.println("The Set operation succeeded."); System.out.println("Get operation:" + client.get(key)); Thread.sleep(6000);//Waits for 6000 ms, that is, 6s. Then the data expires and can no longer be read. System.out.println("Perform the Get operation 6s later:" + client.get(key));

} catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } if (client != null) { client.shutdown(); } }}

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 45

Page 49: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

l Example code for the password-free mode

Change ip address or domain name:port to the IP address and port number obtained inStep 1.

//Connect to the password-free Memcached code using Java.import java.io.IOException;import java.util.concurrent.ExecutionException;

import net.spy.memcached.AddrUtil;import net.spy.memcached.BinaryConnectionFactory;import net.spy.memcached.MemcachedClient;import net.spy.memcached.internal.OperationFuture;

public class ConnectMemcached{ public static void main(String[] args) { final String connectionaddress = "ip address or domain name:port"; MemcachedClient client = null; try { client = new MemcachedClient(new BinaryConnectionFactory(), AddrUtil.getAddresses(connectionaddress)); String key = "memcached";//Stores data with the key being memcached in Memcached. String value = "Hello World";//The value is Hello World. int expireTime = 5; //Specifies the expiration time, measured in seconds. The countdown starts from the moment data is written. After the expireTime elapses, the data expires and can no longer be read. doExcute(client, key, value, expireTime);//Executes the operation. } catch (IOException e) { e.printStackTrace(); } }

/** *Method of writing data to Memcached */ private static void doExcute(MemcachedClient client, String key, String value, int expireTime) { try { OperationFuture<Boolean> future = client.set(key, expireTime, value); future.get();//spymemcached set () is asynchronous. future.get () waits until the cache.set () operation is completed, or does not need to wait. You can select based on actual requirements. System.out.println("The Set operation succeeded."); System.out.println("Get operation:" + client.get(key)); Thread.sleep(6000);//Waits for 6000 ms, that is, 6s. Then the data expires and can no longer be read. System.out.println("Perform the Get operation 6s later:" + client.get(key));

} catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } if (client != null) { client.shutdown(); }

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 46

Page 50: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

}}

Step 6 Run the main method. The following result is displayed in the Console window of Eclipse:The Set operation succeeded.Get operation: Hello WorldPerform the Get operation 6s later: null

----End

Procedure for Python Clients

Prerequisites

l Python has been installed on the ECS. The recommended version is 2.7.6 or later.l You have obtained the python-binary-memcached-x.y.z.zip dependency package.

NOTE

x.y.z indicates the version of the dependency package. The latest version is recommended.

Step 1 Obtain the Connection Address (IP address/domain name:port number) of the DCS instance.

1. Log in to the management console.

2. Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

3. Click Service List, and choose Database > Distributed Cache Service to launch theDCS console.

4. In the navigation pane, choose Cache Manager.5. On the Cache Manager page, click the name of the DCS instance you want to access.

A page with details of the DCS instance is displayed.6. On the Summary tab page of the instance details page, view the Connection Address of

the DCS instance.

Step 2 Upload the obtained dependency package (for example, the python-binary-memcached-x.y.z.zip package) to the created ECS.

Step 3 Log in to the ECS.

Step 4 Run the following commands to install the dependency package:

unzip -xzvf python-binary-memcached-x.y.z.zip

cd python-binary-memcached-x.y.z

python setup.py install

NOTE

If an error is reported during the installation, use the apt or yum installation method. For example, toinstall the dependency package by using the apt method, run the following commands:

apt install python-pip;

pip install python-binary-memcached;

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 47

Page 51: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 5 Create a Python file named dcs_test.py, copy the following Python code to the file, andmodify the code.l Example code for the password mode

Change ip address or domain name:port to the IP address and port number obtained inStep 1, and change userName and password respectively to the actual username andpassword of the DCS instance.import bmemcachedclient = bmemcached.Client(('ip address or domain name:port'), 'userName', 'password')print "set('key', 'hello world!')"print client.set('key', 'hello world!')print "get('key')"print client.get('key')

l Example code for the password-free modeChange ip address:port to the IP address and port number obtained in Step 1.import bmemcachedclient = bmemcached.Client('10.21.94.138:6381')print "set('key', 'hello world!')"print client.set('key', 'hello world!')print "get('key')"print client.get('key')

Step 6 Run the dcs_test.py file. The following result is displayed.

set('key', 'hello world!')Trueget('key')hello world!

----End

Procedure for C++ ClientsPrerequisites

l GCC has been installed on the ECS. The recommended version is 4.8.4 or later.l You have obtained the libmemcached-x.y.z.tar.gz dependency package.

NOTE

x.y.z indicates the version of the dependency package. The latest version is recommended.

Step 1 Obtain the Connection Address (IP address:port number) of the DCS instance.

1. Log in to the management console.

2. Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

3. Click Service List, and choose Database > Distributed Cache Service to launch theDCS console.

4. In the navigation pane, choose Cache Manager.5. On the Cache Manager page, click the name of the DCS instance you want to access.

A page with details of the DCS instance is displayed.6. On the Summary tab page of the instance details page, view the Connection Address of

the DCS instance.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 48

Page 52: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 2 Upload the obtained libmemcached-x.y.z.tar.gz dependency package to the created ECS.

Step 3 Log in to the ECS.

Step 4 Install related SASL dependency packages.

For OSs of Debian series: apt install libsasl2-dev cloog.ppl

For OSs of Red Hat series: yum install cyrus-sasl*

Step 5 Run the following commands to install the dependency package:

tar -xzvf libmemcached-x.y.z.tar.gz

cd libmemcached-x.y.z

./configure --enable-sasl

make

make install

Step 6 Create a file named build.sh and copy the following code to the file.g++ -o dcs_sample dcs_sample.cpp -lmemcached -std=c++0x -lpthread -lsasl2

Step 7 Create a file named dcs_sample.cpp, copy the following C++ code to the file, and modify thecode.l Example code for the password mode

Change ip address and port respectively to the IP address and port number obtained inStep 1, and change userName and password respectively to the actual username andpassword of the DCS instance.#include <iostream>#include <string>#include <libmemcached/memcached.h>using namespace std;

#define IP "ip address"#define PORT port#define USERNAME "userName"#define PASSWORD "password"memcached_return rusult;

memcached_st * init(){ memcached_st *memcached = NULL; memcached_server_st *cache; memcached = memcached_create(NULL); cache = memcached_server_list_append(NULL, IP, PORT, &rusult);

sasl_client_init(NULL); memcached_set_sasl_auth_data(memcached, USERNAME, PASSWORD); memcached_behavior_set(memcached,MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,1); memcached_server_push(memcached,cache); memcached_server_list_free(cache); return memcached;}

int main(int argc, char *argv[]){ memcached_st *memcached=init(); string key = "memcached"; string value = "hello world!"; size_t value_length = value.length(); int expire_time = 0;

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 49

Page 53: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

uint32_t flag = 0;

rusult = memcached_set(memcached,key.c_str(),key.length(),value.c_str(),value.length(),expire_time,flag); if (rusult != MEMCACHED_SUCCESS){ cout <<"set data failed: " << rusult << endl; return -1; } cout << "set succesed, key: " << key << ", value: " << value << endl; cout << "get key:" << key << endl; char* result = memcached_get(memcached,key.c_str(),key.length(),&value_length,&flag,&rusult); cout << "value:" << result << endl; memcached_free(memcached); return 0;}

l Example code for the password-free mode

Change ip address:port to the IP address and port number obtained in Step 1.#include <iostream>#include <string>#include <libmemcached/memcached.h>using namespace std;

#define IP "ip address"#define PORT portmemcached_return rusult;

memcached_st * init(){ memcached_st *memcached = NULL; memcached_server_st *cache; memcached = memcached_create(NULL); cache = memcached_server_list_append(NULL, IP, PORT, &rusult); memcached_server_push(memcached,cache); memcached_server_list_free(cache); return memcached;}

int main(int argc, char *argv[]){ memcached_st *memcached=init(); string key = "memcached"; string value = "hello world!"; size_t value_length = value.length(); int expire_time = 0; uint32_t flag = 0;

rusult = memcached_set(memcached,key.c_str(),key.length(),value.c_str(),value.length(),expire_time,flag); if (rusult != MEMCACHED_SUCCESS){ cout <<"set data failed: " << rusult << endl; return -1; } cout << "set succesed, key: " << key << " ,value: " << value << endl; cout << "get key:" << key << endl; char* result = memcached_get(memcached,key.c_str(),key.length(),&value_length,&flag,&rusult); cout << "value:" << result << endl; memcached_free(memcached); return 0;}

Step 8 Run the following commands to compile the source code:

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 50

Page 54: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

chmod 700 build.sh

./build.sh

The dcs_sample binary file is generated.

Step 9 Run the following command to access the chosen DCS Memcached instance:

./dcs_sampleset succesed, key: memcached ,value: hello world!get key:memcachedvalue:hello world!

----End

Procedure for PHP ClientsFor OSs of Red Hat series:

The following uses CentOS 7.0 as an example to describe how to install a PHP client and useit to access a DCS Memcached instance. The procedure is also applicable to a PHP clientrunning the Red Hat or Fedora OS.

Step 1 Install GCC-C++ and Make compilation components.

yum install gcc-c++ make

Step 2 Install related SASL packages.

yum install cyrus-sasl*

Step 3 Install the libMemcached library.

Installing the libMemcached library requires SASL authentication parameters. Therefore, youcannot install the library by running the yum command.

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

tar -xvf libmemcached-1.0.18.tar.gz

cd libmemcached-1.0.18

./configure --prefix=/usr/local/libmemcached --enable-sasl

make && make install

NOTE

Before installing the libMemcached library, install GCC-C++ and SASL components. Otherwise, anerror will be reported during compilation. After you resolve the error, run the make clean command andthen run the make command again.

Step 4 Install the PHP environment.

yum install php-devel php-common php-cli

Step 5 Install the Memcached client.

Note that you must add a parameter used to enable SASL when running the configurecommand.

wget http://pecl.php.net/get/memcached-2.1.0.tgz

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 51

Page 55: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

tar zxvf memcached-2.1.0.tgz

cd memcached-2.1.0

phpize

./configure --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached-sasl

make && make install

Step 6 Modify the php.ini file.

Run the find or locate command to find the php.ini file.

find / -name php.ini

Add the following two lines to the php.ini file:

extension=memcached.somemcached.use_sasl = 1

Step 7 Access a DCS Memcached instance.

Create a memcached.php file and add the following content to the file:<?php $connect = new Memcached; //Declares a Memcached connection. $connect->setOption(Memcached::OPT_COMPRESSION, false); //Disables compression. $connect->setOption(Memcached::OPT_BINARY_PROTOCOL, true); //Uses the binary protocol. $connect->setOption(Memcached::OPT_TCP_NODELAY, true); //Disables the TCP network delay policy. $connect->addServer('{memcached_instance_ip}', 11211); //Specifies the instance IP address and port number. $connect->setSaslAuthData('{username}', '{password}'); //If password-free access is enabled for the instance, delete or comment out this line. $connect->set("DCS", "Come on!"); echo 'DCS: ',$connect->get("DCS"); echo "\n"; $connect->quit();?>

Save and run the memcached.php file. The following result is displayed.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 52

Page 56: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

[root@testphpmemcached ~]# php memcached.php DCS: Come on![root@testphpmemcached ~]#

----End

For OSs of Debian series:

The following uses the Ubuntu OS as an example to describe how to install a PHP client anduse it to access a DCS Memcached instance.

Step 1 Install GCC and Make compilation components.

apt install gcc make

Step 2 Install the PHP environment.

PHP 5.x is recommended for better compatibility with SASL authentication.

Run the following commands to add the image source of PHP of an earlier version, and theninstall the php.56 and php.5.6-dev packages:

apt-get install -y language-pack-en-base;

LC_ALL=en_US.UTF-8;

add-apt-repository ppa:ondrej/php;

apt-get update;

apt-get install php5.6 php5.6-dev;

After the installation is complete, run the php -version command to check the PHP version. Ifthe following result is displayed, the PHP version is 5.6, indicating that PHP 5.6 issuccessfully installed.

root@dcs-nodelete:/etc/apt# php -versionPHP 5.6.36-1+ubuntu16.04.1+deb.sury.org+1 (cli) Copyright (c) 1997-2016 The PHP Group

NOTE

To uninstall PHP, run the following commands:

apt install aptitude -y

aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

Step 3 Install the SASL component.

apt install libsasl2-dev cloog.ppl

Step 4 Install the libMemcached library.

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

tar -xvf libmemcached-1.0.18.tar.gz

cd libmemcached-1.0.18

./configure --prefix=/usr/local/libmemcached

make && make install

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 53

Page 57: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

NOTE

Before installing the libMemcached library, install GCC-C++ and SASL components. Otherwise, anerror will be reported during compilation. After you resolve the error, run the make clean command andthen run the make command again.

Step 5 Install the Memcached client.

Install the zlib component.

apt install zlib1g.dev

Note that you must add a parameter used to enable SASL when running the configurecommand.

wget http://pecl.php.net/get/memcached-2.2.0.tgz;

tar zxvf memcached-2.2.0.tgz;

cd memcached-2.2.0;

phpize5.6;

./configure --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached-sasl;

make && make install;

Step 6 Modify the pdo.ini file.

Run the following command to find the pdo.ini file:

find / -name pdo.ini

By default, the pdo.ini file is stored in the /etc/php/5.6/mods-available directory. Add thefollowing two lines to the pdo.ini file:

extension=memcached.somemcached.use_sasl = 1

Step 7 Access a DCS Memcached instance.

Create a memcached.php file and add the following content to the file:

<?php $connect = new Memcached; //Declares a Memcached connection. $connect->setOption(Memcached::OPT_COMPRESSION, false); //Disables compression. $connect->setOption(Memcached::OPT_BINARY_PROTOCOL, true); //Uses the binary protocol. $connect->setOption(Memcached::OPT_TCP_NODELAY, true); //Disables the TCP network delay policy. $connect->addServer('{memcached_instance_ip}', 11211); //Specifies the instance IP address and port number. $connect->setSaslAuthData('{username}', '{password}'); //If password-free access is enabled for the instance, delete or comment out this line. $connect->set("DCS", "Come on!"); echo 'DCS: ',$connect->get("DCS");

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 54

Page 58: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

echo "\n"; $connect->quit();?>

Save and run the memcached.php file. The following result is displayed.

[root@dcs-nodelete ~]# php memcached.php DCS: Come on![root@dcs-nodelete ~]#

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.11 Accessing a DCS IMDG InstanceDCS IMDG SDK provides GridGain-based interfaces for third-party applications to read,write, and delete cached data.

For more information about these interfaces, see related reference documents. For details onhow to access a DCS IMDG instance, see the DCS IMDG Development Guide.

NOTE

This operation is supported only in some regions. The DCS console prevails.

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

2.3.12 Accessing a DCS2.0 Instance Through WebCliAccess a DCS2.0 instance through WebCli on the DCS console. Only DCS2.0 DCS instancessupport access through WebCli.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 55

Page 59: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

NOTE

This operation is supported only in some regions. The DCS console prevails.

PrerequisitesThe DCS2.0 instance you want to access through WebCli is in the Running state.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 In the Operation column of the instance, choose More > WebCli, as shown in Figure 2-2.

Figure 2-2 Accessing WebCli

Step 6 Enter the password of the DCS instance. On WebCli, select the current Redis database, enter aRedis command in the command box, and press Enter.

----End

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 56

Page 60: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

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

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 On the Cache Manager page, filter DCS instances by instance status and/or name to find thedesired DCS instance.

Table 2-5 DCS instance statuses

State Description

Creating The instance is being created.

Running The instance is running properly.Only instances in the Running state can provide in-memory cache service.

Faulty The instance is not running properly.

Starting The instance is being started.

Restarting The instance is being restarted.

Stopping The instance is being stopped.

Stopped The instance has been stopped gracefully.Instances in the Stopped state no longer provide in-memory cache service.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 57

Page 61: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

State Description

Frozen The instance has been frozen due to insufficient account balance. You canunfreeze the instance by topping up your account in My Order.

Scaling up The instance is being scaled up.

Step 6 On the DCS instance list, click the name of the chosen DCS instance to display more detailsabout it.

Table 2-6 Parameters on the DCS instance details page

Category Parameter Description

BasicInformation

Name Name of the chosen instance. To modify the instance

name, click the icon.

Instance Type Type of the selected instance. Currently, three types aresupported: single-node, master/standby, and cluster.

InstanceSpecification(GB)

Specification of the chosen instance.

Used/AvailableMemory (MB)

The used memory space and maximum allowed memoryspace of the chosen instance.The used memory space includes:l Size of data stored on the DCS instancel Size of Redis-server buffers (including client buffer

and repli-backlog) and internal data structures

Status Status of the selected DCS instance. For details, see Table2-5.

Time Window Time range for any scheduled maintenance activities forcache nodes of this DCS instance. To modify the

maintenance time window, click the icon next toTime Window.

ID ID of the chosen instance.

Billing Mode Mode in which the use of this DCS instance will be billed.There are two billing modes: yearly/monthly and pay-per-use.

ConnectionAddress

IP address and port number of the chosen instance.

Public Access An indicator of whether to enable or disable password-free access.

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 58

Page 62: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Category Parameter Description

Elastic IPAddress

Elastic IP address bound to the instance during publicaccess. This parameter is displayed only when PublicAccess is enabled.NOTE

You can click Download Certificate for Public Access todownload a certificate, which can be used to verify the certificateof the DCS instance when you access the instance.

Created Time at which the chosen instance was created.

Description Description of the chosen instance. To modify the

description, click the icon.

Monitoringmetrics

Monitoring metrics of the chosen instance. Click the Viewicon to switch to the Cloud Eye console on whichmonitoring metrics of the selected DCS instance aredisplayed.

Network AZ Availability zone in which the cache node running thechosen instance resides.

Security Group Security group that controls access to the chosen instance.

To modify the security group, click the icon next toSecurity Group.

VPC VPC in which the chosen instance resides.

Subnet Subnet in which the chosen instance resides.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 2 Getting Started

Issue 13 (2018-10-18) 59

Page 63: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

3 Operating DCS Instances

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

3.2 Stopping DCS InstancesOn the DCS console, you can stop one or multiple DCS instances at a time.

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

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

3.5 Clearing DCS InstancesOn the DCS console, you can clear data only for DCS2.0 instances. Clearing instance datacannot be undone and cleared data cannot be recovered. Exercise caution when performingthis operation.

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

PrerequisitesThe DCS instances you want to start are in the Stopped state.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Distributed Cache ServiceUser Guide 3 Operating DCS Instances

Issue 13 (2018-10-18) 60

Page 64: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Choose instances to start.l To start a single instance, click Start in the same row as the instance.l To start multiple instances, select the instances to start and click Start above the instance

list.

Step 6 In the Start dialog box, click OK to confirm that you want to start the instances.

It takes 1 to 30 minutes to start DCS instances. After DCS instances are started, their statuschanges from Stopped to Running.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

3.2 Stopping DCS InstancesOn the DCS console, you can stop one or multiple DCS instances at a time.

l After a DCS instance is stopped, it can no longer be read from or written to. If it is asingle-node instance, data will also be deleted from it when it is stopped.

l An attempt to stop a DCS instance while it is being backed up may result in a failure.

Prerequisites

The DCS instances you want to stop are in the Running state.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Distributed Cache ServiceUser Guide 3 Operating DCS Instances

Issue 13 (2018-10-18) 61

Page 65: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Choose instances to stop.l To stop a single instance, click Stop in the same row as the instance.l To stop multiple instances, select the instances to stop and click Stop above the instance

list.

Step 6 In the Stop dialog box, click OK to confirm that you want to stop the instances.

It takes 1 to 30 minutes to stop DCS instances. After DCS instances are stopped, their statuschanges from Running to Stopped.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

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

l While a DCS instance is restarting, it cannot be read from or written to.l If the DCS instance is a single-node instance, data will be deleted from it when it is

restarted.l An attempt to restart a DCS instance while it is being backed up may result in a failure.

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

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

Distributed Cache ServiceUser Guide 3 Operating DCS Instances

Issue 13 (2018-10-18) 62

Page 66: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Choose instances to restart.l To restart a single instance, choose More > Restart in the same row as the instance.l To restart multiple instances, select the instances to restart and click Restart above the

instance list.

Step 6 In the Restart dialog box, click OK to confirm that you want to restart the instances.

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

It takes 1 to 30 minutes to restart DCS instances. After DCS instances are restarted, theirstatus changes to Running.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

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

After a DCS instance is deleted, data from the instance will also be deleted without backup.

Prerequisitesl The DCS instances you want to delete have been created.l The DCS instances you want to delete are in the Running, Faulty, or Stopped state.l DCS instances that have been put into commercial use in yearly/monthly subscription

mode cannot be deleted. To disable such a DCS instance, choose Operation > More >Unsubscribe in the same row as the instance.

Distributed Cache ServiceUser Guide 3 Operating DCS Instances

Issue 13 (2018-10-18) 63

Page 67: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Deleting DCS Instances

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Choose instances to delete.l To delete a single instance, choose Operation > More > Delete in the same row as the

instance.l To delete multiple instances, select the instances to delete and click Delete above the

instance list.

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

Step 6 In the Delete dialog box, click OK to confirm that you want to delete the instances.

It takes 1 to 30 minutes to delete DCS instances.

----End

Deleting Instance Creation Tasks That Have Failed to Run

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

If there are DCS instances that have failed to be created, Instance Creation Failures isdisplayed above the instance list.

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

The Instance Creation Failures dialog box is displayed.

Step 6 Choose failed instance creation tasks to delete.l To delete a single failed task, click Delete in the same row as the task.l To delete all failed tasks, click Delete All above the task list.

----End

Distributed Cache ServiceUser Guide 3 Operating DCS Instances

Issue 13 (2018-10-18) 64

Page 68: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

3.5 Clearing DCS InstancesOn the DCS console, you can clear data only for DCS2.0 instances. Clearing instance datacannot be undone and cleared data cannot be recovered. Exercise caution when performingthis operation.

NOTE

This operation is supported only in some regions. The DCS console prevails.

PrerequisitesThe DCS2.0 instance is in the Running state.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Select one or more DCS2.0 instances to clear.

Step 6 Choose More > Clear above the instance list.

Step 7 Click OK.

----End

Distributed Cache ServiceUser Guide 3 Operating DCS Instances

Issue 13 (2018-10-18) 65

Page 70: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

4 Managing DCS Instances

This chapter describes how to manage DCS instances.

4.1 Configuration Notice

4.2 Configuring ParametersOn the DCS console, you can configure Redis-specific parameters to keep DCS instancesperforming optimally.

4.3 Modifying an Instance's Maintenance Time WindowOn the DCS console, after creating a DCS instance, you can modify the maintenance timewindow of the DCS instance on the instance's Summary page.

4.4 Modifying an Instance's Security GroupOn the DCS console, after creating a DCS instance, you can modify the security group of theDCS instance on the instance's Summary page.

4.5 Enabling Public Access to a DCS Redis InstanceTo access a DCS Redis instance over a public network, you can enable public access to thisinstance.

4.6 Managing Background TasksAfter you initiate certain instance operations such as scaling up instances, and changing orresetting a password, a background task will start for each operation. On the DCS console,you can view the background task status and clear task information by deleting task records.

4.1 Configuration NoticeIn most cases, DCS instance management operations cannot proceed concurrently. If youinitiate a new management operation while the current operation is in progress, the DCSconsole prompts you to initiate the new operation again after the current operation iscomplete. DCS instance management operations include:

l Creating a DCS instancel Configuring Redis-specific parametersl Starting, stopping, or restarting a DCS instancel Changing instance passwordsl Resetting instance passwords

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 67

Page 71: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

l Scaling, backing up, or restoring an instance

However, you can stop or restart a DCS instance while it is being backed up. The backup taskis forcibly interrupted and is likely to result in a failure.

In the event that a cache node of a DCS instance is faulty:l 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 of DCS.l Cache nodes can recover from internal faults automatically. Manual fault recovery is also

supported.l Certain operations (such as backup, restoration, and parameter configuration) in the

management zone are not supported during fault recovery. You can contact customerservice or perform these operations after cache nodes recover from faults.

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

4.2 Configuring ParametersOn the DCS console, you can configure Redis-specific parameters to keep DCS instancesperforming optimally.

NOTE

The default values are already optimized for typical use cases. Reconfiguring parameters isrecommended only when necessary.

Prerequisitesl The DCS instance you want to configure is in the Running state, and the instance type is

single-node or master/standby (Redis parameters of DCS instances in cluster mode arenot modifiable).

l You can modify the running parameters of DCS Redis and Memcached instances, butcannot modify those of DCS IMDG instances.

Procedure

Step 1 Log in to the management console.

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 68

Page 72: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 On the Cache Manager page, click the name of the DCS instance you want to configure.

A page with details of the DCS instance is displayed.

Step 6 On the instance details page, click the Configuration Parameters tab.

Step 7 On the Configuration Parameters tab page, click Modify.

Step 8 Modify Redis-specific parameters based on your requirements.

Table 4-1 Redis-specific parameters

Parameter CacheEngine

Description Possible Values DefaultValue

timeout Redis andMemcached

Connection betweenthe client and server(DCS instance) will beclosed if the client isidle for the timeoutperiod (measured inseconds). A timeoutperiod of 0 secondsindicates that thetimeout function isdisabled.

0 to 7200 seconds 0

maxmemory-policy

Redis andMemcached

How DCS will selectwhat to remove whenmaxmemory isreached.For more informationabout this parameter,see https://redis.io/topics/lru-cache.

volatile-lru

allkeys-lru

volatile-random

allkeys-random

volatile-ttl

noeviction

noeviction

hash-max-ziplist-entries

Redis When the number ofentries in hashes is lessthan the value of thisparameter, hashes areencoded using amemory efficient datastructure.

1 to 10000 512

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 69

Page 73: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter CacheEngine

Description Possible Values DefaultValue

hash-max-ziplist-value

Redis When the biggest entryin hashes does notexceed the lengththreshold indicated bythis parameter, hashesare encoded using amemory efficient datastructure.

1 to 10000 64

list-max-ziplist-entries

Redis When the number ofentries in lists is lessthan the value of thisparameter, lists areencoded using amemory efficient datastructure.

1 to 10000 512

list-max-ziplist-value

Redis When the biggest entryin lists does not exceedthe length thresholdindicated by thisparameter, lists areencoded using amemory efficient datastructure.

1 to 10000 64

set-max-intset-entries

Redis When a set iscomposed entirely ofstrings that happen tobe integers in radix 10in the range of 64 bitsigned integers, sets areencoded using amemory efficient datastructure.

1 to 10000 512

zset-max-ziplist-entries

Redis When the number ofentries in sorted sets isless than the value ofthis parameter, sortedsets are encoded usinga memory efficient datastructure.

1 to 10000 128

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 70

Page 74: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter CacheEngine

Description Possible Values DefaultValue

zset-max-ziplist-value

Redis When the biggest entryin sorted sets does notexceed the lengththreshold indicated bythis parameter, sortedsets are encoded usinga memory efficient datastructure.

1 to 10000 64

latency-monitor-threshold

Redis Only events that run inmore time than theconfigured latency-monitor-threshold willbe logged as latencyspikes.l If the latency-

monitor-threshold isset to 0, latencymonitoring isdisabled.

l If the latency-monitor-threshold isset to a valuegreater than 0, allevents blocking theserver for a timeequal to or greaterthan the configuredlatency-monitor-threshold will belogged.

By running theLATENCY command,you can performoperations related tolatency monitoring,such as enablinglatency monitoring,reporting the latestlatency events logged,and obtaining statisticaldata.For more informationabout the latency-monitor-threshold, visithttps://redis.io/topics/latency-monitor.

0 to 86400000 ms 0

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 71

Page 75: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter CacheEngine

Description Possible Values DefaultValue

reserved-memory

Redis The number ofmegabytes reserved forthe backend to performinternal processingsuch as persistence andmaster/standbyreplication.This parameter isconfigurable only formaster/standbyinstances.

0% to 50% ofmaximum memoryspace initiallyavailable to theinstance and belowthe current freememory spaceNOTE: For moreinformation aboutmaximum availablememory of eachinstance type, seeDCS InstanceSpecifications.

0

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 72

Page 76: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter CacheEngine

Description Possible Values DefaultValue

notify-keyspace-events

Redis Keyspace eventnotification. If thisparameter isconfigured, the RedisSub/Pub feature willallow clients to receivean event notificationwhen a Redis data setis modified.

If the parametervalue is an emptycharacter string,keyspace eventnotification isdisabled.If the parametervalue is a string ofmultiple characters,keyspace eventnotification isenabled and eachcharacter identifiesa class of keyspaceevents for whichRedis will sendnotifications.NOTE

l The parametervalue mustcontain either Kor E.

l A is an alias for"g$lshzxe"andcannot be usedtogether withany of thecharacters "g$lshzxe".

l For example, thevalue Kl meansthat Redis willnotify Pub/Subclients aboutkeyspace eventsand listcommands. Thevalue AKEmeans Rediswill notifyPub/Sub clientsabout all events.

K: Keyspaceevents, publishedwith the__keyspace@__prefixE: Keyevent events,published with__keyevent@__prefix

""

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 73

Page 77: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Parameter CacheEngine

Description Possible Values DefaultValue

g: Genericcommands (non-type specific) suchas DEL, EXPIRE,and RENAME$: Stringcommandsl: List commandss: Set commandsh: Hash commandsz: Sorted setcommandsx: Expired events(events generatedevery time a keyexpires)e: Evicted events(events generatedwhen a key isevicted frommaxmemory)A: Alias for "g$lshzxe", so thatthe "AKE" stringmeans all theevents.Note that theparameter valuemust contain eitherK or E.

NOTE

l For more information about Redis-specific parameters, visit https://redis.io/topics/memory-optimization.

l The latency-monitor-threshold parameter is usually used for fault location. After locating faultsbased on the latency information collected, change the value of latency-monitor-threshold to 0 toavoid unnecessary latency.

Step 9 After you have finished setting the parameters, click Save.

Step 10 Click OK to confirm.

----End

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 74

Page 78: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

4.3 Modifying an Instance's Maintenance Time WindowOn the DCS console, after creating a DCS instance, you can modify the maintenance timewindow of the DCS instance on the instance's Summary page.

Prerequisite

At least one DCS instance has been created.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 Click the name of the DCS instance for which you want to modify the maintenance timewindow.

Step 6 Click the Summary tab. In the Basic Information area, click the icon next to the TimeWindow parameter.

Step 7 Select a new maintenance time window from the drop-down list. Click to save themodification or to cancel.

The modification will take effect immediately, that is, the new maintenance time window willappear on the Summary tab page immediately.

----End

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 75

Page 79: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

4.4 Modifying an Instance's Security GroupOn the DCS console, after creating a DCS instance, you can modify the security group of theDCS instance on the instance's Summary page.

PrerequisitesAt least one DCS instance has been created.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 Click the name of the DCS instance for which you want to modify the security group.

Step 6 Click the Summary tab. In the Network area, click the icon next to the Security Groupparameter.

Step 7 Select a new security group from the drop-down list. Click to save the modification or to cancel the modification.

The modification will take effect immediately, that is, the new security group will appear onthe Summary tab page immediately.

NOTE

Only the security groups that have been created can be selected from the drop-down list. If you need tocreate a security group, follow the procedure in How to Select and Configure a Security Group?

----End

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 76

Page 80: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

4.5 Enabling Public Access to a DCS Redis InstanceTo access a DCS Redis instance over a public network, you can enable public access to thisinstance.

NOTE

l After public access is enabled, you can access a DCS instance only through the SSL mode. You areadvised to download a CA certificate in advance and use it to verify the certificate of a DCS instancefor security purposes.

l During a fault-caused switchover, attempts to access a DCS Redis instance of the master/standby orcluster type over a public network may fail. If this occurs, wait for about 1 minute and try again.

l DCS Redis instances in password-free mode do not support public access.l After public access to a DCS Redis instance is enabled, access the instance by referring to 2.3.9

Accessing a DCS Redis Instance Over a Public Network.l In comparison with intra-VPC access, packet loss and jitter may occur and the access latency

increases during public access. Therefore, you are advised to enable public access only during theservice development and test phase.

PrerequisitesA DCS Redis instance has been created in password mode and public access is disabled forthis instance.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 Click the name of the DCS Redis instance you want to configure. A page with basicinformation about the DCS instance is displayed.

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 77

Page 81: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 6 Click on the right of Public Access to enable the public access function.

Step 7 Select an EIP from the Elastic IP Address drop-down list and click .

It takes 1 to 2 minutes to enable public access. Please wait.

You will be automatically redirected to the Background Task Management tab page, wherethe progress of the current task is displayed. If the task status is Succeeded, public access issuccessfully enabled.

NOTE

l If any EIP is available in the Elastic IP Address drop-down list, click View Elastic IP, and you willbe redirected to the EIP details page of Virtual Private Cloud, where you can view the details ofthe EIP.

l If no EIP is available in the Elastic IP Address drop-down list, click Create Elastic IP. You will beredirected to the EIP creation page of Virtual Private Cloud, where you can create an EIP.

l Binding fails if the chosen EIP is already in use (for example, it is bound to another DCS instance orused by other services).

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

4.6 Managing Background TasksAfter you initiate certain instance operations such as scaling up instances, and changing orresetting a password, a background task will start for each operation. On the DCS console,you can view the background task status and clear task information by deleting task records.

Prerequisites

At least one DCS instance has been created.

Only DCS Redis and Memcached instance support the background task management page.DCS IMDG instances do not support this page.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 78

Page 82: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Click the name of the DCS instance whose background task you want to view.

Step 6 Click the Background Task Management tab.

A list of background tasks is displayed.

Step 7 Filter background tasks, refresh task status, or delete task records.

l To filter background tasks by date, click on top of the background task list, specifyStart Date and End Date, and click OK.

l To refresh background task status, click .l To clear the record of a background task, choose Operation > Delete in the same row as

the task.

NOTE

Only tasks whose status is Successful or Failed can have their records deleted.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 4 Managing DCS Instances

Issue 13 (2018-10-18) 79

Page 83: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

5 Scaling Up DCS Instances

On the DCS console, you can scale up DCS instances to desired specifications.

l After you scale up a DCS instance in cluster mode, you cannot restore the files backed upbefore scale-up. You are advised to back up your data as soon as possible after scaling upthe DCS instance.

l It takes 5 to 30 minutes to scale up a DCS instance. To minimize the impact of anyunexpected results, we recommend scaling up your instance during off-peak periods.

l During scale-up of single-node DCS instances, you cannot read from or write to DCS, butduring scale-up of cluster or master/standby DCS instances, you can read from or write toDCS.

l After successful scale-up, the scaled DCS instances are billed based on new specifications.

Prerequisitesl The DCS instance you want to scale up is in the Running state.

l You can scale up a DCS Redis or Memcached instance, but cannot scale up a DCSIMDG instance.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Distributed Cache ServiceUser Guide 5 Scaling Up DCS Instances

Issue 13 (2018-10-18) 80

Page 84: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 5 Choose More > Scale up in the same row as the DCS instance you want to scale up.

Step 6 In the Scale Up DCS Instance dialog box, select the specifications to which the chosen DCSinstance will scale up.l The maximum storage space for both single-node and master/standby instances is 64

GB.l The maximum storage space for cluster instances is 1024 GB.

Step 7 In the Scale Up DCS Instance dialog box, click OK.

The Apply for Instance Scale-Up page is displayed. This page displays instance informationsuch as the instance name, cache engine version, and new specifications.

Step 8 Review instance information. Click Submit on the Confirm tab page.

It takes 5 to 30 minutes to scale up a DCS instance. After scale-up is successful, the DCSinstance enters the Running state.

The Background Task Management page then appears. On this page, you can view thescale-up status. For more information, see 4.6 Managing Background Tasks.

NOTE

l If scaling up a single-node DCS instance fails:

The instance continues to use its original specifications. In addition, the instance is temporarilyunavailable for use and does not support management operations (such as parameter configurationand scale-up). However, after O&M personnel click Retry Scale-Up on the DCS OM console, theinstance will be forcibly scaled to the new specifications and become available for use again.

l If scaling up a master/standby DCS instance fails:

Management operations (such as backup, restoration, scale-up, and parameter configuration) aretemporarily unsupported. The instance continues to be available for use with its originalspecifications. Remember not to read or write more data than allowed by the original specifications;otherwise, data loss may occur.

l After scale up is successful, the new specifications of the instance take effect.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 5 Scaling Up DCS Instances

Issue 13 (2018-10-18) 81

Page 85: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

6 Backing Up and Restoring DCS Instances

6.1 OverviewOn the DCS console, you can back up and restore DCS instances.

6.2 Configuring a Backup PolicyOn the DCS console, you can configure an automatic backup policy. The system then backsup data in your instances according to the backup policy.

6.3 Manually Backing Up a DCS InstanceOn the DCS console, you can manually back up data in master/standby DCS instances.

6.4 Restoring a DCS InstanceOn the DCS console, you can restore backup data to a chosen DCS instance.

6.1 OverviewOn the DCS console, you can back up and restore DCS instances.

Need for DCS Instance Backup

There is a small chance that dirty data could exist in a DCS instance owing to service systemexceptions or problems in loading data from persistence files. In addition, some systemsdemand not only high reliability but also data security, data restoration, and even permanentdata storage.

Currently, data in DCS instances can be backed up to OBS. If a DCS instance becomes faulty,data in the instance can be restored from backup so that service continuity is not affected.

Backup Modes

DCS instances support the following backup modes:

l Scheduled backupYou can create a scheduled backup policy on the DCS console. Then, data in the chosenDCS instances will be automatically backed up at the scheduled time.You can choose the days of the week on which scheduled backup will run. Backup datawill be retained for a maximum of seven days. Backup data older than seven days will beautomatically deleted.

Distributed Cache ServiceUser Guide 6 Backing Up and Restoring DCS Instances

Issue 13 (2018-10-18) 82

Page 86: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

The primary purpose of scheduled backups is to create complete data replicas of DCSinstances so that the instance can be quickly restored if necessary.

l Manual backupBackup requests can also be issued manually. Then, data in the chosen DCS instanceswill be permanently backed up to OBS. Backup data can be deleted manually.Before performing high-risk operations, such as system maintenance or upgrade, DCSinstance data needs to be backed up.

Additional Information About Data Backupl Instance type

– DCS Redis instancesOnly master/standby instances can be backed up and restored. Single-node, cluster,and DCS2.0 instances do not support backup or restoration.

– DCS Memcached instancesOnly master/standby instances can be backed up and restored. Single-nodeinstances do not support backup or restoration.

– Currently, DCS IMDG instances do not support backup or restoration.l Working principle

Instance data is persisted using the Redis Append Only Files (AOF) feature.Backup tasks are run on standby cache nodes. DCS instance data is backed up bycompressing and storing the data persistence files from the standby cache node to OBS.DCS checks instance backup policies once an hour. If a backup policy is matched, DCSruns a backup task for the corresponding DCS instance.

l Impact on DCS instances during backupDCS instances can continue to provide services during backup.In the event of full-data synchronization or heavy instance load, it takes a few minutes tocomplete data synchronization. If instance backup starts before data synchronization iscomplete, the backup data will be slightly behind the data in the master cache node.During instance backup, the standby cache node stops persisting the latest changes todisk files. If new data is written to the master cache node during backup, the backup filewill not contain the new data.

l Backup timeIt is advisable to back up instance data during off-peak periods.

l Storage and pricing of backup filesBackup files are stored to OBS.DCS provides the backup service free of charge, but OBS charges will be incurred forthe amount and period that storage space is consumed.

l Handling exceptions in scheduled backupIf a scheduled backup task is triggered while the DCS instance is restarting or beingscaled 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 another task is inprogress, DCS will try to back up the instance in the next cycle. A maximum of threeretries are allowed within a single day.

l Retention period of backup data

Distributed Cache ServiceUser Guide 6 Backing Up and Restoring DCS Instances

Issue 13 (2018-10-18) 83

Page 87: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Scheduled backup files are retained for up to seven days. The retention period is userconfigurable. At the end of the retention period, most backup files of the DCS instancewill be automatically deleted, but at least one backup file will be retained.

Manual backup files are retained permanently and need to be manually deleted.

Data Restorationl Data restoration process

a. A user initiates 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 backupfile.

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.

l Impact on service systems

Data read/write is suspended during instance data restoration and resumed after data inthe master cache node is restored.

l Handling data restoration exceptions

If a backup file is corrupted, DCS will try to fix the backup file while restoring instancedata. If the backup file is successfully fixed, DCS proceeds to restore instance data. If thebackup file cannot be fixed, DCS will restore the DCS instance to the state in which itwas before data restoration.

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

6.2 Configuring a Backup PolicyOn the DCS console, you can configure an automatic backup policy. The system then backsup data in your instances according to the backup policy.

If automatic backup is not required, disable the automatic backup function in the backuppolicy.

Prerequisites

At least one master/standby DCS instance has been created.

Distributed Cache ServiceUser Guide 6 Backing Up and Restoring DCS Instances

Issue 13 (2018-10-18) 84

Page 88: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 On the Cache Manager page, filter DCS instances by instance status and/or name to find theDCS instance for which you want to configure a backup policy.

Step 6 Click the name of the chosen DCS instance to display more details about the DCS instance.

Step 7 On the instance details page, click Backup and Restore.

Step 8 On the Backup and Restore page, click Backup Policy.

Step 9 In the Backup Policy dialog box, set the Auto Backup parameter to On and specify otherbackup parameters. Click OK to complete setting the backup policy.

Table 6-1 Parameters in a backup policy

Parameter Description

Auto Backup Specifies whether automatic backup is enabled.

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 of retentionperiod and cannot be restored.Data can be retained for up to 7 days.

Start Time Time at which automatic backup starts.Value: the full hour between 00:00 to 23:00The DCS checks backup policies once every hour. If the backupstart time in a backup policy has arrived, data in thecorresponding instance is backed up.NOTEl Instance backup takes 5 to 30 minutes. The data added or

modified during the backup process will not be backed up. Toreduce the impact of backup on services, it is recommendedthat data should be backed up during off-peak periods.

l Only instances in the Running state can be backed up.

Distributed Cache ServiceUser Guide 6 Backing Up and Restoring DCS Instances

Issue 13 (2018-10-18) 85

Page 89: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

6.3 Manually Backing Up a DCS InstanceOn the DCS console, you can manually back up data in master/standby DCS instances.

By default, manually backed up data is permanently retained. If backup data is no longer inuse, you can delete it manually.

Prerequisites

At least one master/standby DCS instance is in the Running state.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 On the Cache Manager page, filter DCS instances by instance status and/or name to find theDCS instance you want to manually back up.

Step 6 Click the name of the chosen DCS instance to display more details about the DCS instance.

Step 7 On the instance details page, click Backup and Restore.

Step 8 On the Backup and Restore page, click Manual Backup.

Step 9 In the Manual Backup dialog box, click OK to start manual backup.

Distributed Cache ServiceUser Guide 6 Backing Up and Restoring DCS Instances

Issue 13 (2018-10-18) 86

Page 90: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

NOTE

l Information in the Remarks text box cannot exceed 128 bytes.

l Instance backup takes 10 to 15 minutes. The data added or modified during the backup process willnot be backed up.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

6.4 Restoring a DCS InstanceOn the DCS console, you can restore backup data to a chosen DCS instance.

Prerequisitesl At least one DCS instance of the master/standby type is in the Running state.l A backup task has been run to back up data in the instance to be restored and the status

of the backup task is Successful.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

Step 5 On the Cache Manager page, filter DCS instances by instance status and/or name to find theDCS instance you want to restore.

Step 6 Click the name of the chosen DCS instance to display more details about the DCS instance.

Step 7 On the instance details page, click Backup and Restore.

Step 8 Click Restore in the same row as the chosen backup task.

Distributed Cache ServiceUser Guide 6 Backing Up and Restoring DCS Instances

Issue 13 (2018-10-18) 87

Page 91: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 9 In the Restore DCS Instance dialog box, click OK to start instance restoration.

NOTE

l Information in the Description text box cannot exceed 128 bytes.

l The Restoration History tab page displays the result of the instance restoration task.

l Instance restoration takes 5 to 30 minutes.

l While being restored, DCS instances do not accept data operation requests from clients becauseexisting data is being overwritten by the backup data.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 6 Backing Up and Restoring DCS Instances

Issue 13 (2018-10-18) 88

Page 92: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

7 Managing Passwords

7.1 Changing Instance PasswordsOn the DCS console, you can change the password required for accessing your DCS instance.

7.2 Resetting Instance PasswordsOn the DCS console, you can configure a new password if you forget your instance password.

7.3 Enabling Password-free Access to a DCS Redis InstanceTo access a DCS Redis instance in password-free mode, you can enable password-free accessto clear the password of the instance.

7.4 Enabling Password-free Access to a DCS Memcached InstanceTo access a DCS Memcached instance in username/password-free mode, you can enablepassword-free access to clear the username and password of the instance.

7.1 Changing Instance PasswordsOn the DCS console, you can change the password required for accessing your DCS instance.

Prerequisitesl The DCS instance for which you want to change the password is in the Running state.l You can change the password of a DCS Redis or Memcached instance, but cannot

change that of a DCS IMDG instance.l You cannot change the password of a DCS instance in password-free mode.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Distributed Cache ServiceUser Guide 7 Managing Passwords

Issue 13 (2018-10-18) 89

Page 93: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 4 In the navigation pane, choose Cache Manager.

Step 5 Choose More > Change Password in the same row as the chosen instance.

Step 6 In the Change Password dialog box, enter the old password and new password.

NOTE

After 5 consecutive incorrect password attempts, the account for accessing the chosen DCS instance willbe locked for 5 minutes. Passwords cannot be changed during the lockout period.

A DCS instance password cannot be left unspecified and must:

l Consist of 6 to 32 characters.

l Be different from the old password.

l Contain at least two of the following character types: uppercase letters, lowercase letters, digits, andspecial characters (`~!@#$^&*()-_=+\|{}:,<.>/?).

Step 7 In the Change Password dialog box, click OK to confirm the password change.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

7.2 Resetting Instance PasswordsOn the DCS console, you can configure a new password if you forget your instance password.

Prerequisitesl For a DCS Redis instance, you can change it from password mode to password-free

mode or from password-free mode to password mode by resetting its password. Fordetails, see 7.3 Enabling Password-free Access to a DCS Redis Instance.

l The DCS instance for which you want to reset the password is in the Running state.

l You can reset the password of a DCS Redis or Memcached instance, but cannot reset thatof a DCS IMDG instance.

l You have the tenant management account.

Only users with the tenant management account are authorized to reset instancepasswords.

l You have registered your mobile phone number.

Your mobile phone is used to receive a verification code. The DCS console allows you toreset an instance password only after you enter a valid verification code.

Distributed Cache ServiceUser Guide 7 Managing Passwords

Issue 13 (2018-10-18) 90

Page 94: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 Choose More > Reset Password in the same row as the chosen instance.

Step 6 In the Reset Password dialog box, enter a new password and confirm it.

NOTE

A DCS instance password cannot be left unspecified and must:

l Consist of 6 to 32 characters.

l Contain at least two of the following character types: uppercase letters, lowercase letters, digits,and special characters (`~!@#$^&*()-_=+\|{}:,<.>/?).

Step 7 Click Send Verification Code, enter the verification code received by your mobile phone,and click OK.

l If the password is reset successfully on all cache nodes of the instance, the DCS consoledisplays "Password for DCS instance {instance name} reset successfully."

l If the password reset fails on some cache nodes of the instance, the DCS consoledisplays "Failed to reset password for DCS instance {instance name}." and the instancemay restart to recover the old instance password.

NOTE

By default, each verification code is valid for two minutes. If the verification code you have receivedexpires, get a new one.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 7 Managing Passwords

Issue 13 (2018-10-18) 91

Page 95: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

7.3 Enabling Password-free Access to a DCS RedisInstance

To access a DCS Redis instance in password-free mode, you can enable password-free accessto clear the password of the instance.

Prerequisitesl The DCS Redis instance for which password-free access is to be enabled is in the

Running state.l You have registered your mobile phone number.

Your mobile phone is used to receive a verification code. The DCS console allows you toreset an instance password only after you enter a valid verification code.

l Password-free access may compromise security. You can set a password by using thepassword reset function.

l For security purposes, password-free access must be disabled when public access isenabled.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 To enable password-free access to a DCS Redis instance, choose Operation > More > ResetPassword in the same row as the chosen instance.

Step 6 In the Reset Password dialog box, enable Free access to secret.

Step 7 Click Send Verification Code and enter the verification code. Then, click OK.

When password-free access is set successfully, a message is displayed, which indicates thatpassword-free access to the instance has been enabled.

NOTE

l You must register your mobile phone number before enabling password-free access.

l By default, each verification code is valid for ten minutes. If the verification code you have receivedexpires, get a new one.

----End

Distributed Cache ServiceUser Guide 7 Managing Passwords

Issue 13 (2018-10-18) 92

Page 96: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

7.4 Enabling Password-free Access to a DCS MemcachedInstance

To access a DCS Memcached instance in username/password-free mode, you can enablepassword-free access to clear the username and password of the instance.

Prerequisitesl The DCS Memcached instance for which password-free access is to be enabled is in the

Running state.l You have registered your mobile phone number.

Your mobile phone is used to receive a verification code. The DCS console allows you toreset an instance password only after you enter a valid verification code.

l The Memcached text protocol does not support username and password authentication.To access a DCS Memcached instance by using the Memcached text protocol, you mustenable password-free access to the instance.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 To enable password-free access to a DCS Memcached instance, choose Operation > More >Free secret access settings in the same row as the chosen instance.

Step 6 In the Free secret access settings dialog box, enable Free access to secret.

Step 7 Click Send Verification Code and enter the verification code. Then, click OK.

Distributed Cache ServiceUser Guide 7 Managing Passwords

Issue 13 (2018-10-18) 93

Page 97: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

When password-free access is set successfully, a message is displayed, which indicates thatpassword-free access to the instance has been enabled.

NOTE

l You must register your mobile phone number before enabling password-free access.

l By default, each verification code is valid for ten minutes. If the verification code you have receivedexpires, get a new one.

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for Redis

Distributed Cache Service forMemcached

Elastic Cloud Server

Virtual Private Cloud

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 7 Managing Passwords

Issue 13 (2018-10-18) 94

Page 98: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

8 Monitoring

Cloud Eye is a secure, scalable monitoring platform in the public cloud. It monitors DCSservice metrics, and sends notifications if alarms are triggered or events occur.

8.1 DCS MetricsCloud Eye monitors various DCS metrics.

8.2 Setting DCS Alarm RulesSetting DCS alarm rules allows you to customize the monitored objects and notificationpolicies and determine the running status of your DCS at any time.

8.3 Viewing DCS Running StatusThe public cloud platform provides the Cloud Eye service, which monitors the running statusof your DCS instances.

8.1 DCS MetricsCloud Eye monitors various DCS metrics.

NOTE

DCS2.0 and IMDG are supported only in some regions. The DCS console prevails. Metrics related toDCS2.0 and IMDG are applicable only to regions that support these two features.

Table 8-1 DCS Redis instance monitoring metrics displayed on the Cloud Eye console

Metric Description Value Range MonitoredObject

CPU Usage CPU consumed by monitoredobjects.

0% to 100% ECS

Memory Usage Memory consumed bymonitored objects.

0% to 100% ECS

Network InputThroughput

Inbound throughput per secondon a port.

≥ 0 bytes/s ECS

Network OutputThroughput

Outbound throughput persecond on a port.

≥ 0 bytes/s ECS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 95

Page 99: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Metric Description Value Range MonitoredObject

ConnectedClients

Number of connected clients,including connectionsestablished by the DCS server(a management service in thebackground) to monitor DCSinstances and excludingconnections from standbynodes.

≥ 0 DCS

Client LongestOutput List

Longest output list amongcurrent client connections.

≥ 0 DCS

Client BiggestInput Buf

Maximum input data lengthamong current clientconnections.

≥ 0 bytes/s DCS

Blocked Clients Number of clients suspended byblock operations, such asBLPOP, BRPOP, andBRPOPLPUSH.

≥ 0 DCS

Used Memory Total number of bytes allocatedby Redis using its allocator.

≥ 0 bytes/s DCS

Used MemoryRSS

Number of bytes that Redisallocates as seen by theoperating system (a.k.a residentset size).It includes all stack and heapmemory but not swapped-outmemory.

≥ 0 bytes/s DCS

Used MemoryPeak

Peak memory consumed byRedis since the Redis server laststarted.

≥ 0 bytes/s DCS

Used MemoryLua

Number of bytes used by theLua engine.

≥ 0 bytes/s DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 96

Page 100: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Metric Description Value Range MonitoredObject

MemoryFragmentationRatio

Ratio between Used MemoryRSS and Used Memory.Ideally, the Used Memory RSSshould be only slightly higherthan Used Memory. When UsedMemory RSS is much greaterthan Used Memory, there ismemory fragmentation (internalor external), which can beevaluated by checking MemoryFragmentation Ratio.When Used Memory is muchgreater than Used MemoryRSS, part of Redis memory hasbeen swapped out by theoperating system. In this case,significant latency can beexpected.Because Redis does not havecontrol over how its allocationsare mapped to memory pages,high Used Memory RSS isoften the result of a spike inmemory usage.

≥ 0 DCS

TotalConnectionsReceived

Total number of connections theRedis server has received sinceit last started, includingconnections established by theDCS server (a managementservice in the background) tomonitor DCS instances.

≥ 0 DCS

Total CommandsProcessed

Total number of commands theRedis server has processedsince it last started, includingcommands issued by the DCSserver (a management service inthe background) to monitorDCS instances.

≥ 0 DCS

InstantaneousOps per Second

Number of commandsprocessed per second.

≥ 0 DCS

Total Net InputBytes

Total number of bytes the Redisserver has received since it laststarted.

≥ 0 bytes/s DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 97

Page 101: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Metric Description Value Range MonitoredObject

Total Net OutputBytes

Total number of bytes the Redisserver has sent since it laststarted.

≥ 0 bytes/s DCS

InstantaneousInput Kbps

Instantaneous input traffic. ≥ 0 kbit/s DCS

InstantaneousOutput Kbps

Instantaneous output traffic. ≥ 0 kbit/s DCS

RejectedConnections

Number of connections thathave exceeded maxclients andbeen rejected by the Redisserver since it last started.

≥ 0 DCS

Sync Full Total number of fullsynchronizations since theRedis server last started.

≥ 0 DCS

Sync Partial OK Total number of successfulincremental synchronizationssince the Redis server laststarted.

≥ 0 DCS

Sync Partial Err Total number of failedincremental synchronizationssince the Redis server laststarted.

≥ 0 DCS

Expired Keys Total number of keys that haveexpired since the Redis serverlast started.

≥ 0 DCS

Evicted Keys Number of keys that have beenevicted due to insufficientmemory since the Redis serverlast started.

≥ 0 DCS

Keyspace Hits Total number of successfullookups of keys in the maindictionary since the Redisserver last started.

≥ 0 DCS

KeyspaceMisses

Total number of failed lookupsof keys in the main dictionarysince the Redis server laststarted.

≥ 0 DCS

PubSubChannels

Number of Pub/Sub channels. ≥ 0 DCS

PubSub Patterns Number of Pub/Sub patterns. ≥ 0 DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 98

Page 102: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Metric Description Value Range MonitoredObject

Aof Current Size AOF file size. ≥ 0 bytes DCS

Latest Fork usec Duration of the latest forkoperation.

≥ 0 ms DCS

Table 8-2 DCS Memcached instance monitoring metrics displayed on the Cloud Eye console

Metric Description ValueRange

MonitoredObject

CPU Usage CPU consumed by monitored objects 0% to100%

ECS

Memory Usage Memory consumed by monitored objects 0% to100%

ECS

Network InputThroughput

Inbound throughput per second on a port ≥ 0bytes/s

ECS

Network OutputThroughput

Outbound throughput per second on aport

≥ 0bytes/s

ECS

Connected Clients Number of connected clients, includingconnections established by the DCSserver (a management service in thebackground) to monitor DCS instancesand excluding connections from standbynodes

≥ 0 DCS

Used Memory Used memory (bytes) ≥ 0bytes/s

DCS

Used Memory RSS Used RSS memory (bytes), that is, thememory that actually resides in thememory, including all stack and heapmemory but not swapped-out memory

≥ 0bytes/s

DCS

Used Memory Peak Peak memory consumed since the serverlast started

≥ 0bytes/s

DCS

MemoryFragmentation Ratio

Ratio between Used Memory RSS andUsed Memory

≥ 0 DCS

ConnectionsReceived

Total number of received connections,including connections established by theDCS server (a management service in thebackground) to monitor DCS instances

≥ 0 DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 99

Page 103: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Metric Description ValueRange

MonitoredObject

CommandsProcessed

Number of processed commands,including commands issued by the DCSserver (a management service in thebackground) to monitor DCS instances

≥ 0 DCS

Instantaneous Opsper Second

Number of commands processed persecond

≥ 0 DCS

Net Input Bytes Number of received bytes ≥ 0bytes/s

DCS

Net Output Bytes Number of sent bytes ≥ 0bytes/s

DCS

Instantaneous InputKbps

Instantaneous input traffic ≥ 0 kbit/s DCS

Instantaneous OutputKbps

Instantaneous output traffic ≥ 0 kbit/s DCS

RejectedConnections

Number of connections that haveexceeded maxclients and been rejected

≥ 0 DCS

Sync Full Total number of full synchronizationsbetween master and standby servers

≥ 0 DCS

Sync Partial OK Total number of successful incrementalsynchronizations between master andstandby servers

≥ 0 DCS

Sync Partial Err Total number of failed incrementalsynchronizations between master andstandby servers

≥ 0 DCS

Expired Keys Total number of keys that have expired ≥ 0 DCS

Evicted Keys Number of keys that have been evicteddue to insufficient memory

≥ 0 DCS

Aof Current Size AOF file size ≥ 0 bytes DCS

Number of RetrievalRequests

Number of received data retrievalrequests

≥ 0 DCS

Number of StorageRequests

Number of received data storage requests ≥ 0 DCS

Number of FlushRequests

Number of received data clearancerequests

≥ 0 DCS

Number of TouchRequests

Number of received requests formodifying the validity period of data

≥ 0 DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 100

Page 104: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Metric Description ValueRange

MonitoredObject

Number of RetrievalHits

Number of successful data retrievaloperations

≥ 0 DCS

Number of RetrievalMisses

Number of failed data retrieval operationsdue to key nonexistence

≥ 0 DCS

Number of DeleteHits

Number of successful data deletionoperations

≥ 0 DCS

Number of DeleteMisses

Number of failed data deletion operationsdue to key nonexistence

≥ 0 DCS

Number of IncrementHits

Number of successful incrementoperations

≥ 0 DCS

Number of IncrementMisses

Number of failed increment operationsdue to key nonexistence

≥ 0 DCS

Number ofDecrement Hits

Number of successful decrementoperations

≥ 0 DCS

Number ofDecrement Misses

Number of failed decrement operationsdue to key nonexistence

≥ 0 DCS

Number of CAS Hits Number of successful CAS operations ≥ 0 DCS

Number of CASMisses

Number of failed CAS operations due tokey nonexistence

≥ 0 DCS

Number of CASValues Not Matched

Number of failed CAS operations due toCAS value mismatch

≥ 0 DCS

Number of TouchHits

Number of successful requests formodifying the validity period of data

≥ 0 DCS

Number of TouchMisses

Number of failed requests for modifyingthe validity period of data due to keynonexistence

≥ 0 DCS

Number ofAuthenticationCommands

Number of authentication requests ≥ 0 DCS

Number of FailedAuthentications

Number of failed authentication requests ≥ 0 DCS

Number of ItemsStored

Number of stored data items ≥ 0 DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 101

Page 105: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Table 8-3 DCS2.0 Redis instance monitoring metrics displayed on the Cloud Eye console

Metric Description ValueRange

MonitoredObject

Used Memory RSS Measures the percentage of datasetmemory (bytes) that the Redis server hasused.

≥ 0 bytes DCS

Percentage of UsedMemory Dataset

Measures the percentage of datasetmemory (bytes) that the Redis server hasused.

0% to100%

DCS

Used MemoryDataset

Measures the dataset memory (bytes) thatthe Redis server has used.

≥ 0 bytes DCS

Keys With anExpiration

Measures the number of keys with anexpiration in Redis.

≥ 0 DCS

Used Memory Measures the memory (bytes) that Redishas used.

≥ 0 bytes DCS

Percentage ofKeyspace Hits

Measures the Keyspace Hit Ratio. 0% to100%

DCS

Instantaneous Opsper Second

Measures the number of commandsprocessed per second (ops/s).

≥ 0operations/s

DCS

Keyspace Misses Measures the total number of queryrequests that have not been hit in themaster dictionary since the Redis serverstarted.

≥ 0 DCS

Keys Measures the number of keys in Redis. ≥ 0 DCS

Instantaneous InputKbps

Measures the instantaneous input traffic. ≥ kbit/s DCS

Instantaneous OutputKbps

Measures the instantaneous output traffic. ≥ kbit/s DCS

MemoryFragmentation Ratio

Measures the current memoryfragmentation ratio.

0% to100%

DCS

PubSub Channels Measures the number of Pub/Subchannels.

≥ 0 DCS

PubSub Patterns Measures the number of Pub/Subpatterns.

≥ 0 DCS

Connected Clients Measures the number of connectedclients (excluding those from slavenodes).

≥ 0 DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 102

Page 106: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Metric Description ValueRange

MonitoredObject

Expired Keys Measures the total number of keys thathave expired since the Redis serverstarted.

≥ 0 DCS

Evicted Keys Measures the number of keys that havebeen evicted due to insufficient memorysince the Redis server started.

≥ 0 DCS

Used Memory Lua Measures the memory (bytes) that theLua engine has used.

≥ 0 bytes DCS

Used Memory Peak Measures the peak value of the memoryusage (bytes) since the Redis serverstarts.

≥ 0 bytes DCS

Blocked Clients Measures the number of clients that havebeen suspended by block operations.Block operations include BLPOP,BRPOP, and BRPOPLPUSH.

≥ 0 DCS

Table 8-4 DCS IMDG instance monitoring metrics displayed on the Cloud Eye console

Metric Description ValueRange

MonitoredObject

Average CPU Usage Measures the mean CPU usage of themonitored object.

0% to100%

DCS

Number of CPUs Measures the number of CPUs availableto the Java Virtual Machine by instance.

≥ 0 DCS

Heap MemoryCommitted for JVM

Measures the amount of heap memorythat is committed for the JVM to use.

≥ 0 bytes DCS

Heap Memory Used Measures the current heap size that isused for object allocation.

≥ 0 bytes DCS

Non-Heap MemoryCommitted for JVM

Measures the amount of non-heapmemory that is committed for the JVM touse.

≥ 0 bytes DCS

Non-Heap MemoryUsed

Measures the current non-heap memorysize that is used by JVM.

≥ 0 bytes DCS

Total Number ofCluster Nodes

Measures the total number of nodes. ≥ 0 DCS

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 103

Page 107: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and Documents

Products Documents

Distributed Cache Service for RedisDistributed Cache Service forMemcachedElastic Cloud ServerVirtual Private CloudIdentity and Access ManagementCloud EyeCloud Trace Service

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

8.2 Setting DCS Alarm RulesSetting DCS alarm rules allows you to customize the monitored objects and notificationpolicies and determine the running status of your DCS at any time.

This section describes how to set DCS alarm rules, including alarm rule names, monitoredobjects, monitoring indicators, alarm thresholds, monitoring periods, and notifications.

Prerequisites

A DCS instance in the Running state is available.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 Click the name of the DCS instance for which you want to set the alarm rules.

Step 6 Click the Summary tab. In the Basic Information area, click the View link next to theMonitoring Metrics parameter.

Step 7 In the navigation pane, choose Alarm Management > Alarm Rules.

Step 8 On the Alarm Rules page, click Create Alarm Rule to add an alarm rule, or modify anexisting alarm rule.

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 104

Page 108: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

For more information about DCS alarm rules, see the Cloud Eye User Guide.

----End

Related Products and Documents

Products Documents

Distributed Cache Service for RedisDistributed Cache Service forMemcachedElastic Cloud ServerVirtual Private CloudIdentity and Access ManagementCloud EyeCloud Trace Service

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

8.3 Viewing DCS Running StatusThe public cloud platform provides the Cloud Eye service, which monitors the running statusof your DCS instances.

You can obtain the monitoring metrics of each DCS instance on the management console. Fordetails, see 8.1 DCS Metrics.

Prerequisites

A DCS instance in the Running state is available.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List, and choose Database > Distributed Cache Service to launch the DCSconsole.

Step 4 In the navigation pane, choose Cache Manager.

A list of DCS instances is displayed on the Cache Manager page.

Step 5 Click the name of the DCS instance for which you want to set the alarm rules.

Step 6 Click the Summary tab. In the Basic Information area, click the View link next to theMonitoring Metrics parameter.

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 105

Page 109: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Step 7 Click View Graph in the Operation column to view the monitoring statistics.

----End

Distributed Cache ServiceUser Guide 8 Monitoring

Issue 13 (2018-10-18) 106

Page 110: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

9 Auditing

CTS provides a history of operations performed on cloud service resources. With CTS, youcan query, audit, and review operations. Traces include operation time, resource objects,resource IDs, requesters' IP addresses, resource operation requests, and responses.

9.1 Operations That Can Be Recorded by CTS

9.2 Viewing Traces on the CTS ConsoleAfter CTS is enabled, the tracker starts recording operations on cloud resources. Operationrecords for the last seven days can be viewed on the CTS console. This section describes howto query operation records of the last seven days on the CTS console.

9.1 Operations That Can Be Recorded by CTS

Table 9-1 Operations That Can Be Recorded by CTS

Operation Description

createDCSInstance Creating DCS instances

modifyDCSInstanceInfo Modifying DCS instance information (includingthe cache name, description, time window, andsecurity group)

deleteDCSInstance Deleting DCS instances

extendDCSInstance Scaling up DCS instances

modifyDCSInstanceConfig Modifying DCS instance configuration

modifyDCSInstancePassword Changing instance passwords

startDCSInstance, stopDCSInstance,or restartDCSInstance

Starting, stopping, and restarting DCS instances

Distributed Cache ServiceUser Guide 9 Auditing

Issue 13 (2018-10-18) 107

Page 111: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Related Products and DocumentsProducts Documents

Distributed Cache Service for RedisDistributed Cache Service forMemcachedElastic Cloud ServerVirtual Private CloudIdentity and Access ManagementCloud EyeCloud Trace Service

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

9.2 Viewing Traces on the CTS ConsoleAfter CTS is enabled, the tracker starts recording operations on cloud resources. Operationrecords for the last seven days can be viewed on the CTS console. This section describes howto query operation records of the last seven days on the CTS console.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner of the management console and select a region and aproject.

NOTE

Select the same region as the application service of the tenant.

Step 3 Click Service List and choose Management & Deployment > Cloud Trace Service.

Step 4 In the navigation pane, click Trace List.

Step 5 Specify the filters used for querying traces. The following filters are available:l Trace Source: Select DCS.l Resource Type: Select a resource type.l Search By:

Select an option from the drop-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 resource name.

l Operator: Select a specific operator (a user other than tenant).l Trace Status: Available options include All trace status, normal, warning, and

incident. You can select only one of them.l Start time and end time: You can specify the time period in which to query traces.

Step 6 Click on the left of a trace to expand its details.

Distributed Cache ServiceUser Guide 9 Auditing

Issue 13 (2018-10-18) 108

Page 112: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

Figure 9-1 Expanding trace details

Step 7 Click View Trace in the Operation column. In the displayed View Trace dialog box, thetrace structure details are displayed.

Figure 9-2 View Trace

----End

Related Products and DocumentsProducts Documents

Distributed Cache Service for RedisDistributed Cache Service forMemcachedElastic Cloud ServerVirtual Private CloudIdentity and Access ManagementCloud EyeCloud Trace Service

Buying a DCS Redis InstanceAccessing a DCS Redis InstanceScaling Up DCS InstancesBacking Up and Restoring DCS InstancesMigrating DCS Data

Distributed Cache ServiceUser Guide 9 Auditing

Issue 13 (2018-10-18) 109

Page 113: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

A Change History

ReleasedOn

What's New

2018-10-18 This issue is the thirteenth official release, which incorporates thefollowing changes:l Optimized descriptions in section 2.2.2 Buying a DCS2.0 Redis

Instance.l Optimized descriptions in section Accessing a DCS Instance.l Provided examples for accessing a DCS Redis instance by using

phpredis, hiredis, and redis-py clients in section 2.3.2 Accessing a DCSRedis Instance Through redis-cli.

l Added section 2.3.12 Accessing a DCS2.0 Instance Through WebCli.l Added section 3.5 Clearing DCS Instances.

2018-06-05 This issue is the twelfth official release, which incorporates the followingchanges:l Added password-free access to DCS Redis instances in sections 2.2.1

Buying a DCS Redis Instance and 7.3 Enabling Password-freeAccess to a DCS Redis Instance.

l Added public access to DCS Redis instances in sections 2.2.1 Buying aDCS Redis Instance and 2.3.9 Accessing a DCS Redis Instance Overa Public Network.

l Added domain name access to DCS instances in section 2.3 Accessinga DCS Instance.

l Add the procedure for PHP clients in section 2.3.10 Accessing a DCSMemcached Instance.

l Added Monitoring and Auditing.l Added support for DCS2.0 instances.l Added support for DCS Memcached instances billed on a yearly/

monthly basis. For details, see 2.2.3 Buying a DCS MemcachedInstance.

l Optimized some descriptions and adjusted the document contents.

Distributed Cache ServiceUser Guide A Change History

Issue 13 (2018-10-18) 110

Page 114: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

ReleasedOn

What's New

2018-04-03 This issue is the eleventh official release, which incorporates the followingchanges:l Added descriptions of IMDG and DCS IMDG instances.l In section 2.3.2 Accessing a DCS Redis Instance Through redis-cli,

added the procedure for using a Redis Java (Jedis) client to access aDCS instance.

l In section 4.2 Configuring Parameters, added descriptions about theRedis-specific parameter notify-keyspace-events, and deleteddescriptions about the Redis-specific parameter maxclients.

l In sections 4.3 Modifying an Instance's Maintenance Time Windowand 4.4 Modifying an Instance's Security Group, added theprocedures for modifying the time window and security group of a DCSinstance.

l Revised descriptions in the previous issue.

2017-11-07 This issue is the tenth official release, which incorporates the followingchanges:l Provided support for DCS instances in cluster mode.

2017-09-25 This issue is the ninth official release, which incorporates the followingchanges:l In chapter 4 Managing DCS Instances, added descriptions of mutual

exclusivity between management operations.l Revised Backing Up and Restoring DCS Instances.

2017-09-11 This issue is the eighth official release, which incorporates the followingchanges:l Revised incorrect descriptions in the previous issue.

2017-08-02 This issue is the seventh official release, which incorporates the followingchanges:l Adjusted the memory specifications available for DCS instances.l Added the Time Window parameter.

2017-07-14 This issue is the sixth official release, which incorporates the followingchanges:l Changed instance password complexity rules.l Deleted 1-GB specifications from the instance specifications list.

Distributed Cache ServiceUser Guide A Change History

Issue 13 (2018-10-18) 111

Page 115: User Guide - developer-res-cbc-cn.obs.cn-north-1 ... · 1 Accessing DCS 1.1 DCS Distributed Cache Service (DCS) is an online, distributed, in-memory cache service. It is reliable,

ReleasedOn

What's New

2017-07-05 This issue is the fifth official release, which incorporates the followingchanges:l Added 5 Scaling Up DCS Instances and Backing Up and Restoring

DCS Instances.l Added two instance statuses in section 2.4 Viewing Details of a DCS

Instance.l Added two Redis parameters maxclients and reserved-memory in

section 4.2 Configuring Parameters.

2017-05-30 This issue is the fourth official release, which incorporates the followingchanges:Added descriptions of:l Batch deletion of DCS instancesl Redis-specific parameter latency-monitor-threshold

2017-04-18 This issue is the third official release, which incorporates the followingchanges:Added descriptions of DCS metrics monitored by Cloud Eye.

2017-03-08 This issue is the second official release, which incorporates the followingchanges:Revised inaccurate descriptions.

2016-08-20 This is the first official release.

Distributed Cache ServiceUser Guide A Change History

Issue 13 (2018-10-18) 112