Redis在Windows下启动及基本命令

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yaomingyang/article/details/82686705
1.进入redis根目录,输入下面的指令启动服务器:
redis-server.exe redis.windows.conf
C:\software\tool\redis\Redis-x64-3.2.100>redis-server.exe redis.windows.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.2.100 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 2804
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[2804] 13 Sep 11:59:02.735 # Server started, Redis version 3.2.100
[2804] 13 Sep 11:59:02.736 * DB loaded from disk: 0.000 seconds
[2804] 13 Sep 11:59:02.739 * The server is now ready to accept connections on po
rt 6379

根据启动服务器后输出的信息可以看到端口号是6379

2.客户端连接服务器,输入如下命令:
C:\software\tool\redis\Redis-x64-3.2.100>redis-cli.exe -p 6379
127.0.0.1:6379>
3.查找所有符合给定模式的key
127.0.0.1:6379> KEYS *
1) "book-name"
2) "name"
3) "runoob"
4) "runoobkey"
4.获取指定key的值
127.0.0.1:6379> get name
"hello"
5.设置指定key的值
127.0.0.1:6379> set name "hello world"
OK
127.0.0.1:6379> get name
"hello world"

猜你喜欢

转载自blog.csdn.net/yaomingyang/article/details/82686705
今日推荐