redis 在 windows 中的安装

redis 官方并没有提供 redis 的 windows 版本。但是微软提供了 redis 的 windows 版本。有2.8和3.0版本。3.0版本支持集群。

微软提供的redis的windows版本地址
https://github.com/microsoftarchive/redis/releases

下载后解压

启动

# 指定配置文件
D:\chengxu\redis-3.0.504-x64>redis-server redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.0.504 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 10072
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-' [10072] 19 Oct 20:51:38.828 # Server started, Redis version 3.0.504
[10072] 19 Oct 20:51:38.832 * The server is now ready to accept connections on port 6379 # 双击redis-cli.exe 打开客户端成功
127.0.0.1:6379> set foo 1
OK

设置服务

Windows Service Documentation.docx 文档中有描述。

安装服务

# 默认服务名为redis
D:\chengxu\redis-3.0.504-x64>redis-server --service-install redis.windows-service.conf --loglevel verbose # 指定服务名为Redis3.0 端口号为6381
D:\chengxu\redis-3.0.504-x64>redis-server --service-install redis.windows.conf --loglevel verbose --port 6381 --service-name Redis3.0 [12912] 19 Oct 21:04:45.014 # Granting read/write access to 'NT AUTHORITY\NetworkService' on: "D:\chengxu\redis-3.0.504-x64" "D:\chengxu\redis-3.0.504-x64\"
[12912] 19 Oct 21:04:45.014 # Redis successfully installed as a service.

卸载服务

# 不指定服务名,使用默认服务名redis
D:\chengxu\redis-3.0.504-x64>redis-server --service-uninstall
[17268] 19 Oct 21:17:29.102 # Redis service successfully uninstalled # 卸载前先停止服务
D:\chengxu\redis-3.0.504-x64>redis-server --service-uninstall --service-name redis3.0
[17476] 19 Oct 21:17:50.561 # Redis service successfully uninstalled.

停止服务

# 服务名称如果不指定默认为redis
D:\chengxu\redis-3.0.504-x64>redis-server --service-stop --service-name redis3.0
[12360] 19 Oct 21:23:08.044 # Redis service successfully stopped.

启动服务

# 服务名称如果不指定默认为redis。如果服务已经启动,再次执行会报错。
D:\chengxu\redis-3.0.504-x64>redis-server --service-start --service-name redis3.0
[16536] 19 Oct 21:24:08.587 # Redis service successfully started.

客户端连接

D:\chengxu\redis-3.0.504-x64>redis-cli --help
redis-cli 3.0.504 Usage: redis-cli [OPTIONS] [cmd [arg [arg ...]]]
-h <hostname> Server hostname (default: 127.0.0.1).
-p <port> Server port (default: 6379).
-s <socket> Server socket (overrides hostname and port).
-a <password> Password to use when connecting to the server.

实战

D:\chengxu\redis-3.0.504-x64>redis-cli -h localhost -p 6381
localhost:6381> get foo
(nil)
localhost:6381> set foo 1
OK
localhost:6381> exit

bugs

# 没有指定配置文件,将会使用默认的配置。而且是需要密码的,但是我们并不知道密码。
D:\chengxu\redis-3.0.504-x64>redis-server
[1460] 19 Oct 20:31:59.351 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[1460] 19 Oct 20:31:59.353 # Creating Server TCP listening socket *:6379: bind: No such file or directory D:\chengxu\redis-3.0.504-x64>netstat -ano |findstr 6379
TCP 0.0.0.0:6379 0.0.0.0:0 LISTENING 5188
TCP [::]:6379 [::]:0 LISTENING 5188 # 打开客户端,没有认证
127.0.0.1:6379> get foo
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth redis
(error) ERR invalid password
127.0.0.1:6379>
# 先停止服务再卸载服务。不然报错。
D:\chengxu\redis-3.0.504-x64>redis-server --service-uninstall --service-name redis3.0
[14972] 19 Oct 21:18:09.837 # HandleServiceCommands: system error caught. error code=1072, message = DeleteService failed: unknown error
# 如果服务已经启动,执行启动命令将报错。
D:\chengxu\redis-3.0.504-x64>redis-server --service-start --service-name redis3.0
[7304] 19 Oct 21:24:21.685 # HandleServiceCommands: system error caught. error code=1056, message = StartService failed: unknown error
# 找到不到服务名则报错。默认为redis
D:\chengxu\redis-3.0.504-x64>redis-server --service-stop
[4412] 19 Oct 21:22:47.868 # HandleServiceCommands: system error caught. error code=1060, message = OpenService failed: unknown error

