Redis在Windows下启动及基本命令

骑猪看日落 2023-09-28 21:38 138阅读 0赞
1.进入redis根目录,输入下面的指令启动服务器:
  1. redis-server.exe redis.windows.conf
  2. C:software ool
  3. edisRedis-x64-3.2.100>redis-server.exe redis.windows.conf
  4. _._
  5. _.-``__ ''-._
  6. _.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit
  7. .-`` .-```. ```/ _.,_ ''-._
  8. ( ' , .-` | `, ) Running in standalone mode
  9. |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
  10. | `-._ `._ / _.-' | PID: 2804
  11. `-._ `-._ `-./ _.-' _.-'
  12. |`-._`-._ `-.__.-' _.-'_.-'|
  13. | `-._`-._ _.-'_.-' | http://redis.io
  14. `-._ `-._`-.__.-'_.-' _.-'
  15. |`-._`-._ `-.__.-' _.-'_.-'|
  16. | `-._`-._ _.-'_.-' |
  17. `-._ `-._`-.__.-'_.-' _.-'
  18. `-._ `-.__.-' _.-'
  19. `-._ _.-'
  20. `-.__.-'
  21. [2804] 13 Sep 11:59:02.735 # Server started, Redis version 3.2.100
  22. [2804] 13 Sep 11:59:02.736 * DB loaded from disk: 0.000 seconds
  23. [2804] 13 Sep 11:59:02.739 * The server is now ready to accept connections on po
  24. rt 6379

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

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

发表评论

表情:
评论列表 (有 0 条评论,138人围观)

还没有评论,来说两句吧...

相关阅读