redis常用技巧

批量删除key cat /tmp/keys.txst | xargs -I{} -P 3 -t -n 10 ./redis-cli -p 6379 -n 0 del {} 查询QPS watch

Java监控方法调用树以及方法性能

JETM 下载 Download 使用 @Test public void hello() throws InterruptedException { BasicEtmConfigurator.configure(true); etmMonitor.start(); EtmPoint etmPoint = etmMonitor.createPoint("SETest:hello"); System.out.println("hello world"); Thread.currentThread().sleep(2 * 1000); nested(); nested(); sayf(); etmPoint.collect(); // visualize

Redis集群之twemproxy

安装 git clone https://github.com/twitter/twemproxy.git cd twemproxy autoreconf -fvi ./configure --enable-debug=full --prefix=/ihome/db/redis/twemproxy make -j8 make install 安装完毕的结构: ╭─sky@

ZooKeeper之发布-订阅例子

pubisher public static void main(String[] args) throws Exception { RetryPolicy retryPolicy = new RetryNTimes(3, 2 * 1000); CuratorFramework cf = CuratorFrameworkFactory.newClient("127.0.0.1:2181", retryPolicy); cf.start(); Stat stat = cf.checkExists().forPath("/topic"); if (stat ==

MySQL备份实践

binlog 查看是否开启了binlog mysql> show variables like 'log_bin'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_bin | OFF

基于Redis分布式锁Redisson使用例子

@Test public void testDistributeLock() throws InterruptedException { final CountDownLatch cdl = new CountDownLatch(10); long time = System.currentTimeMillis(); RedissonClient redisson = Redisson.create(); final RLock rLock = redisson.getLock("hello-lock"); final Map<String, Integer> map

MySQL 为生产环境在线添加字段

create table new_table_name like old_table_name; alter table new_table_name add column new_column int not null default 0 comment 'your comment'; insert into new_table_name (col1, col2, col3...) select (col1, col2, col3...) from