Updated on 2022-02-21 GMT+08:00

Accessing a DCS Memcached Instance

Access a DCS Memcached instance using telnet on an ECS in the same VPC.

Prerequisites

  • The DCS Memcached instance you want to access is in the Running state.
  • An ECS has been created on which the client has been installed. For details on how to create ECSs, see the Elastic Cloud Server User Guide.
    1. An ECS can communicate with a DCS instance that belongs to the same VPC and is configured with the same security group.
    2. If the ECS and DCS instance are not in the same VPC, you can establish a VPC peering connection to achieve network connectivity between the ECS and DCS instance. For details, see Does DCS Support Cross-VPC Access?
    3. If different security groups have been configured for the ECS and DCS instance, you can set security group rules to achieve network connectivity between the ECS and DCS instance. For details, see Security Group Configurations.
  • All annotations in example code have been deleted.
  • All command lines and code blocks are UTF-8 encoded. Using another encoding scheme will cause compilation problems or even command failures.

Procedure

  1. Log in to the DCS console.
  2. Click in the upper left corner of the management console and select a region and a project.
  3. In the navigation pane, choose Cache Manager.
  4. On the Cache Manager page, click the name of the DCS Memcached instance you want to access. Obtain the IP address and port number of the instance.
  5. Access the chosen DCS Memcached instance.

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

      which telnet

      If the directory in which the telnet is installed is displayed, telnet has been installed on the ECS. If the client installation directory is not displayed, install the telnet manually.

      • If telnet has not been installed in Linux, run the yum -y install telnet command to install it.
      • In the Windows OS, choose Start > Control Panel > Programs > Programs and Features > Turn Windows features on or off, and enable telnet.
    3. Run the following command to access the chosen DCS Memcached instance:

      telnet {ip} {port}

      In this command: {ip} indicates the IP address of the DCS Memcached instance. {port} indicates the port number of the DCS Memcached instance. Both the IP address and the port number are obtained in 4.

      When you have successfully accessed the chosen DCS Memcached instance, information similar to the following is displayed:

      Trying XXX.XXX.XXX.XXX...
      Connected to XXX.XXX.XXX.XXX.
      Escape character is '^]'.
      • If Password-protected is not enabled for the instance, run the following commands directly after the instance is accessed successfully.
      • If Password-protected is enabled for the instance, attempts to perform operations on the instance will result in the message "ERROR authentication required", indicating that you do not have the required permissions. In this case, enter auth username@password to authenticate first. username and password are that used for accessing the DCS Memcached instance.

      Example commands for using the DCS Memcached instance (lines in red are the commands and the other lines are the command output):

      set hello 0 0 6
      world!
      STORED
      get hello
      VALUE hello 0 6
      world!
      END