1. ======== redis ========
  2.  
  3. 1. redis setup and test :
  4.  
  5. 1. download the package from https://redis.io/download
  6.  
  7. 2. compile source code:
  8. tar xzf redis-3.2.5.tar.gz
  9. cd redis-3.2.5
  10. make
  11.  
  12. 3. start redis server :
  13. [dy83694@retailvm1d redis-3.2.5]$ src/redis-server
  14. 28855:C 05 Dec 00:53:54.476 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
  15. ..
  16. 28855:M 05 Dec 00:53:54.485 * The server is now ready to accept connections on port 6379
  17.  
  18. 4. test redis :
  19. [dy83694@retailvm1d redis-3.2.5]$ src/redis-cli
  20. 127.0.0.1:6379> set foo bar
  21. OK
  22. 127.0.0.1:6379> get foo
  23. "bar"
  24. 127.0.0.1:6379>
  25.  
  26. 5. Data type in redis :
  27. 1) String :
  28. redis 127.0.0.1:6379> SET name "yiibai"
  29. OK
  30. redis 127.0.0.1:6379> GET name
  31. "yiibai"
  32. 2) HashMap :
  33. redis 127.0.0.1:6379> HMSET user:1 username yiibai password yiibai points 200
  34. OK
  35. redis 127.0.0.1:6379> HGETALL user:1
  36. 1) "username"
  37. 2) "yiibai"
  38. 3) "password"
  39. 4) "yiibai"
  40. 5) "points"
  41. 6) "200"
  42. 3) List (1. The max size = 2^32 -1 = 4294967295 ; 2. sort by insert sequence)
  43. redis 127.0.0.1:6379> lpush tutoriallist redis
  44. (integer) 1
  45. redis 127.0.0.1:6379> lpush tutoriallist mongodb
  46. (integer) 2
  47. redis 127.0.0.1:6379> lpush tutoriallist rabitmq
  48. (integer) 3
  49. redis 127.0.0.1:6379> lrange tutoriallist 0 10
  50. 1) "rabitmq"
  51. 2) "mongodb"
  52. 3) "redis"
  53. 4) Set (delete and test : o(1))
  54. redis 127.0.0.1:6379> sadd tutoriallist redis
  55. (integer) 1
  56. redis 127.0.0.1:6379> sadd tutoriallist mongodb
  57. (integer) 1
  58. redis 127.0.0.1:6379> sadd tutoriallist rabitmq
  59. (integer) 1
  60. redis 127.0.0.1:6379> sadd tutoriallist rabitmq
  61. (integer) 0
  62. redis 127.0.0.1:6379> smembers tutoriallist
  63. 1) "rabitmq"
  64. 2) "mongodb"
  65. 3) "redis"
  66.  
  67. 6. Redis HyperLogLog : calculate the count of element
  68. redis 127.0.0.1:6379> PFADD tutorials "redis"
  69. redis 127.0.0.1:6379> PFCOUNT tutorials
  70. (integer) 3
  71.  
  72. 7. subscribe and publish message
  73. client 1 : redis 127.0.0.1:6379> SUBSCRIBE redisChat
  74. client 2 : redis 127.0.0.1:6379> PUBLISH redisChat "Redis is a great caching technique"
  75.  
  76. 8. transaction
  77. redis 127.0.0.1:6379> MULTI
  78. OK
  79. List of commands here
  80. redis 127.0.0.1:6379> EXECs
  81.  
  82. 9. Redis script
  83. redis 127.0.0.1:6379> EVAL script numkeys key [key ...] arg [arg ...]
  84.  
  85. 10. Redis Connect between server and client
  86. redis 127.0.0.1:6379> AUTH "password"
  87. OK
  88. redis 127.0.0.1:6379> PING
  89. PONG
  90.  
  91. 11. Redis backup ( dump.rdb in the redis directory )
  92. 1) backup
  93. 127.0.0.1:6379> CONFIG get dir
  94. 1) "dir"
  95. 2) "/user/yiibai/redis-2.8.13/src"
  96. 127.0.0.1:6379> SAVE
  97. or
  98. 127.0.0.1:6379> BGSAVE
  99. Background saving started
  100. 2) recovery
  101. copy the dump.rdb into redis directory and restart the redis server
  102.  
  103. 12. redis security
  104. 1) client 1 :
  105. 127.0.0.1:6379> CONFIG set requirepass "redis"
  106. OK
  107. 2) client 2 :
  108. 127.0.0.1:6379> CONFIG get requirepass
  109. (error) NOAUTH Authentication required.
  110. 127.0.0.1:6379> auth redis
  111. OK
  112. 127.0.0.1:6379> CONFIG get requirepass
  113. 1) "requirepass"
  114. 2) "redis"
  115.  
  116. 13. redis performance test
  117. src/redis-benchmark [option] [option value]
  118. src/redis-benchmark -n 100000
  119.  
  120. 14. Redis connect client
  121. 1. maxclients in redis.conf :
  122. 127.0.0.1:6379> config get maxclients
  123. 2. set maxclients = 100000 once server start
  124. src/redis-server --maxclients 100000
  125.  
  126. 15. Redis pipe
  127.  
  128. 16. Redis Partition
  129.  
  130. 2. Redis jedis test
  131.  
  132. 1. java connection : JedisPool and Jedis
  133. 2. create redis slave :
  134. src/redis-server --port 6380 --slaveof 127.0.0.1 6379 --masterauth "redis"

