2013-09-02
use redis with hiredis & pipeline
简单的将hiredis封装成一个c++的类,需要增删查改的数据格式:
1.key: long, value: long set
2.key: long, value: bytes
代码在https://github.com/aoyoo/redis/tree/store_for_gid_pid_pidinfo
数据简单的按key取模的方式分片,并用pipeline接口减少延迟,封装为以下接口:
同时一个简单的python脚本,用于每次dump一份redis的rdb文件作为备份。 代码在https://github.com/aoyoo/redis/tree/master
1.key: long, value: long set
2.key: long, value: bytes
代码在https://github.com/aoyoo/redis/tree/store_for_gid_pid_pidinfo
数据简单的按key取模的方式分片,并用pipeline接口减少延迟,封装为以下接口:
同时一个简单的python脚本,用于每次dump一份redis的rdb文件作为备份。 代码在https://github.com/aoyoo/redis/tree/master
MySQL基本命令
初步学习了一些MySQL的基本命令,以及针对apple的epfimporter而做的binlog日志分析,代码放在了github(https://github.com/aoyoo/mysql)。
创建用户
GRANT ALL PRIVILEGES ON *.* TO 'epfimporter'@'localhost' IDENTIFIED
BY 'epf123' WITH GRANT OPTION;
行数:
select count(*) from epf_application ;
列最大/小值
select max(application_id) from epf_application ;
select min(application_id) from epf_application ;
最大/小 N个值
select application_id from epf_application order by application_id limit
10;
select application_id from epf_application where
application_id<281816692 10="" application_id="" by="" div="" limit="" order="">281816692>
清空表
TRUNCATE TABLE epf_application ;
查看表大小
select TABLE_NAME,DATA_LENGTH,INDEX_LENGTH from
information_schema.TABLES;
订阅:
博文 (Atom)