November 18th, 2009 by justlooks
论坛上有人问到了这个问题,做个小小的比较
cmd
perl -ane ‘END{print $sum,”\n”} if($F[3]=~m/now/){$sum+=1;}’
awk ‘{if($4~/now/){sum+=1};}END{print “sum=”sum}’
文件
wc -l file
1683497 file
功能,统计文件中类似update netsun_tradeq.trade_to_Q33 set post_date=now() where asid=3148905的语句数目
time awk ‘{if($4~/now/){sum+=1};}END{print “sum=”sum}’ write_update_finally
sum=781312
real 0m5.222s
user 0m5.092s
sys 0m0.128s
time perl -ane ‘END{print $sum,”\n”} if($F[3]=~m/now/){$sum+=1;}’ write_update_finally
781312
real 0m19.104s
user 0m18.913s
sys 0m0.172s
Tags: awk, perl
Posted in bash, perl | No Comments »
November 18th, 2009 by justlooks
key_cache_division_limit为70的话
key buffer的midpoint insertion策略生效(只要值低于100)
warm sub-chain = 70%
hot sub-chain =30%
Tags: mysql
Posted in mysql | No Comments »
November 17th, 2009 by justlooks
很多时候MYSQL打开文件受到限制,是受系统默认设置数值限制
ulimit -n
1024
编辑/etc/security/limit.conf文件
* hard nofile 65535
* soft nofile 65535
重启系统
ulimit -n
65535
Tags: centos, mysql
Posted in mysql | No Comments »
November 13th, 2009 by justlooks
目前的进度是备份恢复的部分代码还没有完成,其他大致功能已经做完,脚本测试中
项目地址:http://code.google.com/p/backupme/
Tags: backup, mysql, perl
Posted in mysql, perl | No Comments »
November 13th, 2009 by justlooks
linux下解压rar文件需要安装rarforlinux
网上找了一个最新版的rarforlinux结果安装运行找不到 GLIBC2.7看了下centos下安装的GLIBC版本太低(用centos和rhel真是悲剧啊)
最后在www.rpmfind.net上找了个低版本的安装
Tags: linux, rar
Posted in linux command | No Comments »
November 12th, 2009 by justlooks
fvwm窗口不能最大化,修改.fvwm2rc文件
EwmhBaseStruts 0 0 0 20 因為底部有工具條了所以留了20
Tags: fvwm
Posted in fvwm | No Comments »
November 11th, 2009 by justlooks
今天从plante mysql上看到一个有意思的MYSQL监控软件,大致是利用crontab每隔一定时间查询数据库状态数据插入表中,利用MYSQL查询来提供历史信息
项目主页:http://code.openark.org/forge/mycheckpoint
这个项目是用python写的,由于没有接触过python,花了近2小时才部署完毕,下面记录一下安装过程
安装setuptools
运行python ez_setup.py build
wget 上一步的地址取得egg包
再运行一次python ez_setup.py
安装MySQL-python
python setup.py build
出现错误
_mysql.c:36:23: 错误:my_config.h:没有那个文件或目录
_mysql.c:38:19: 错误:mysql.h:没有那个文件或目录
_mysql.c:39:26: 错误:mysqld_error.h:没有那个文件或目录
_mysql.c:40:20: 错误:errmsg.h:没有那个文件或目录
设置include 头文件路径
export C_INCLUDE_PATH=/usr/local/mysql/include/mysql
再运行
python setup.py build
python setup.py install
安装mycheckpoint
python setup.py build && python setup.py install
/usr/lib/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: ‘requires’
warnings.warn(msg)
running install
running build
running build_py
running build_scripts
running install_lib
warning: install_lib: ‘build/lib’ does not exist — no Python modules to install
running install_scripts
changing mode of /usr/bin/mycheckpoint to 755
出现warnings可以忽略不计
首次运行建表
mycheckpoint –database=world –user=root –password=12345 –socket=/tmp/mysql.sock deploy
设置每5分钟记录一次系统状态
*/5 * * * * mycheckpoint –database=world –user=root –password=12345 –socket=/tmp/mysql.sock
done!
Tags: mycheckpoint, mysql
Posted in mysql | No Comments »
November 9th, 2009 by justlooks
確保系統中安裝python
yum install -y python python-devel
解包進入目錄
tar jxvf mercurial.tar.bz2;cd mercurial
python setup.py install –home=/usr/local
編輯~/.bashrc 加入如下內容
export PYTHONPATH=/usr/local/lib/python
輸入hg測試安裝
=========================
克隆遠程代碼庫
hg clone https://backupme.googlecode.com/hg/ backupme
cd backupme
echo “test for mercurial” > test.txt
hg add test.txt
hg commit -m 'my change'
hg push
正在推到 https://backupme.googlecode.com/hg/
正在搜索修改
需要 http 授权
领域: Google Code Mercurial Repository
用户:
密码:
中止: 授权失败
遞交代碼是需要授權的,授權碼在profile的setting選項卡中(讓我好找 - -)
ok 再push下成功
Tags: google, mercurial
Posted in google, perl | No Comments »