1.排查大KEY/慢查询问题
(1)设置慢查询参数
slowlog-log-slower-than 10000 --设置慢查询的时间阀值,单位微秒
slowlog-max-len 128 --设置慢查询FIFO队列的长度
(2)模拟大KEY
public class RedisExample {
public static void main(String[] args) {
Jedis jedis = new Jedis("localhost", 6379);
for(int index = 0; index < 2; index++){
StringBuilder name = new StringBuilder();
for(int i = 0 ; i < 1000000; i++){
name.append("testtesttesttesttesttesttesttesttesttest");
}
System.out.println("name"+index+" length="+name.length()/1024/1024+"mb");
jedis.set("name"+index, name.toString());
}
// 关闭Jedis对象
jedis.close();
}
}
Connected to the target VM, address: '127.0.0.1:63883', transport: 'socket'
name0 length=38mb
name1 length=38mb
(3)查出慢查询的操作slowlog
127.0.0