1-Redis的后台启动Linux环境

redis6.2.1安装完成后会在/usr/local/bin目录下生成redis的相关文件;
在这里插入图片描述

第一步

切换到redis的安装目录/softWare/redis6/redis-6.2.1找到redis.conf文件并且将文件复制到/etc目录下,(也可以不复制)
在这里插入图片描述
第二步
切换到/etc目录下,找到redis.conf文件,将文件中daemonize no改成yes支持后台启动
在这里插入图片描述
第三步
切换到/usr/local/bin目录启动redis并指定配置文件
在这里插入图片描述
第四步
通过redis的客户端连接redis进行操作
在这里插入图片描述
redis的配置文件 redis-conf

第一部分:

# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.

配置大小单位开头部分定义了一些基本的度量单位,只支持bytes,不支持bit,大小写不敏感

第二部分:

################################## INCLUDES ###################################

# Include one or more other config files here.  This is useful if you
# have a standard template that goes to all Redis servers but also need
# to customize a few per-server settings.  Include files can include
# other files, so use this wisely.
#
# Note that option "include" won't be rewritten by command "CONFIG REWRITE"
# from admin or Redis Sentinel. Since Redis always uses the last processed
# line as value of a configuration directive, you'd better put includes
# at the beginning of this file to avoid overwriting config change at runtime.
#
# If instead you are interested in using includes to override configuration
# options, it is better to use include as the last line.
#
# include /path/to/local.conf
# include /path/to/other.conf

include 一个文件内容可以包含另个文件的内容

第三部分:

################################## NETWORK #####################################
bind 127.0.0.1 -::1

上面配置指只支持本地进行访问,想要远程需要注释掉

################################## NETWORK #####################################
protected-mode yes

开启保护模式yes那么只能进行本机访问,no是支持远程访问

################################## NETWORK #####################################
port 6379

端口号默认6379

################################## NETWORK #####################################
tcp-backlog 511

设置tcp连接的数量,backlog其实是一个连接队列,在java中一次完整得连接是由三次握手和四次挥手组成的,那么在redis的backlog的队列总数=未完成三次握手队列+已完成三次握手的队列,在高并发下你需要适当提高backlog的数量,来解决客户端连接慢的问题
在这里插入图片描述

################################## NETWORK #####################################
timeout 0 

redis连接的超时时间 0 为永不超时单位秒

################################## NETWORK #####################################
tcp-keepalive 300

心跳检测时间300秒检测一次

################################# GENERAL #####################################
daemonize no

daemonize no改成yes`支持后台启动

################################# GENERAL #####################################

pidfile /var/run/redis_6379.pid

将redis的进程号保存在redis_6379.pid文件中

################################# GENERAL #####################################
# Specify the server verbosity level.
# This can be one of:
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel notice

redis的日志级别
debug开发环境非常详细的日志
verbose 类似于java的info
notice 生成上的日志级别
warning 只显示一些非常重要的日志或异常日志

################################# GENERAL #####################################
logfile ""

日志路径默认为空

################################# GENERAL #####################################
databases 16

redis数据库的数量默认0号库

################################# REPLICATION #################################
# requirepass foobared

redis设置密码的地方,默认注释掉没有密码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值