Windows下Redis的安装使用教程

   2016-05-26 0
核心提示:这篇文章主要以图文结合的方式为大家详细介绍了Windows下Redis的安装使用,Redis的出现,很大程度补偿了memcached这类key/value存储的不足,在部分场合可以对关系数据库起到很好的补充作用,对Redis感兴趣的小伙伴们可以参考一下

本文主要为大家介绍缓存技术中的一种Redis的安装和使用,供大家参考,具体内容如下

一、下载Redis for windows

在网络中搜索Redis fow windows,就可以下载Redis的压缩包。解压包。

Windows下Redis的安装使用教程

会发现其中有32位和64位的不同版本的包,根据需要,使用对应的压缩包即可。

二、解压

我使用的是redisbin_x64.zip的压缩包,将其解压到redis的文件夹中。

Windows下Redis的安装使用教程

解压之后,会发现内容只有一些.exe的文件。到这里,redis就算做好了一半了。

三、配置

在redis下新建一个conf的文件夹,并创建 redis.conf 文本文件。将一下内容复制到配置文件中。

# Redis configuration file example 
 
# By default Redis does not run as a daemon. Use 'yes' if you need it. 
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized. 
# 是否以后台进程的形式运行,默认为no 
daemonize no 
 
# When run as a daemon, Redis write a pid file in /var/run/redis.pid by default. 
# You can specify a custom pid file location here. 
# 如果指定以后台形式执行,则需要指定一个pid文件 
pidfile /var/run/redis.pid 
 
# Accept connections on the specified port, default is 6379 
#监听端口号 
port 6379 
 
# If you want you can bind a single interface, if the bind option is not 
# specified all the interfaces will listen for connections. 
# 绑定主机IP 
# bind 127.0.0.1 
 
# Close the connection after a client is idle for N seconds (0 to disable) 
# 客户端空闲超时时间,设置为0,则没有超时。过了空闲时间,则会将客户端的连接关闭 
timeout 300 
 
# Set server verbosity to 'debug' 
# it can be one of: 
# debug (a lot of information, useful for development/testing) 
# notice (moderately verbose, what you want in production probably) 
# warning (only very important / critical messages are logged) 
# 日志记录等级 
loglevel debug 
 
# Specify the log file name. Also 'stdout' can be used to force 
# the demon to log on the standard output. Note that if you use standard 
# output for logging but daemonize, logs will be sent to /dev/null 
# 日志记录方式 
logfile stdout 
 
# Set the number of databases. The default database is DB 0, you can select 
# a different one on a per-connection basis using SELECT <dbid> where 
# dbid is a number between 0 and 'databases'-1 
# 可用数据库数目 
databases 16 
 
################################ SNAPSHOTTING ################################# 
# 
# Save the DB on disk: 
# 
# save <seconds> <changes> 
# 
# Will save the DB if both the given number of seconds and the given 
# number of write operations against the DB occurred. 
# 
# In the example below the behaviour will be to save: 
# after 900 sec (15 min) if at least 1 key changed 
# after 300 sec (5 min) if at least 10 keys changed 
# after 60 sec if at least 10000 keys changed 
save 900 1 
save 300 10 
save 60 10000 
 
# Compress string objects using LZF when dump .rdb databases" alt="Windows下Redis的安装使用教程" />

四、启动redis服务器

使用一下命令启动 redis服务器。

redis-server.exe conf/redis.conf

启动成功之后,你会看到如下的提示:

Windows下Redis的安装使用教程

五、连接redis服务器

使用redis自带的命令,能够连接服务器。

redis-cli.exe -h localhost -p 6379

连接成功之后,会提示以下内容:

Windows下Redis的安装使用教程

这个时候,你就能够使用redis的一下指令操作数据。其他指令,请在网上具体查看一下。

以上就是本文的全部内容,希望对大家的学习有所帮助。

 
标签: Windows Redis
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

点击排行