1:首先下载redis。
从下面地址下:https://github.com/MSOpenTech/redis/releases
2:创建redis.conf文件:

#是否作为守护进程运行
daemonize no
#Redis 默认监听端口
port 6379
#客户端闲置多少秒后,断开连接
timeout 300
#日志显示级别
loglevel verbose
#指定日志输出的文件名,也可指定到标准输出端口
logfile redis.log
#设置数据库的数量,默认最大是16,默认连接的数据库是0,可以通过select N 来连接不同的数据库
databases 32
#Dump持久化策略
#当有一条Keys 数据被改变是,900 秒刷新到disk 一次
#save 900 1
#当有10 条Keys 数据被改变时,300 秒刷新到disk 一次
save 300 100
#当有1w 条keys 数据被改变时,60 秒刷新到disk 一次
save 6000 10000
#当dump     .rdb 数据库的时候是否压缩数据对象
rdbcompression yes
#dump 持久化数据保存的文件名
dbfilename dump.rdb
###########    Replication #####################
#Redis的主从配置,配置slaveof则实例作为从服务器
#slaveof 192.168.0.105 6379
#主服务器连接密码
# masterauth <master-password>
############## 安全性 ###########
#设置连接密码
#requirepass <password>
############### LIMITS ##############
#最大客户端连接数
# maxclients 128
#最大内存使用率
# maxmemory <bytes>
########## APPEND ONLY MODE #########
#是否开启日志功能
appendonly no
# AOF持久化策略
#appendfsync always
#appendfsync everysec
#appendfsync no
################ VIRTUAL MEMORY ###########
#是否开启VM 功能
#vm-enabled no
# vm-enabled yes
#vm-swap-file logs/redis.swap
#vm-max-memory 0
#vm-page-size 32
#vm-pages 134217728
#vm-max-threads 4

主从复制

在从服务器配置文件中配置slaveof ,填写服务器IP及端口即可,如果主服务器设置了连接密码,在masterauth后指定密码就行了。

持久化

  • redis提供了两种持久化文案,Dump持久化和AOF日志文件持久化。
  • Dump持久化是把内存中的数据完整写入到数据文件,由配置策略触发写入,如果在数据更改后又未达到触发条件而发生故障会造成部分数据丢失。
  • AOF持久化是日志存储的,是增量的形式,记录每一个数据操作动作,数据恢复时就根据这些日志来生成。

3.开启服务

命令行在Redis目录下

redis-server.exe redis.windows.conf 

出现错误和解决方式

redis-cli.exe

127.0.0.1:6379>shutdown

not connected>exit

出现

[18892] 05 Jan 16:02:28.584 #
The Windows version of Redis allocates a memory mapped heap for sharing with
the forked process used for persistence operations. In order to share this
memory, Windows allocates from the system paging file a portion equal to the
size of the Redis heap. At this time there is insufficient contiguous free
space available in the system paging file for this operation (Windows error
0x5AF). To work around this you may either increase the size of the system
paging file, or decrease the size of the Redis heap with the --maxheap flag.
Sometimes a reboot will defragment the system paging file sufficiently for
this operation to complete successfully.Please see the documentation included with the binary distributions for more
details on the --maxheap flag.Redis can not continue. Exiting.

解决方式

windows硬盘需要配置虚拟内存,如果还有问题,清理磁盘碎片
redis.windows.conf
<span style="color: #ff0000;"><strong>maxheap 1024000000
daemonize no
</strong></span>

3.命令行操作

使用CMD命令提示符,打开redis-cli连接redis服务器 ,也可以使用telnet客户端

# redis-cli -h 服务器 –p 端口 –a 密码

redis-cli.exe -h 127.0.0.1 -p 6379 -a 你的密码

连接成功后,就可对redis数据增删改查了,如字符串操作:

常用命令

info   #查看服务器信息
select <dbsize> #选择数据库索引  select 1
flushall #清空全部数据
flushdb  #清空当前索引的数据库
slaveof <服务器> <端口>  #设置为从服务器
slaveof no one #设置为主服务器
shutdown  #关闭服务

也可以用批处理文件开启服务

service-install.bat
redis-server.exe --service-install redis.windows.conf --loglevel verbose uninstall-service.bat
redis-server --service-uninstallstartup.bat
redis-server.exe redis.windows.conf 

