Configuration start operate and close methods for Redis
- 2020-06-15 10:29:20
- OfStack
1. Start the Redis
1. Default configuration starts
Execute the redis-ES7en command and start Redis as shown in the default redis. conf configuration file, as follows:
Because the default configuration cannot be customized. So this method will not be used in the reproduction environment
2. Run configuration start
The command ES17en-ES18en is followed by the configuration name and value to be changed (multiple pairs can be set). Those that are not set will use the default configuration.
redis-server --port 6389, by timeout 3000
Although you can customize the configuration. However, if more configuration changes are made, they should be saved in the configuration file, which is not recommended.
(Configuration file starts
Write the configuration file to the specified ES31en.conf file. When starting, after the command ES33en-ES34en, specify the path of the configuration file and redis will start as the configuration file redis.conf. For example, redis-ES39en redis.conf
Redis command line client ES45en-ES46en
redis-cli how to connect 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
Above command, if there is no -ES68en parameter, the default connection is 127.0.0.1; if there is no -ES69en parameter, the default connection is port 6370
3. Discontinue Redis service
(1) After connecting to the server via ES75en-ES76en, shutdown command will be executed to stop redis service operation.
(2) shutdown command can be used to close the redis server, or kill+ process number can be used to close the redis service.
(3) Do not use Kill 9 to close the redis process, so that redis will not persist operation, in addition, it will cause buffer and other resources cannot be closed gracefully, in extreme cases, it will cause AOF and copy lost data
(4) shutdown also has one parameter, which represents whether to produce persistent files before closing the redis service
shutdown save|nosave