一、redis

  redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且这些操作都是原子性的。在此基础上,redis支持各种不同方式的排序。与memcached一样,为了保证效率,数据都是缓存在内存中。区别的是redis会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,所以就算服务器重启,redis的数据也不会丢失,并且在此基础上实现了master-slave(主从)同步。

  Redis 是一个高性能的key-value数据库。 redis的出现,很大程度补偿了memcached这类key/value存储的不足,在部 分场合可以对关系数据库起到很好的补充作用。它提供了Python,Ruby,Erlang,PHP客户端,使用很方便,Redis支持主从同步。数据可以从主服务器向任意数量的从服务器上同步,从服务器可以是关联其他从服务器的主服务器。这使得Redis可执行单层树复制。从盘可以有意无意的对数据进行写操作。由于完全实现了发布/订阅机制,使得从数据库在任何地方同步树时,可订阅一个频道并接收主服务器完整的消息发布记录。

二、redis安装

  centos:

    

$ wget http://download.redis.io/releases/redis-4.0.2.tar.gz
$ tar xzf redis-4.0.2.tar.gz
$ cd redis-4.0.2
$ make $ src/redis-server
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

  

[yiibai@ubuntu:~]$ redis-server
[2988] 07 Feb 17:09:42.485 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[2988] 07 Feb 17:09:42.488 # Unable to set the max number of files limit to 10032 (Operation not permitted), setting the max clients configuration to 3984.
[2988] 07 Feb 17:09:42.490 # Warning: 32 bit instance detected but no memory lim
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.4 (00000000/0) 32 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2988
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-' [2988] 07 Feb 17:09:42.581 # Server started, Redis version 2.8.4
[2988] 07 Feb 17:09:42.582 * The server is now ready to accept connections on po

三、redis配置

  配置文件位置:安装目录下/redis.conf

redis 127.0.0.1:6379> CONFIG GET *
1) "dbfilename"
2) "dump.rdb"
3) "requirepass"
4) ""
5) "masterauth"
6) ""
7) "unixsocket"
8) ""
9) "logfile"
10) "/var/log/redis/redis-server.log"
11) "pidfile"
12) "/var/run/redis/redis-server.pid"
13) "maxmemory"
14) "3221225472"
15) "maxmemory-samples"
16) "3"
17) "timeout"
18) "0"
19) "tcp-keepalive"
20) "0"
21) "auto-aof-rewrite-percentage"
22) "100"
23) "auto-aof-rewrite-min-size"
24) "67108864"
25) "hash-max-ziplist-entries"
26) "512"
27) "hash-max-ziplist-value"
28) "64"
29) "list-max-ziplist-entries"
30) "512"
31) "list-max-ziplist-value"
32) "64"
33) "set-max-intset-entries"
34) "512"
35) "zset-max-ziplist-entries"
36) "128"
37) "zset-max-ziplist-value"
38) "64"
39) "lua-time-limit"
40) "5000"
41) "slowlog-log-slower-than"
42) "10000"
43) "slowlog-max-len"
44) "128"
45) "port"
46) "6379"
47) "databases"
48) "16"
49) "repl-ping-slave-period"
50) "10"
51) "repl-timeout"
52) "60"
53) "repl-backlog-size"
54) "1048576"
55) "repl-backlog-ttl"
56) "3600"
57) "maxclients"
58) "3984"
59) "watchdog-period"
60) "0"
61) "slave-priority"
62) "100"
63) "min-slaves-to-write"
64) "0"
65) "min-slaves-max-lag"
66) "10"
67) "hz"
68) "10"
69) "no-appendfsync-on-rewrite"
70) "no"
71) "slave-serve-stale-data"
72) "yes"
73) "slave-read-only"
74) "yes"
75) "stop-writes-on-bgsave-error"
76) "yes"
77) "daemonize"
78) "yes"
79) "rdbcompression"
80) "yes"
81) "rdbchecksum"
82) "yes"
83) "activerehashing"
84) "yes"
85) "repl-disable-tcp-nodelay"
86) "no"
87) "aof-rewrite-incremental-fsync"
88) "yes"
89) "appendonly"
90) "no"
91) "dir"
92) "/var/lib/redis"
93) "maxmemory-policy"
94) "noeviction"
95) "appendfsync"
96) "everysec"
97) "save"
98) "900 1 300 10 60 10000"
99) "loglevel"
100) "notice"
101) "client-output-buffer-limit"
102) "normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60"
103) "unixsocketperm"
104) "0"
105) "slaveof"
106) ""
107) "notify-keyspace-events"
108) ""
109) "bind"
110) "127.0.0.1"

  

  

  原来是redis默认只能localhost登录,所以需要开启远程登录。解决方法如下:

  在redis的配置文件redis.conf中,找到bind localhost/127.0.0.1注释掉。

    注释掉本机,局域网内的所有计算机都能访问。

    band localhost   只能本机访问,局域网内计算机不能访问。

  保护模式:

    找到protected-mode yes 改为no

  守护进程:

   daemonize no

