Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Connecting to and Starting Redis | Redis-Grunnleggende
Introduksjon til Redis

Connecting to and Starting Redis

Sveip for å vise menyen

Starting Redis Server

Note
Definition

The Redis Server is the core component of Redis, responsible for managing data and handling requests. To get started, you need to launch the Redis server.

You already know how to start the server via the command line on macOS.

redis-server

After running the command, you'll see information about the current server status.

redis-server

When Redis starts, it logs key information, including the version (7.2.6), port number (typically 6379), and the PID (Process ID), which uniquely identifies the Redis process for management purposes.

It also logs the operating mode (default is standalone mode). The message Ready to accept connections confirms that the server has started successfully and is ready to handle requests.

Working with Redis CLI

Note
Definition

Redis CLI is a command-line utility used to interact with the Redis server. It allows you to send commands, check the database status, and troubleshoot.

To connect to the Redis server, run the following command:

redis-cli

Once connected, you'll see the command prompt:

redis-cli

Here, you can enter your commands that will interact with the Redis server. We'll cover that in the next section. But first, let's check if the server is working and if everything is set up correctly.

Checking Server Status

Note
Study More

In Redis, the PING command checks the connection to the server, typically responding with PONG. This is often used to test if the Redis server is reachable or to keep the connection alive.

To check the server's status, type the following command in Redis CLI:

PING

When you enter this command, the server responds with PONG, indicating that the connection is established and the server is running correctly.

redis+PING

Disconnecting from the Server

To quit Redis CLI, type the following command:

QUIT

This will close the connection and exit the command line interface.

1. What command is used to start the Redis server?

2. Which command is used to exit the Redis CLI?

question mark

What command is used to start the Redis server?

Velg det helt riktige svaret

question mark

Which command is used to exit the Redis CLI?

Velg det helt riktige svaret

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 5

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Seksjon 1. Kapittel 5
some-alt