Redis之基础知识

Redis是非关系型数据库,即Not-Only SQL。通常应用于缓存、Session共享和历史数据处理等。Redis基于C语言研发,通过键值对存储,可以承载大数据的高负载查询。

  1. 数据库高并发读写,即High Performance RW
  2. 海量数据的高效率查询和存储,即Huge Storage
  3. 高可用性、扩展性和易于集成,即High avaliability、scalability、Integration

Redis的数据类型

序号 Type 类型
1 String 字符串
2 Hash 散列类型
3 List 列表类型
4 Set 集合类型
5 Zset 有序集合类型

Redis启动

.\redis-server.exe .\redis.windows.conf
[27344] 23 Oct 12:16:44.973 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
[27344] 23 Oct 12:16:44.974 # Redis version=5.0.9, bits=64, commit=9414ab9b, modified=0, pid=27344, just started
[27344] 23 Oct 12:16:44.974 # Configuration loaded

Redis停止

 .\redis-cli.exe shutdown
 [20364] 23 Oct 12:45:18.515 # Redis is now ready to exit, bye bye...

客户端连接服务器,输入并显示

 .\redis-cli.exe -h 127.0.0.1 -p 6379
 127.0.0.1:6379> set mykey myvalue
 127.0.0.1:6379> get mykey
"myvalue"

以下把Redis制作成Windows的服务,方便使用

设置Windows的Redis服务

redis-server --service-install redis.windows.conf --loglevel verbose
[31104] 23 Oct 18:03:32.939 # Granting read/write access to 'NT AUTHORITY\NetworkService' on: "D:\Redis-x64-5.0.9" 
[31104] 23 Oct 18:03:32.941 # Redis successfully installed as a service.

Windows服务Services.msc中生成Redis服务
D:\Redis-x64-5.0.9\redis-server.exe" --service-run redis.windows.conf --loglevel verbose

启动windows的Redis服务

 redis-server --service-start
 [32424] 23 Oct 18:12:50.754 # Redis service successfully started.

停止windows的Redis服务

 redis-server --service-stop
 [33536] 23 Oct 18:15:29.446 # Redis service successfully stopped.

卸载windows的Redis服务

 .\redis-server.exe --service-uninstall
 [27124] 23 Oct 18:01:02.657 # Redis service successfully uninstalled.

猜你喜欢

转载自blog.csdn.net/MyFreeIT/article/details/109240070