reids 数据库学习

最近项目中用到了redis数据库,学习整理下

redis操作学习手册--key操作命令 

  http://www.cnblogs.com/stephen-liu74/archive/2012/03/26/2356951.html

常见JedisConnectionException异常分析  

  http://blog.csdn.net/fachang/article/details/7984123

redis 并发 timed out问题

  http://blog.csdn.net/zhaoyueshun123/article/details/48970547

redis.properties配置文件 

redisServersNum=5               默认数据库编号      
redisHosts=192.168.0.2
redisPort=6379
redisTimeout=10000             超时时间
maxTotal=400            最大链接数
maxIdle=10
minIdle=1
redisPass=password

可适当配置 redisTimeout  解决time out的问题(有时是网络问题,有时是并发量大导致)

public static synchronized JedisPool getPool(Properties props) {
  if (pool == null) {     JedisPoolConfig config = new JedisPoolConfig();
  //设置最大连接数     config.setMaxTotal(Integer.valueOf(props.getProperty("maxTotal")));     config.setMaxIdle(Integer.valueOf(props.getProperty("maxIdle")));     config.setMinIdle(Integer.valueOf(props.getProperty("minIdle")));
//等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException;     config.setMaxWaitMillis(Long.valueOf(props.getProperty("redisTimeout")));
 //超时时间     Integer timeout = Integer.valueOf(props.getProperty("redisTimeout"));     pool = new JedisPool(config, props.getProperty("redisHosts"),       Integer.valueOf(props.getProperty("redisPort")), timeout, props.getProperty("redisPass")); }   return pool; }

  

redis数据库的备份与恢复

  http://blog.csdn.net/wzzfeitian/article/details/42081969 

redis备份的方式默认是RDB方式,数据库挂了,重启会自动从备份文件dump.rdb恢复

 

other

 天猫旗下电商平台已全站HTTPS导致DPI流量统计大幅度减少的情况 

  http://bbs.c114.net/thread-935007-1-1.html

 

posted @ 2017-04-01 11:22  Nucky_yang  阅读(207)  评论(0编辑  收藏  举报