Redis----windows下的常用命令
1:首先下载redis。
从下面地址下:https://github.com/MSOpenTech/redis/releases
2:创建redis.conf文件:
这是一个配置文件,指定了redis的监听端口,timeout等。如下面有:port 6379。
配置:
遇到问题:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
[18892] 05 Jan 16:02:28.584 #The Windows version of Redis allocates a memory mapped heap for sharing withthe forked process used for persistence operations. In order to share thismemory, Windows allocates from the system paging file a portion equal to thesize of the Redis heap. At this time there is insufficient contiguous freespace available in the system paging file for this operation (Windows error0x5AF). To work around this you may either increase the size of the systempaging file, or decrease the size of the Redis heap with the --maxheap flag.Sometimes a reboot will defragment the system paging file sufficiently forthis operation to complete successfully.Please see the documentation included with the binary distributions for moredetails on the --maxheap flag.Redis can not continue. Exiting. |
处理方法:
|
1
2
3
4
5
|
windows硬盘需要配置虚拟内存,如果还有问题,清理磁盘碎片redis.windows.conf<span style="color: #ff0000;"><strong>maxheap 1024000000daemonize no</strong></span> |
更改redis的配置需要修改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.命令行操作
使用CMD命令提示符,打开redis-cli连接redis服务器 ,也可以使用telnet客户端
# redis-cli -h 服务器 –p 端口 –a 密码
redis-cli.exe -h 127.0.0.1 -p 6379
连接成功后,就可对redis数据增删改查了,如字符串操作:

以下是一些服务器管理常用命令:
info #查看服务器信息
select <dbsize> #选择数据库索引 select 1
flushall #清空全部数据
flushdb #清空当前索引的数据库
slaveof <服务器> <端口> #设置为从服务器
slaveof no one #设置为主服务器
shutdown #关闭服务
附加几个 bat 批处理脚本,请根据需要灵活配置
|
1
2
3
4
5
6
7
8
|
service-install.batredis-server.exe --service-install redis.windows.conf --loglevel verbose uninstall-service.batredis-server --service-uninstall startup.batredis-server.exe redis.windows.conf |
Redis----windows下的常用命令的更多相关文章
- Windows下MongoDB常用命令
以下命令中的启动与暂停服务命令需要使用管理员身份运行cmd.exe,其他命令需要先cd到Mongodb安装目录的bin目录. 1.启动服务:net start [Mongodb服务名].示例: net ...
- windows下的常用命令
net start ... 启动某个服务 net stop ... 停止某个服务 net start 查看所有启动的服务 services.msc 打开服务的界面 ipconfig ...
- Windows下CMD常用命令
清理DNS的缓存 ipconfig /flushdns 查看dns nslookup 重置socket服务 netsh winsock reset 重置tcp/ip协议栈 netsh int ip r ...
- windows下CMD常用命令(url链接)
https://blog.csdn.net/LJFPHP/article/details/78818696
- windows下使用curl命令 && 常用curl命令
什么是curl命令? curl是利用URL语法在命令行方式下工作的开源文件传输工具.它被广泛应用在Unix.多种Linux发行版中,并且有DOS和Win32.Win64下的移植版本. 如何在windo ...
- windows下使用curl命令&&常用curl命令
什么是curl命令? curl是利用URL语法在命令行方式下工作的开源文件传输工具.它被广泛应用在Unix.多种Linux发行版中,并且有DOS和Win32.Win64下的移植版本. 如何在windo ...
- windows下python常用库的安装
windows下python常用库的安装,前提安装了annaconda 的python开发环境.只要已经安装了anaconda,要安装别的库就很简单了.只要使用pip即可,正常安装好python,都会 ...
- windows下cmd常用
windows下cmd常用 shutdown -s -t 2------2秒后关机 加上-f选项意思是强制执行 shutdown -r -t 2------2秒后重启 加上-f选项意思是强制执行 lo ...
- windows下cmd中命令操作
windows下cmd中命令: cls清空 上下箭头进行命令历史命令切换 ------------------------------------------------------------- ...
- redis学习-散列表常用命令(hash)
redis学习-散列表常用命令(hash) hset,hmset:给指定散列表插入一个或者多个键值对 hget,hmget:获取指定散列表一个或者多个键值对的值 hgetall:获取所欲哦键值以及 ...
随机推荐
- UVa 10340 子序列
https://vjudge.net/problem/UVA-10340 题意: 输入两个字符串s和t,判断是否可以从t中删除0个或多个字符得到字符串s. 思路: 很水的题... #include&l ...
- jquery扩展的两个方法与区别 $.extend $.fn.extend
jQuery.extend:Query本身的扩展方法 jQuery.fn.extent(Object) jquery 所选对象扩展方法 jQuery.extend 我们先把jQuery看成了一个类,这 ...
- 【Python】【有趣的模块】【Bobo】
[python web框架之 bobo的安装配置] [Mac] 我的Mac环境,python3.5 1. 安装bobo : >>> pip3 install bobo 2. 配 ...
- WPF基础学习笔记整理 (四) 布局
WPF使用的是容器(container)进行布局: WPF窗口(Window类型)只能包含单个元素,故为了放置多个元素并增强界面效果,引入了容器: WPF布局容器都派生自System.Windows. ...
- -bash: brew: command not found
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ...
- ubuntu 14.04 (desktop amd 64) 安装和配置ROS Indigo
安装ROS 配置Ubuntu的软件源 配置Ubuntu要求允许接受restricted.universe和multiverse的软件源,可以根据下面的链接配置: https://help.ubuntu ...
- [tixml]保存,读取
保存: //xml的实体 TiXmlElement* rootElement = new TiXmlElement("spark"); rootElement->SetAtt ...
- [ios][map]自定义地图标注
参考:http://blog.csdn.net/mad1989/article/details/8794762 ios 一步一步学会自定义地图吹出框(CalloutView)-->(百度地图,高 ...
- HDU2017新生赛 找方块
思路: 先n^3预处理出每个点能到达的(1010串)最上面的行下标. 然后再n^3暴力一下,对于每个点,往左走看能走到哪,边走边更新面积. 代码: #include<bits/stdc++.h& ...
- HDU 4054 Number String
HDU 4054 Number String 思路: 状态:dp[i][j]表示以j结尾i的排列 状态转移: 如果s[i - 1]是' I ',那么dp[i][j] = dp[i-1][j-1] + ...