YouTip LogoYouTip

Redis Commands

# Redis Commands Redis commands are used to perform operations on the Redis server. To execute commands on the Redis server, a Redis client is required. The Redis client is included in the Redis installation package we downloaded earlier. ### Syntax The basic syntax for the Redis client is: $ redis-cli ### Example The following example demonstrates how to start the Redis client: Start the Redis server, open the terminal, and enter the command **redis-cli**. This command will connect 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 connected to the local Redis service and executed the **PING** command, which is used to check if the Redis service is running. * * * ## Executing Commands on a Remote Service If you need to execute commands on a remote Redis service, you also use the **redis-cli** command. ### Syntax $ redis-cli -h host -p port -a password ### Example The following example demonstrates how to connect to a Redis service with host 127.0.0.1, port 6379, and password "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
← Transactions DiscardC Function Signal β†’