Redis 简单搭建的更多相关文章

  1. 使用maven简单搭建Spring mvc + redis缓存

    注:此文参考并整合了网上的文章 <spring缓存机制>:http://blog.csdn.net/sidongxue2/article/details/30516141 <配置 S ...

  2. Redis Cluster搭建方法简介22211111

    Redis Cluster搭建方法简介 (2013-05-29 17:08:57) 转载▼       Redis Cluster即Redis的分布式版本,将是Redis继支持Lua脚本之后的又一重磅 ...

  3. Redis环境搭建和代码测试及与GIS结合的GEO数据类型预研

    文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.背景 1.1传统MySQL+ Memcached架构遇到的问题 My ...

  4. Redis服务器搭建/配置/及Jedis客户端的使用方法

    摘要 Redis服务器搭建.常用参数含意说明.主从配置.以及使用Jedis客户端来操作Redis Redis服务器搭建 安装 在命令行执行下面的命令: $ wget http://download.r ...

  5. 在linux环境下安装redis并且搭建自己的redis集群

    此文档主要介绍在linux环境下安装redis并且搭建自己的redis集群 搭建环境: ubuntun 16.04 + redis-3.0.6 本文章分为三个部分:redis安装.搭建redis集群 ...

  6. Redis codis 搭建测试

    codis Codis 是一个分布式 Redis 解决方案, 对于上层的应用来说, 连接到 Codis Proxy 和连接原生的 Redis Server 没有明显的区别,有部分命令支持 Codis ...

  7. redis环境搭建及一主二从三哨兵模式配置

    一.单机redis环境搭建 1.安装: OS:linux redhat6.5 下载redis 官网下载链接:https://redis.io/download 把安装包上传到服务器,进行解压 [roo ...

  8. Redis 服务搭建

    1.redis 简介 Redis 是完全开源免费的,遵守 BSD 协议,是一个高性能的 key-value 数据库. Redis 与其他 key - value 缓存产品有以下三个特点: Redis ...

  9. python简单搭建HTTP Web服务器

    对于Python 2,简单搭建Web服务器,只需在i需要搭建Web服务器的目录(如C:/ 或 /home/klchang/)下,输入如下命令: python -m SimpleHTTPServer 8 ...

随机推荐

  1. openresty 前端开发入门四之Redis篇

    这章主要演示怎么通过lua连接redis,并根据用户输入的key从redis获取value,并返回给用户 操作redis主要用到了lua-resty-redis库,代码可以在github上找得到 而且 ...

  2. [转载]网站地址栏小图标favicon.ico的制作方法

    有人也许会好奇,有的网址前面有个漂亮的小图标而且有的网站图标还会动,这是怎么做到的呢? 如下图所示: 那个小图标有个名字叫favicon.ico,网站图标虽小但可以起到很好的点缀作用,尤其是当浏览者将 ...

  3. Android的Kotlin秘方(II):RecyclerView 和 DiffUtil

    作者:Antonio Leiva 时间:Sep 12, 2016 原文链接:http://antonioleiva.com/recyclerview-diffutil-kotlin/ 如你所知,在[支 ...

  4. 在Linux虚拟机下配置jdk的环境变量

    1.到Oracle公司的官网里下载好jdk,网址 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133 ...

  5. Linux模块编程框架

    Linux是单内核系统,可通用计算平台的外围设备是频繁变化的,不可能将所有的(包括将来即将出现的)设备的驱动程序都一次性编译进内核,为了解决这个问题,Linux提出了可加载内核模块(Loadable ...

  6. Disque:Redis之父新开源的分布式内存作业队列

    Disque是Redis之父Salvatore Sanfilippo新开源的一个分布式内存消息代理.它适应于"Redis作为作业队列"的场景,但采用了一种专用.独立.可扩展且具有容 ...

  7. 一步步开发自己的博客 .NET版 剧终篇(6、响应式布局 和 自定义样式)

    前言 这次开发的博客主要功能或特点:    第一:可以兼容各终端,特别是手机端.    第二:到时会用到大量html5,炫啊.    第三:导入博客园的精华文章,并做分类.(不要封我)    第四:做 ...

  8. MyBatis5:MyBatis集成Spring事物管理(上篇)

    前言 有些日子没写博客了,主要原因一个是工作,另一个就是健身,因为我们不仅需要努力工作,也需要有健康的身体嘛. 那有看LZ博客的网友朋友们放心,LZ博客还是会继续保持更新,只是最近两三个月LZ写博客相 ...

  9. MVVM大比拼之AngularJS源码精析

    MVVM大比拼之AngularJS源码精析 简介 AngularJS的学习资源已经非常非常多了,AngularJS基础请直接看官网文档.这里推荐几个深度学习的资料: AngularJS学习笔记 作者: ...

  10. Spring的前期配置

    1创建一个java项目,鼠标单击项目右键新建一个名为lib的文件夹 2在lib文件夹中考入Spring需要的配置文件(俗称jar包) 3 按Shift选中这些jar右键添加至构建路径 4选中src目录 ...