Redis 简明教程
Redis - Commands
Redis 命令用于对 Redis 服务器执行一些操作。
Redis commands are used to perform some operations on Redis server.
要在 Redis 服务器上运行命令,您需要一个 Redis 客户端。Redis 软件包中提供 Redis 客户端,我们已经安装过了。
To run commands on Redis server, you need a Redis client. Redis client is available in Redis package, which we have installed earlier.
Example
下面的示例说明如何启动 Redis 客户端。
Following example explains how we can start Redis client.
要启动 Redis 客户端,请打开终端并键入命令 redis-cli 。然后将连接到本地服务器。然后可以运行任何命令。
To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command.
$redis-cli
redis 127.0.0.1:6379>
redis 127.0.0.1:6379> PING
PONG
在上面的示例中,我们连接到在本地计算机上运行的 Redis 服务器,并执行了一个命令 PING ,可以检查服务器是否在运行。
In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.