概述 在實際開發過程中經常會遇到一些有時效性資料,比如限時優惠活動,緩衝或者驗證碼之類的。過了一段時間就需要刪除這些資料。在關係型資料庫中一般都要增加一個欄位記錄資料的到期時間,然後周期性地檢查到期資料然後刪除。Redis本身就對鍵到期提供了很好的支援。 Redis到期機制 在Redis中可以使用EXPIRE命令設定一個鍵的存活時間(ttl: time to live),過了這段時間,該鍵就會自動被刪除,EXPIRE命令的使用方法如下:
HTTP Status 500 - Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool type Exception reportmessage Cannot get Jedis connection; nested exception is
標籤:redis master_link_status:down前幾天,在修改一台從節點的redis的監聽連接埠後,重啟了下redis,發現master_link_status:很長時間一直都是down狀態。查看了redis日誌,發現日誌裡出現很多的“I/O error trying to sync with MASTER:connection lost‘”百度了下,發現是client-output-buffer-limit slave這個參數配置不當造成的。網上找到的相關說明:#
1. 安裝$ wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz$ tar xzf redis-2.6.14.tar.gz$ cd redis-2.6.14$ make $ make install啟動服務:/usr/local/bin/redis-server用戶端命令:/usr/local/bin/redis-cli2. 配置在源檔案 redis-2.6.14/utils 下有一個 redis_init_script