Redis Command (iv)

Source: Internet
Author: User
Tags redis
Redis Command

Redis commands are used to perform operations on the Redis service.

A Redis client is required to execute commands on the Redis service. The Redis client is in the Redis installation package that we downloaded earlier. Grammar

The basic syntax for a REDIS client is:

$ redis-cli
Example

The following examples explain how to start a Redis client:

Start the Redis client, open the terminal and enter the command redis-cli. This command connects to the local Redis service.

$redis-cli
redis 127.0.0.1:6379>
redis 127.0.0.1:6379> PING

PONG

In the above example we connect to the local Redis service and perform a PING command that detects whether the Redis service is started. to execute a command on a remote service

If you need to execute commands on the remote Redis service, we also use the redis-cli command. Grammar

$ redis-cli-h host-p port-a Password
Example

The following example shows how to connect to a Redis service with a host of 127.0.0.1, a port of 6379, and a password of mypass.

$redis-cli-h 127.0.0.1-p 6379-a "Mypass"
redis 127.0.0.1:6379>
redis 127.0.0.1:6379> PING

PONG
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.