redis windows on the installation, configuration and startup

Copyright notice: reproduced please specify, thank you https://blog.csdn.net/qrainly/article/details/82757902

download and install redis

download

redis originally does not support windows, but redis engineers are very conscience of our community to develop a version for everyone to learn, Download: https://github.com/MicrosoftArchive/redis/releases Redis current official version has been upgraded to beta5 .0, windows open version is the highest version 3.2.100, but for us to develop learning enough.
1, after the download package
After downloading the archive
2, no installation, can be directly extracted
Unzip
after decompression directory
Here Insert Picture Description

Configuration

1, the basic configuration

# 可以引用其他配置文件,在redis分布式集成中满足单个redis服务器的个性化配置
# include /path/to/local.conf
# include /path/to/other.conf

# 服务器可以有多个网卡,如果只绑定一个,则只有改网卡地址接受外部请求,如果不绑定,则多个网卡都接受请求
# bind 192.168.1.100 192.168.1.101
# bind 127.0.0.1 ::1

# 监听端口号,默认为6379,如果为0监听任连接
port 6379

# TCP连接中已完成队列的长度
tcp-backlog 511

#客户端和Redis服务端的连接超时时间,默认为0表示永不超时
timeout 0

# 服务端周期性时间(单位秒)验证客户端是否处在健康状态,避免服务端一直阻塞
tcp-keepalive 300

# Redis以后台守护进程形式启动
daemonize yes

#Redis日志级别:debug,verbose,notice,warning,级别一次递增
loglevel notice

#日志文件路径及名称
logfile ./redis.log

2, endurance of arrangement

2.1 RDB persistence

#  当在规定的时间内,Redis发生了写操作的个数满足条件,会触发发生BGSAVE命令。
# 当用户设置了多个save的选项配置,只要其中任一条满足,Redis都会触发一次BGSAVE操作
# 比如:900秒之内至少一次写操作、300秒之内至少发生10次写操作、60秒之内发生至少10000次写操作都会触发发生快照操作
save 900 1
save 300 10
save 60 10000

2.2 AOF persistence

# redis默认关闭AOF机制,可以将no改成yes实现AOF持久化
appendonly no

# AOF文件
appendfilename "appendonly.aof"

# AOF持久化同步频率,always表示每个Redis写命令都要同步fsync写入到磁盘中,但是这种方式会严重降低redis的速度;everysec表示每秒执行一次同步fsync,显示的将多个写命令同步到磁盘中;no表示让操作系统来决定应该何时进行同步fsync,Linux系统往往可能30秒才会执行一次
# appendfsync always
appendfsync everysec
# appendfsync no

# 在日志进行BGREWRITEAOF时,如果设置为yes表示新写操作不进行同步fsync,只是暂存在缓冲区里,避免造成磁盘IO操作冲突,等重写完成后在写入。redis中默认为no  
no-appendfsync-on-rewrite no   

# 当前AOF文件大小是上次日志重写时的AOF文件大小两倍时,发生BGREWRITEAOF操作。  
auto-aof-rewrite-percentage 100  

#当前AOF文件执行BGREWRITEAOF命令的最小值,避免刚开始启动Reids时由于文件尺寸较小导致频繁的BGREWRITEAOF。  
auto-aof-rewrite-min-size 64mb  

# Redis再恢复时,忽略最后一条可能存在问题的指令(因为最后一条指令可能存在问题,比如写一半时突然断电了)
aof-load-truncated yes

#Redis4.0新增RDB-AOF混合持久化格式,在开启了这个功能之后,AOF重写产生的文件将同时包含RDB格式的内容和AOF格式的内容,其中RDB格式的内容用于记录已有的数据,而AOF格式的内存则用于记录最近发生了变化的数据,这样Redis就可以同时兼有RDB持久化和AOF持久化的优点(既能够快速地生成重写文件,也能够在出现问题时,快速地载入数据)。
aof-use-rdb-preamble no

3, master-slave configuration

# 配置主redis服务的地址和端口
slaveof 127.0.0.1 6379

start up

The introduction of a script file to start, you can also start by cmd command line
Here Insert Picture Description

Script Start
to start the main Redis service start.bat
must switch to the redis extract the directory, the following is my decompression directory, you can modify their own

@echo off
d:
cd \redis\Redis-x64-3.2.100
redis-server  redis.windows.conf 
cmd

Successful start Example:
Here Insert Picture Description
Start from redis service startSlave.bat

@echo off
d:
cd \v_liuwen\Redis-x64-3.2.100
redis-server  redis.windows.conf 
cmd

Start redis successful examples from the service:
Here Insert Picture Description

redis main connection from the successful example of the service:
Here Insert Picture Description

Paper Zhongjue know this practice is essential

Guess you like

Origin blog.csdn.net/qrainly/article/details/82757902