- 使用jumbo安装:jumbo install redis
- 查看安装的文件位置:jumbo list-files redis
- 修改配置文件redis.conf中的daemonize yes,通过该配置项修改,使用yes启用守护进程
- 执行./redis-server /home/work/.jumbo/etc/redis.conf,启动redis
- 执行./redis-cli -h localhost -p 6379对redis进行测试
Redis配置详解
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
#Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程(守护进程(daemon)是指在UNIX或其他多任务操作系统中在后台执行的电脑程序,并不会接受电脑用户的直接操控。)
daemonize no
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
#当 Redis 以守护进程的方式运行的时候,Redis 默认会把 pid 文件放在/var/run/redis.pid,你可以配置到其他地址。当运行多个 redis 服务时,需要指定不同的 pid 文件和端口
pidfile /var/run/redis.pid
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
#端口没什么好说的
port 6379
# If you want you can bind a single interface, if the bind option is not
# specified all the interfaces will listen for incoming connections.
#指定Redis可接收请求的IP地址,不设置将处理所有请求,建议生产环境中设置
# bind 127.0.0.1
# Close the connection after a client is idle for N seconds (0 to disable)
#客户端连接的超时时间,单位为秒,超时后会关闭连接
timeout 0
# Specify the log file name. Also 'stdout' can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
#配置 log 文件地址,默认打印在命令行终端的窗口上
logfile stdout
# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT <dbid> where
# dbid is a number between 0 and 'databases'-1
#设置数据库的个数,可以使用 SELECT <dbid>命令来切换数据库。默认使用的数据库是 0
databases 16
#
# Save the DB on disk:
#
# save <seconds> <changes>
#
# Will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
#
# In the example below the behaviour will be to save:
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
#
# Note: you can disable saving at a
jumbo安装redis步骤以及redis配置详解
最新推荐文章于 2023-11-01 17:16:09 发布
本文介绍了使用jumbo安装Redis的步骤,包括修改配置文件启用守护进程,启动和测试Redis服务。此外,还详细解析了Redis配置文件中的各项参数,如daemonize、pidfile、port、bind、timeout、logfile等,帮助理解Redis的运行机制和优化设置。
摘要由CSDN通过智能技术生成