Redis----windows下配置和运行相关推荐

  1. windows下配置redis集群,启动节点报错:createing server TCP listening socket *:7000:listen:Unknown error...

    windows下配置redis集群,启动节点报错:createing server TCP listening socket *:7000:listen:Unknown error 学习了:https ...

  2. Windows下配置Redis,并修改密码

    Windows下配置Redis,并修改密码 原文:Windows下配置Redis,并修改密码 Windows下配置Redis,并修改密码 下载 Redis Windows版本的GitHub链接,直接下 ...

  3. windows 下配置 react native 开发环境

    windows 下配置 react native 开发环境 安装nvm 由于react native 需要使用 NodeJs 4.0以上版本,为了方便切换NodeJs,首先我们需要安装nvm. 你可以 ...

  4. Windows下配置单机Hadoop环境

    Windows下配置单机Hadoop环境 文章目录 Windows下配置单机Hadoop环境 下载Hadoop 下载配置文件 配置环境变量 初始化HDFS 启动Hadoop 关闭Hadoop 常见错误 ...

  5. Windows下配置IDEA开发环境

    Windows下配置IDEA开发环境 文章目录 Windows下配置IDEA开发环境 安装JDK 查看JDK是否安装 下载JDK 配置环境变量 安装IDEA 下载IDEA 安装IDEA 初始化IDEA ...

  6. Windows和Linux双启动,并用在Windows下配置CoLinux启动

    http://www.cppblog.com/newclear/archive/2009/09/27/97327.html Windows和Linux双启动,并用在Windows下配置CoLinux启 ...

  7. Windows下配置nginx+php(wnmp)

    Windows下配置nginx+php(wnmp) 第一部分:准备工作.(系统:Windows 8.1) 1.首先是下载软件. NGINX-1.3.8官网下载:http://nginx.org/en/ ...

  8. 在Windows下配置与使用CVSNT - dudu - 博客园

    导读: dudu为程序员打杂的站长 博客园社区首页新随笔联系管理订阅 随笔- 1060 文章- 241 评论- 22227 在Windows下配置与使用CVSNT 1.下载CVSNT, 下载地址: h ...

  9. Windows下配置CMake(入门级教程,适合新人收藏学习)

    作者:翟天保Steven 版权声明:著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处 CMake是什么? CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安 ...

  10. Win 管理器 运行命令 大全(Windows下的DOS运行命令)

    DOS 运行命令管理器字符大全 Win 管理器  运行命令 大全(Windows下的DOS运行命令) Nslookup-------IP 地址侦测器 explorer-------打开资源管理器 de ...

最新文章

  1. tomcat中conf/server.xml配置线程池不生效的问题注意添加线程池节点executor后要在connector中增加executor属性
  2. gperf的学习笔记(一)
  3. oracle拆分字段为多行,一句话实现字段拆分成多行
  4. Zookeeper全解析——Paxos作为灵魂
  5. 网页常用动态效果--悬浮广告
  6. cad画直角命令_炸了,CAD fro命令配合tk命令,极轴追踪无敌!
  7. Ubuntu 11.04下最流行的17款应用(linux在中国市场的占有率好像只有0.1几%)
  8. IConfiguration的命令行解析
  9. 十七 、二叉树的概念
  10. 递归神经网络/_递归神经网络
  11. 定制通达信多周期同列版面
  12. 2022年新出的Python学习神器,强烈推荐
  13. 走迷宫算法1(递归 非最短路径)
  14. 记录一个错误Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0的解决过程
  15. 13. Zigbee应用程序框架开发指南 - 多网络支持
  16. 迅雷离线下载免费申请体验(3天)
  17. GPU百科全书(5)桌面显卡的捍卫者
  18. MongoDB数据库重命名
  19. 努比亚 系统升服务器设置,努比亚Nubia x6官方系统升级教程与方法
  20. gram矩阵的性质_矩阵分析(九)Gram矩阵

热门文章

  1. Windows Phone 7 Tips (6)
  2. 中国人工智能学会通讯——融合经济学原理的个性化推荐
  3. Openwrt netifd ubus解析
  4. svm理论与实验之1
  5. 用prototype 定义自己的方法
  6. [转]ubuntu 终端常用命令
  7. 开源SIP服务器加密软件NethidPro升级
  8. 37.go struct 结构
  9. 64.Linux/Unix 系统编程手册(下) -- 伪终端
  10. 40. 后台模块开发(5)