四:redis启动

  ./redis-server redis.conf 

阿里云配置redis的更多相关文章

  1. 阿里云配置 https 证书

    阿里云配置中心 https://yundun.console.aliyun.com/?p=cas#/cas/home 证书审核通过后复制到 ecs scp /path/filename usernam ...

  2. 阿里云配置HTTPS

    阿里云配置HTTPS 2018-05-29 16:00:56 by SemiconductorKING 最近申请域名配置了一下HTTPS协议,记录一下配置过程. 准备 备案过的域名,一个SSL证书(免 ...

  3. 通过nginx转发,用外网连接阿里云的redis,报Unexpected end of stream的解决办法

    一.在与redis同一个内网的服务器上A的nginx做了下面的设置 stream { upstream redis { server  redis.rds.aliyuncs.com:6379 max_ ...

  4. 阿里云发布 Redis 5.0 缓存服务:全新 Stream 数据类型带来不一样缓存体验

    4月24日,阿里云正式宣布推出全新 Redis 5.0 版本云数据库缓存服务,据悉该服务完全兼容 4.0 及早期版本,继承了其一贯的安全,稳定,高效等特点并带来了全新的 Stream 数据结构及多项优 ...

  5. RHEL/CentOS/Fedora常用的 CentOS 5/6/7 yum 源(EPEL、Remi、RPMForge、RPMFusion, ius,163,sohu,阿里云)配置

    RHEL以及他的衍生发行版如CentOS.Scientific Linux为了稳定,官方的rpm repository提供的rpm包往往是很滞后的,当然了,这样做这是无可厚非的,毕竟这是服务器版本,安 ...

  6. 【阿里云配置端口开放】使用 iptables

    要知道: 1.目前(16年-12-10)阿里云主机只要有服务开启,所有端口是默认开启的.这样很不好,安全做法是,需要开启外网端口时,由开发人员去配置. 2.想要开放端口,就需要使用iptables命令 ...

  7. 阿里云配置mysql navcat远程连接

    默认是不能用客户端远程连接的,阿里云提供的help.docx里面做了设置说明,mysql密码默认存放在/alidata/account.log 首先登录: mysql -u root -h local ...

  8. [转]阿里云配置mysql远程连接

    默认是不能用客户端远程连接的,阿里云提供的help.docx里面做了设置说明,mysql密码默认存放在/alidata/account.log 首先登录: mysql -u root -h local ...

  9. openssl CA 自签证书,阿里云配置tomcat https

    <一,openssl CA自签发证书> 1,生成私钥 openssl genrsa 1024 > private.key;

随机推荐

  1. JavaWeb--------JSP语法基础学习(特别适合入门)

    准备工作: 需要Tomcat8.0,MyEclipse,JDK JSP是一种运行在服务器端的脚本语言,JSP页面又是基于HTML网页的程序,它是Java Web 开发技术的基础. 基本内容: JSP页 ...

  2. github 使用“git commit -m"命令时候出现的一个小问题

    git commit -m 使用问题 今天提交文件到github,步骤是: git add abc.py (abc.py是我当前随意写的一个文件名) git commit -m 'add codes ...

  3. 应用Response.Write实现带有进度条的多文件上传

    前几天,写过一篇随笔“使用RESPONSE.WRITE实现在页面的生命周期中前后台的交互”.说是交互,实际上也主要是在ASP.NET的页面周期中 从后台利用RESPONSE.WRITE向前台即时的推送 ...

  4. POJ 3084 Panic Room(最大流最小割)

    Description You are the lead programmer for the Securitron 9042, the latest and greatest in home sec ...

  5. JS判断是IOS还是Android以及如何解决h5打包后在ios下内容与状态栏重叠问题

    h5打包后在ios下内容与状态栏重叠问题: 1:知道设备的类型: var u = navigator.userAgent, app = navigator.appVersion; var isAndr ...

  6. lintcode-171-乱序字符串

    171-乱序字符串 给出一个字符串数组S,找到其中所有的乱序字符串(Anagram).如果一个字符串是乱序字符串,那么他存在一个字母集合相同,但顺序不同的字符串也在S中. 注意事项 所有的字符串都只包 ...

  7. iOS-创建UIScrollerView(封装UIScrollerView)

    创建继承于UIView的类WJImageScrollView,代码实现如下: WJImageScrollView.h #import <UIKit/UIKit.h> /**点击图片bloc ...

  8. ASP.NET 最全的POST提交数据和接收数据 —— (1) 用url传参方式

    //1.对象提交,字典方式 //接口方:public ActionResult GetArry(Car model) public void PostResponse() { HttpWebReque ...

  9. html .net 网页,网站标题添图标

    <link rel="icon" href="../favicon.ico" type="image/x-icon" /> &l ...

  10. union查询

     select id, uid, money, FROM_UNIXTIME(created) as created, type FROM  (  #type=1是  cjw_finance_bonus ...