Redis学习(1)——下载与配置

Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。从2010年3月15日起,Redis的开发工作由VMware主持。

 

1、下载https://github.com/dmajkic/redis/downloads;由于我电脑是win7 64bit 所以下载

      redis-2.4.5-win32-win64.zip — Redis-2.4.5 - Windows binaries (win32 and x64 included)

2、压缩包下载后,我解压到桌面上,看到32bit和64bit两个文件夹,我只是用64bit那个,主要的文件如下

       redis-server.exe:服务程序

       redis-check-dump.exe:本地数据库检查

       redis-check-aof.exe:更新日志检查

       redis-benchmark.exe:性能测试,用以模拟同时由N个客户端发送M个 SETs/GETs 查询 (类似于 Apache 的ab 工具).

       redis-cli.exe  客户端,访问服务程序的节点

3、体验

(1)启动服务端

 C:\Users\Administrator\Desktop\Redis\redis-2.4.5-win32-win64\64bit>redis-server.exe redis.conf
[4392] 01 Apr 13:27:59 * Server started, Redis version 2.4.5
[4392] 01 Apr 13:27:59 # Open data file dump.rdb: No such file or directory
[4392] 01 Apr 13:27:59 * The server is now ready to accept connections on port 6379                //服务端的端口
[4392] 01 Apr 13:28:00 - 0 clients connected (0 slaves), 1179896 bytes in use                            //显示连接服务端的客户端数量
[4392] 01 Apr 13:28:06 - 0 clients connected (0 slaves), 1179896 bytes in use
[4392] 01 Apr 13:28:11 - 0 clients connected (0 slaves), 1179896 bytes in use
[4392] 01 Apr 13:28:17 - 0 clients connected (0 slaves), 1179896 bytes in use
…………

(2)启动客户端

C:\Users\Administrator\Desktop\Redis\redis-2.4.5-win32-win64\64bit>redis-cli.exe -h localhost -p 6379    //localhost可以换为服务器的IP地址,127.0.0.1

(3)操作

redis localhost:6379> set wil "Niu"
OK
redis localhost:6379> get wil
"Niu"
redis localhost:6379> lpush "Be"
(error) ERR wrong number of arguments for 'lpush' command
redis localhost:6379> lpush friends "be"
(integer) 1
redis localhost:6379> get wil
"Niu"
redis localhost:6379> lrange friends 0 -1
1) "be"
redis localhost:6379> lrange friends 0 -2
(empty list or set)
redis localhost:6379> lrange friends get friends
1) "be"
redis localhost:6379> exists wil

(integer) 1
redis localhost:6379>

……
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值