redis的学习之路 redis基础

最近在搞Redis,在这里记录分享一下redis的学习之路,也方便日后查阅!

Windows 下载安装

下载地址:Releases · tporadowski/redis · GitHub

下载文件,并解压到D盘文件夹下 

打开cmd 到redis文件目录下 

D:\>cd Redis-x64-5.0.14

执行redis

redis-server.exe redis.windows.conf

具体操作流程: 

D:\>cd Redis-x64-5.0.14

D:\Redis-x64-5.0.14>redis-server.exe redis.windows.conf
[94212] 14 Dec 16:14:46.475 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
[94212] 14 Dec 16:14:46.475 # Redis version=5.0.14, bits=64, commit=a7c01ef4, modified=0, pid=94212, just started
[94212] 14 Dec 16:14:46.475 # Configuration loaded
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 5.0.14 (a7c01ef4/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 94212
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[94212] 14 Dec 16:14:46.479 # Server initialized
[94212] 14 Dec 16:14:46.481 * Ready to accept connections

此窗口保持打开状态,再打开一个cmd窗口

同样是先找到redis文件所在路径

只执行redis程序

redis-cli.exe

依次输入:

D:\>cd Redis-x64-5.0.14

D:\Redis-x64-5.0.14>redis-cli.exe
127.0.0.1:6379>

最终输出:127.0.0.1:6379> 说名redis已经执行成功

启动报错:

报错信息:oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

D:\>cd Redis-x64-5.0.14

D:\Redis-x64-5.0.14>redis-server.exe redis.windows.conf
[89004] 14 Dec 19:01:06.139 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
[89004] 14 Dec 19:01:06.139 # Redis version=5.0.14, bits=64, commit=a7c01ef4, modified=0, pid=89004, just started
[89004] 14 Dec 19:01:06.139 # Configuration loaded
[89004] 14 Dec 19:01:06.143 # Could not create server TCP listening socket 127.0.0.1:6379: bind: 操作成功完成。

上述报错是由于 端口号被占用,解决办法如下:

由于我redis 用的是默认端口号 6397(IP:端口号  127.0.0.1:6379)

cmd下输入 netstat -ano |findstr 6379  查找端口号为6379的进程

D:\Redis-x64-5.0.14>netstat -ano |findstr 6379
  TCP    127.0.0.1:6379         0.0.0.0:0              LISTENING       98884

 查找到端口号为6379的进程号为98884

D:\Redis-x64-5.0.14>taskkill /T /F /PID 98884
成功: 已终止 PID 98884 (属于 PID 87484 子进程)的进程。

第一个redis程序

1.设置redis的key为ws 值为hello

2.获取redis中key为ws的值

127.0.0.1:6379> set ws hello
OK
127.0.0.1:6379> get ws
"hello"
127.0.0.1:6379>

 查看当前redis连接是否正常 输入ping命令 返回PONG

127.0.0.1:6379> ping
PONG

客户端关闭redis命令

shutdown
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> shutdown
not connected> ping
Could not connect to Redis at 127.0.0.1:6379: 由于目标计算机积极拒绝,无法连接。
(2.04s)
not connected>

今天简单写一些,后面将持续更新

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值