Time of Update: 2018-07-25
參考 :https://jingyan.baidu.com/article/2c8c281dbd079f0008252a0f.html https://blog.csdn.net/qq_36663951/article/details/78340303 redis緩衝固然高效,可是它會佔用我們系統中寶貴的記憶體資源,特別是當我們的項目運行了一段時間後,我們需要看一下redis佔用了多少記憶體,那麼可以用“info”命令查看。
Time of Update: 2018-07-26
package com.zm.blog.config.shiro;import org.apache.shiro.session.Session;import org.apache.shiro.session.SessionListener;public class MyShiroSessionListener implements SessionListener {//會話建立時觸發 @Overridepublic void onStart(Session session)
Time of Update: 2018-07-26
參考 http://blog.csdn.net/vboy1010/article/details/7892120 http://www.zhangjixuem.com.cn/2014/4/1/01037.html https://github.com/bigplum/lua-resty-mongol 安裝: 下載ngx_openresty-1.7.2.1.tar.gz ./configure --prefix=/data/nginx/openresty/resty --with-luajit
Time of Update: 2018-07-26
Redis的主從架構,能協助我們實現讀多,寫少的情況,下面配置Redis架構,很簡單。 準備環境 vmware + rhel-server-7.0(101,102,103)+redis-3.2.0 1、在192.168.137.101安裝好redis3.2.0,我安裝的目錄如下 redis的安裝參考http://blog.csdn.net/yingxiake/article/details/51469364
Time of Update: 2018-07-26
Redis hash是一個string類型的field和value的映射表.一個key可對應多個field,一個field對應一個value。將一個Object Storage Service為hash類型,較於每個欄位都儲存成string類型更能節省記憶體。建立一個hash對象時開始是用zipmap(又稱為small hash)來儲存的。這個zipmap其實並不是hash
Time of Update: 2018-07-26
遇到的問題 SpringBoot整合Redis,參考一下部落格: http://www.tuicool.com/articles/mAriMbI 存在的問題: 注入RedisTemplate的時候如果按照該部落格的做法,添加泛型 @Autowiredprivate RedisTemplate<String, User> redisTemplate; 則會產生啟動報錯: 2016-10-23 16:32:53.133 ERROR 13404 --- [
Time of Update: 2018-07-26
redis一主多從的spring配置 <bean id="redisSentinelConfiguration" class="org.springframework.data.redis.connection.RedisSentinelConfiguration"> <property name="master"> <bean
Time of Update: 2018-07-26
一般情況下,Redis Client端發出一個請求後,通常會阻塞並等待Redis服務端處理,Redis服務端處理完後請求命令後會將結果通過響應報文返回給Client。這有點類似於HBase的Scan,通常是Client端擷取每一條記錄都是一次RPC調用服務端。在Redis中,有沒有類似HBase Scanner Caching的東西呢,一次請求,返回多條記錄呢。有,這就是Pipline。官方介紹 http://redis.io/topics/pipelining。
Time of Update: 2018-07-26
我今天去用Jedis去串連我的Redis伺服器的時候發現報錯 百度之後讓我去redis裡設定密碼,然後 auth password 1 1 如何進redis伺服器 在redis的bin檔案夾裡,有redis-cli可以進去redis伺服器 如何設定密碼 用vi 進入redis.conf 然後 /requirepassword 1 1
Time of Update: 2018-07-26
註:此文章內容有誤,正確請參考http://blog.csdn.net/hel12he/article/details/46911159 在設定檔redis.conf中,預設的bind 介面是127.0.0.1,也就是本地迴環地址。這樣的話,訪問redis服務只能通過原生用戶端串連,而無法通過遠端連線, 這樣可以避免將redis服務暴露於危險的網路環境中,防止一些不安全的人隨隨便便通過遠程 串連到redis服務。
Time of Update: 2018-07-26
redis主從 1:建立從redis目錄,在原有redis服務中複製如下檔案: a:redis-benchmark b:redis-cli c:redis.conf d:redis-server2:修改redis.conf設定檔 a:修改服務連接埠號碼,保證連接埠號碼唯一 port 6380 b:添加從配置 slaveof 127.0.0.1 63793:啟動服務,查看從redis是否存在主redis的資料(./redis-server
Time of Update: 2018-07-26
1.player_simple_info pid pid|level|profile_url|name ----------------hash 2.player_detail_info: 12345 pid 12345 name kaka guild_id 123 visit_count
Time of Update: 2018-07-25
運用 http://blog.csdn.net/xumaojun/article/details/51558237 中的redis_publisher.h redis_publisher.cpp redis_subscriber.h redis_subscriber.cpp四個檔案,做一個操作類進行測試. 標頭檔 Policy.h #pragma once#include
Time of Update: 2018-07-26
redis支援5種資料類型,分別是String,List,Hash,Set,Zset和Hash。 redis是一個高效能的key-value資料庫,在介紹它的5種資料類型之前,先介紹key的相關命令。 key—鍵 通常用如下的鍵命令來管理redis的鍵: 1 DEL key 該命令用於在key存在時刪除key。 2 DUMP key 序列化給定key,並返回被序列化的值。 3 EXISTS key
Time of Update: 2018-07-26
業務需求中經常有需要用到計數器的情境:譬如一個手機號一天限制發送5條簡訊、一個介面一分鐘限制多少請求、一個介面一天限制調用多少次等等。使用Redis的Incr自增命令可以輕鬆實現以上需求。以一個介面一天限制調用次數為例: /** * 是否拒絕服務 * @return */private boolean denialOfService(String userId){long count=JedisUtil.setIncr(DateUtil.getDate()+"&"
Time of Update: 2018-07-26
連結Redis資料庫 package com.ithiema.jedis;import org.junit.Test;import redis.clients.jedis.Jedis;import redis.clients.jedis.JedisPool;import redis.clients.jedis.JedisPoolConfig;public class JedisTest { //通過java程式訪問redis資料庫 @Test
Time of Update: 2018-07-26
轉自:http://blog.c1gstudio.com/archives/1765 logstash + elasticsearch + Kibana+Redis+Syslog-ng Elasticsearch是一個基於Lucene構建的開源,分布式,RESTful搜尋引擎。設計用於雲端運算中,能夠達到即時搜尋,穩定,可靠,快速,安裝使用方便。支援通過HTTP使用JSON進行資料索引。
Time of Update: 2018-07-26
通過前一篇《redis的簡單使用》的簡單介紹,本篇主要闡述Jedis對redis的五大類型的操作:字串、列表、散列、集合、有序集合。 JedisUtil 這裡的測試案例採用junit4進行運行,準備代碼如下: private static final String ipAddr = "10.10.195.112"; private static final int port = 6379; private static Jedis jedis=
Time of Update: 2018-07-26
Redis叢集設計包括2部分:雜湊Slot和節點主從,本篇博文通過3張圖來搞明白Redis的叢集設計。 節點主從: 主從設計不算什麼新鮮玩意,在資料庫中我們也經常用主從來做讀寫分離,直接上圖: 圖上能看得到的資訊:
Time of Update: 2018-07-27
直接貼上代碼 /** * @param subKey set Key name * @param timeout get lock timeout,if not get, * @param unit time unit * @param sValue * @return */ public static boolean tryLock(String subKey, String sValue,long timeout, TimeUnit unit) { String