How to start and exit redis?
Start redis
1. Start with default configuration
Execute the redis-server command and start Redis according to the configuration in the default redis.conf configuration file, as follows:
Because the default configuration cannot be customized. Therefore, this method will not be used in the production environment
2. Run configuration startup
Add the configuration name and value to be modified after the command redis-server (multiple pairs can be set), there is no setting The default configuration will be used.
For example: redis-server --port 6389 –timeout 3000
Although the configuration can be customized. However, if there are many modified configurations, they should be saved in the configuration file. This method is not recommended.
Configuration file startup
Write the configuration file to the specified redis.conf file. When starting, after the redis-server command, specify the path of the configuration file, then redis will follow the configuration file redis .conf configuration to start. For example: redis-server redis.conf
Exit Redis
After connecting to the server through redis-cli and executing the shutdown command, the redis service operation will be stopped.
In addition to using the shutdown command to shut down the redis server, you can also use the kill process ID to shut down the redis service.
Do not use the Kill9 method to shut down the redis process. In this way, redis will not perform persistence operations. In addition, resources such as buffers will not be closed gracefully. In extreme cases, AOF and copy data will be lost. Situation
shutdown also has a parameter, which represents whether to produce persistent files before closing the redis service
shutdown save|nosave
The above is the detailed content of How to exit redis. For more information, please follow other related articles on the PHP Chinese website!