Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sample Analysis of configuration, Startup, Operation and shutdown in Redis

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you the "sample analysis of configuration, startup, operation and shutdown in Redis", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of configuration, startup, operation and shutdown in Redis".

First, start Redis

1. Default configuration startup

Execute the redis-server command to start Redis as configured in the default redis.conf configuration file, as follows:

Because the default configuration cannot be customized. So this method will no longer be used in the production environment.

two。 Running configuration startup

Add the configuration name and value to be modified after the command redis-server (multiple pairs can be set), and the default configuration will be used if it is not set.

For example: redis-server-- port 6389-timeout 3000

Although the configuration can be customized. However, if you modify a large number of configurations, you should save them in the configuration file, which is not recommended.

(configuration file startup

Write the configuration file to the specified redis.conf file, and specify the path to the configuration file after the redis-server command at startup, and redis will start according to the configuration of the configuration file redis.conf. For example: redis-server redis.conf

II. Redis command line client redis-cli

1 how redis-cli connects to the server

(1) Cluster interaction

Redis-cli-c-h 10.3.34.101-p 7000

(2) stand-alone interaction mode

Redis-cli-c-h 10.3.34.101-p 7000

(3) Command mode

Redis-cli-c-h 10.3.34.101-p 7000 set aaa 1

In the above command, if there is no-h parameter, the default connection is 127.0.0.1. If there is no-p parameter, port 6370 is connected by default.

Stop the Redis service

(1) after the shutdown command is executed after connecting to the server through redis-cli, the stop redis service operation is performed.

(2) in addition to using the shutdown command to shut down the redis server, you can also use the kill+ process number to shut down the redis service.

(3) do not use Kill 9 to shut down the redis process, so that redis will not carry out persistence operation. In addition, it will also cause resources such as buffers to be closed gracefully, which in extreme cases will result in data loss in AOF and replication.

(4) shutdown also has a parameter indicating whether to produce persistence files before shutting down the redis service

Shutdown save | nosave above is all the contents of this article entitled "sample Analysis of configuration, Startup, Operation and shutdown in Redis". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 212

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report