Configure Redis server parameters on Ubuntu

The default configuration of Redis is located in /etc/redis/redis.conf

If the permissions are insufficient, modify the permissions

 chmod 777 redis.conf
vim /etc/redis/redis.conf


1. Start redis with a daemon thread: daemonize


The daemonize daemon thread in the redis.conf configuration file, the default is NO , the current interface will enter the redis command line interface, exit forced to exit or close the connection tool (putty, xshell, etc.) will cause the redis process to exit, and the redis terminal window enables the blocking mode to find On, that is, after starting the redise service, the window cannot do other things.


Redis uses a single-process multi-thread mode. When the option daemonize in redis.conf is set to yes, it means that the daemon mode is enabled . In this mode, redis will run in the background and write the process pid number to the file set by the redis.conf option pidfile. At this time, redis will always run unless the process is manually killed.


It is recommended to change daemonize to yes to run as a daemon process

2. Redis listening port, that is, service port: port 6379


The default is 6379, if you set it to 0, redis will not listen for any client connections on the socket.

3. Number of databases: databases 16

The default is 16, no need to create, it is not recommended to modify

4. Set the frequency of sedis for database mirroring: save


Save data to disk according to the given time interval and number of writes.
Comment out the "save" line configuration item to disable the function of saving the database
save 900 1
save 300 10
save 60 10000
The above example means:
900 seconds (15 minutes If at least 1 key value changes
within 300 (5 minutes) seconds, if at least 1 key value changes, then save (database save-persistence) )
If there are at least 10,000 key values ​​changed within 60 seconds (1 minute), then save (then database save-persistence)

5. Enable remote access:


By default only local access is allowed, change the IP address by entering the value of the interface you want the Redis server to listen on.
If you want to add multiple IP addresses, just separate them with spaces
If you want the server to listen on all interfaces on the network, you can use the following command: bind 0.0.0.0

6. Set access password


There is no password by default for redis access. Find the line # requirepass foobared, remove the comment symbol #, and change the latter to your own password. For example, set the password to 12345678

7.Redis data file: dbfilename dump.rdb


8. Data file storage path: dir /var/lib/redis

Guess you like

Origin blog.csdn.net/djklsajdklsajdlk/article/details/127521973