redis 在 windows 中的安装的更多相关文章

  1. redis在windows中的安装

    之前介绍过了redis的相关知识,以及在linux平台上安装redis,为了方便学习,这里记录一下redis在windows平台上的安装步骤 1.下载redis下载地址https://github.c ...

  2. 下载文件时-修改文件名字 Redis在Windows中安装方法 SVN安装和使用(简单版) WinForm-SQL查询避免UI卡死 Asp.Net MVC Https设置

    下载文件时-修改文件名字   1后台代码 /// <summary> /// 文件下载2 /// </summary> /// <param name="Fil ...

  3. Redis for Windows(C#缓存)安装和使用

    Redis for Windows(C#缓存)安装和使用 前言 前段时间写过两篇简单的有关Memcached缓存的相关文章,当然了只是入门的如何使用而已.最近这两天又发现了Redis这个神奇的东西,之 ...

  4. Appium+Robotframework实现Android应用的自动化测试-1:Appium在Windows中的安装

    让我们开始在Windows中开始安装Appium吧,Appium在OS X中的具体安装后面的文章会介绍. 另外,官网上说先要装Node.js,还要装Apache Ant和Apache Maven,Gi ...

  5. windows中配置安装mysql数据库

    MySql 是一种免费的关系型数据库,相较于 MsSqlServer 和 Oracle 比较轻量化,安装也很简单,而且免费不需要的版权费用,个人认为一般的小项目采用还是比较合适的,当然也有部分数据量很 ...

  6. ElasticSearch之Windows中环境安装

    ElasticSearch 说明 本章,我们主要以在 Windows 中对ElasticSearch 安装进行介绍! 1. 下载 ElasticSearch 这里我们下载的版本为7.17.4为例进行介 ...

  7. Redis在Windows中安装方法

    首先下载Redis 下载地址:https://github.com/MSOpenTech/redis/releases Redis支持32位和64位,这个需要根据你系统平台的实际情况选择,我的是64位 ...

  8. NoSQL和Redis简介及Redis在Windows下的安装和使用教程

    转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/103.html?1455869099 NoSQL简介 介绍redis前,我 ...

  9. Redis在Windows下的安装和使用

    NoSQL简介 介绍redis前,我想还是先认识下NoSQL,即not only sql, 是一种非关系型的数据存储,key/value键值对存储.现有Nosql DB 产品: Redis/Mongo ...

随机推荐

  1. Visual Studio 2017 编译 gens 世嘉模拟器

    1) 下载源代码 2.14 版本 http://gens.me/downloads.shtml 2) 下载 老版本 DirectX 并且安装 https://github.com/apitrace/a ...

  2. bioawk

    https://github.com/lh3/bioawk 1.基本思想 使用: usage: bioawk [-F fs] [-v var=value] [-c fmt] [-tH] [-f pro ...

  3. WinCC中通过脚本禁用或启用Windows快捷键

    有些项目要求WinCC全屏运行,并禁止通过操作系统快捷键切换到桌面,这时只需要在WinCC的计算机属性中勾选“禁用用于进行操作系统访问的快捷键”.此后当WinCC运行时,按Win键或Ctrl+Alt+ ...

  4. 第04组 Alpha事后诸葛亮

    一.组长博客:地址 二.Postmortem模板 设想和目标 1.我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有清晰的描述? 我们要解决的问题是让大学生可以通过福鱼网站将暂时无 ...

  5. jvm 性能调优工具之 jmap

    概述 命令jmap是一个多功能的命令.它可以生成 java 程序的 dump 文件, 也可以查看堆内对象示例的统计信息.查看 ClassLoader 的信息以及 finalizer 队列. jmap ...

  6. R语言填充空缺值

    在R语言中, imputeMissings包的特点是,如果空值是数值型,则使用median代替,如果使用的是character类型,则使用mode值代替. imputeMissing中,需要的包是im ...

  7. 【shell脚本】检查内存使用情况===chenkMen.sh

    检查内存使用情况,当内存可使用等于100时,释放缓存 [root@localhost thy]# cat checkMem.sh #!/bin/bash #防止内存溢出问题 used=`free -m ...

  8. LeetCode28——实现strStr()

    6月中下旬辞职在家,7 月份无聊的度过了一个月.8 月份开始和朋友两个人写项目,一个后台和一个 APP ,APP 需要对接蓝牙打印机.APP 和蓝牙打印机都没有搞过,开始打算使用 MUI 开发 APP ...

  9. windows10 启动安卓模拟器会蓝屏的解决方案

    最近突然想用win10装个安卓模拟器玩游戏,然后提示vt被占用. 查了一下,了解到在windows 10 系统上,我们会用vmware,virtual box ,hyper-v,安卓模拟器,360安全 ...

  10. 【MySQL】条件查询之排序聚合分组分页查询

    排序查询 语法:order by 子句 order by 排序字段1 排序方式1 , 排序字段2 排序方式2... 排序方式: ASC:升序,默认的. DESC:降序. 注意: 如果有多个排序条件,则 ...