========   redis   ========

1. redis setup and test : 

    1. download the package from https://redis.io/download

    2. compile source code:
tar xzf redis-3.2.5.tar.gz
cd redis-3.2.5
make 3. start redis server :
[dy83694@retailvm1d redis-3.2.5]$ src/redis-server
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
..
28855:M 05 Dec 00:53:54.485 * The server is now ready to accept connections on port 6379 4. test redis :
[dy83694@retailvm1d redis-3.2.5]$ src/redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379> 5. Data type in redis :
1) String :
redis 127.0.0.1:6379> SET name "yiibai"
OK
redis 127.0.0.1:6379> GET name
"yiibai"
2) HashMap :
redis 127.0.0.1:6379> HMSET user:1 username yiibai password yiibai points 200
OK
redis 127.0.0.1:6379> HGETALL user:1
1) "username"
2) "yiibai"
3) "password"
4) "yiibai"
5) "points"
6) "200"
3) List (1. The max size = 2^32 -1 = 4294967295 ; 2. sort by insert sequence)
redis 127.0.0.1:6379> lpush tutoriallist redis
(integer) 1
redis 127.0.0.1:6379> lpush tutoriallist mongodb
(integer) 2
redis 127.0.0.1:6379> lpush tutoriallist rabitmq
(integer) 3
redis 127.0.0.1:6379> lrange tutoriallist 0 10
1) "rabitmq"
2) "mongodb"
3) "redis"
4) Set (delete and test : o(1))
redis 127.0.0.1:6379> sadd tutoriallist redis
(integer) 1
redis 127.0.0.1:6379> sadd tutoriallist mongodb
(integer) 1
redis 127.0.0.1:6379> sadd tutoriallist rabitmq
(integer) 1
redis 127.0.0.1:6379> sadd tutoriallist rabitmq
(integer) 0
redis 127.0.0.1:6379> smembers tutoriallist
1) "rabitmq"
2) "mongodb"
3) "redis" 6. Redis HyperLogLog : calculate the count of element
redis 127.0.0.1:6379> PFADD tutorials "redis"
redis 127.0.0.1:6379> PFCOUNT tutorials
(integer) 3 7. subscribe and publish message
client 1 : redis 127.0.0.1:6379> SUBSCRIBE redisChat
client 2 : redis 127.0.0.1:6379> PUBLISH redisChat "Redis is a great caching technique" 8. transaction
redis 127.0.0.1:6379> MULTI
OK
List of commands here
redis 127.0.0.1:6379> EXECs 9. Redis script
redis 127.0.0.1:6379> EVAL script numkeys key [key ...] arg [arg ...] 10. Redis Connect between server and client
redis 127.0.0.1:6379> AUTH "password"
OK
redis 127.0.0.1:6379> PING
PONG 11. Redis backup ( dump.rdb in the redis directory )
1) backup
127.0.0.1:6379> CONFIG get dir
1) "dir"
2) "/user/yiibai/redis-2.8.13/src"
127.0.0.1:6379> SAVE
or
127.0.0.1:6379> BGSAVE
Background saving started
2) recovery
copy the dump.rdb into redis directory and restart the redis server 12. redis security
1) client 1 :
127.0.0.1:6379> CONFIG set requirepass "redis"
OK
2) client 2 :
127.0.0.1:6379> CONFIG get requirepass
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth redis
OK
127.0.0.1:6379> CONFIG get requirepass
1) "requirepass"
2) "redis" 13. redis performance test
src/redis-benchmark [option] [option value]
src/redis-benchmark -n 100000 14. Redis connect client
1. maxclients in redis.conf :
127.0.0.1:6379> config get maxclients
2. set maxclients = 100000 once server start
src/redis-server --maxclients 100000 15. Redis pipe 16. Redis Partition 2. Redis jedis test 1. java connection : JedisPool and Jedis
2. create redis slave :
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. ES6之变量常量字符串数值

    ECMAScript 6 是 JavaScript 语言的最新一代标准,当前标准已于 2015 年 6 月正式发布,故又称 ECMAScript 2015. ES6对数据类型进行了一些扩展 在js中使 ...

  2. iOS开发 判断当前APP版本和升级

    从iOS8系统开始,用户可以在设置里面设置在WiFi环境下,自动更新安装的App.此功能大大方便了用户,但是一些用户没有开启此项功能,因此还是需要在程序里面提示用户的 方法一:在服务器接口约定对应的数 ...

  3. 一条Sql语句分组排序并且限制显示的数据条数

    如果我想得到这样一个结果集:分组排序,并且每组限定记录集的数量,用一条SQL语句能办到吗? 比如说,我想找出学生期末考试中,每科的前3名,并按成绩排序,只用一条SQL语句,该怎么写? 表[TScore ...

  4. ORA-00821: Specified value of sga_target 3072M is too small, needs to be at least 12896M

    在测试PlateSpine克隆的数据库服务器时,由于资源有限,克隆过来的数据库服务器只给了9G的内存,结果在测试时,老是会出现OOMkiller导致宕机,即out of memory killer,是 ...

  5. mysql源码包手动安装、配置以及测试(亲测可行)

    笔记编者:小波/qq463431476博客首页:http://www.cnblogs.com/xiaobo-Linux/ 记下这篇mysql笔记,望日后有用! redhat6采用centos yum源 ...

  6. mono for android学习过程系列教程(3)

    服务 接着上一讲的内容,咱们继续来唠叨概念性的东西.服务,内容提供器,广播接收器等理论知识. 首先是服务,它不是一个可视化的组件或者视图.他是由我们开发人员来定义,可以一直一直运行 的工作单元.跟活动 ...

  7. Flappy Bird 源码走读

    参考:https://github.com/kirualex/SprityBird 该项目基于spritekit,代码的结构很清楚,感觉用来学习spritekit非常不错. 1.项目只有一个viewC ...

  8. 跨越语言的障碍:C++/CLI 调用 C#

    首先我想投诉一下博客园首页右边栏的广告..最近总是出现很恐怖的整容脸的广告.真的是吓坏了.=.=大家有同感吗? 博客园前一阵子掀起了语言的广泛讨论,事实上语言的争执在整个程序员圈子也没有停止过.以我个 ...

  9. CSS currentColor 变量的使用

    CSS中存在一个神秘的变量,少有人知自然也不怎么为人所用.它就是crrentColor变量(或者说是CSS关键字,但我觉得称为变量好理解些). 初识 它是何物?具有怎样的功效?它从哪里来?带着这些疑问 ...

  10. ABP框架 - 领域服务

    文档目录 本节内容: 简介 例子 创建一个接口 实现服务 使用应用服务 相关论述 为什么不只用应用服务? 如何强制你使用领域服务? 简介 领域服务(或服务)用来执行领域操作和业务规则.Eric Eva ...