Archive for linux

squid简单配置

squid是Linux下比较常用的代理服务器软件。其实,他的配置可以说挺简单的,当然也可以配置得挺复杂的。以前,我有写过相关的文章。现在只是将一些东西简化出来。
Read the rest of this entry »

评论

Tokyocabinet/Tokyotyrant文档大合集

1. 前言
2. 参考资料链接
3. 使用介绍
3.1. 基本概念
3.2. Tokyo Cabinet 简介
3.3. 性能介绍
3.4. tokyotyrant和Memcached的优势比较
3.4.1. 故障转移
3.4.2. 日志文件体积小
3.4.3. 超大数据量下表现出色
3.5. 安装
3.5.1. 编译安装tokyocabinet数据库
3.5.2. 编译安装tokyotyrant
3.6. tokyotyrant的配置
3.6.1. 创建tokyotyrant数据文件存放目录
3.6.2. 启动tokyotyrant的主进程(ttserver)
3.6.3. 停止tokyotyrant(ttserver)
3.7. 调用
4. 程序架构
4.1. 流程介绍
4.1.1. 多线程
4.1.2. TokyoTyrant vs. Memcached
4.1.3. 启动流程
4.1.4. 请求处理
4.1.5. 数据结构
5. 数据库存储基础
5.1. tokyocabinet的源代码结构
5.2. tokyotyrant的存储类型
5.3. tokyotyrant的缓存
5.4. 异步
5.5. 索引
5.6. 数据的Hash
5.6.1. 冷存储
5.6.1.1. 一级hash索引:bidx
5.6.1.2. 二级hash索引:hash
5.6.1.3. key值对比
5.6.1.4. 存储时的主要逻辑
5.6.1.5. 数据文件结构
5.6.1.6. 内存映射的一级索引
5.6.1.7. bnum参数
5.6.1.8. 预告
6. 线程和事件
6.1. 工作线程
6.1.1. 什么是工作线程组
6.1.2. 从这里开始
6.1.3. ttservdeqtasks的工作过程
6.1.3.1. **存取请求**
6.1.3.2. 线程处理请求
7. MemcacheDB,Tokyo Tyrant和Redis 性能对比测试
7.1. 测试环境
7.1.1. 软件环境
7.1.2. 配置
7.1.3. 测试客户端
7.2. 小数据量测试结果
7.3. 大数据量测试结果
7.4. Some notes about the test
8. Tokyo Tyrant 的问题和Bug
8.1. Bug report
8.2. tokyotyrant大规模出错的问题
8.3. Bugs
9. 延伸阅读:key-value-pair database的比较
9.1. 满足极高读写性能需求的Kye-Value数据库:Redis,Tokyo Cabinet, Flare
9.1.1. Redis
9.1.2. Tokyo Cabinet和Tokoy Tyrant
9.1.3. Flare
9.2. 满足海量存储需求和访问的面向文档的数据库:MongoDB,CouchDB
9.2.1. MongoDB
9.2.2. CouchDB
9.3. 满足高可扩展性和可用性的面向分布式计算的数据库:Cassandra,Voldemort
9.3.1. Cassandra
9.3.2. Voldemort
Read the rest of this entry »

评论

ubuntu安装thrift以及Eclipse

PHP对中层间那块比较弱,Facebook开放了他们在使用的Thrift比较好地解决这个问题。当然,没有上到一个量级的时候,使用这个东西不见得有什么效果。我主要是简单地记录一下怎样安装Thrift,以及Eclipse的java开发环境。 Read the rest of this entry »

Comments (2)

centos nfs4

http://www-theorie.physik.unizh.ch/~dpotter/howto/kerberos#nfsv4

http://www-theorie.physik.unizh.ch/~dpotter/howto/certificates

这个配置比较简单

http://www.vanemery.com/Linux/NFSv4/NFSv4-no-rpcsec.html

先收集一些资料,实现之后将相关资料汉化

现在国内做Nfsv4的人还是比较少。

评论

centos软件安装

  1. rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
  2. vi /etc/yum.repos.d/utterramblings.repo
  3. [utterramblings]
  4. name=Jason's Utter Ramblings Repo
  5. baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
  6. enabled=1
  7. gpgcheck=1
  8. gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
  9.  
  10. yum install php php-mysql mysql-server php-gd php-mbstring php-pear php-pear-MDB2 php-pear-MDB2-Driver-mysql php-pecl-Fileinfo php-soap postgres ImageMagick ImageMagick-devel cachefilesd
  11.  
  12. chkconfig --level 2345 iptables off
  13. chkconfig --level 2345 ip6tables off
  14.  
  15. pecl install memcache
  16.  
  17. libevent以及memcache默认安装
  18.  
  19. vi /etc/ld.so.conf.d/memcache.conf
  20. /usr/local/lib
  21. ldconfig
  22.  
  23.  memcached -u apache -d -m 64 -l 127.0.0.1 -p 11211
  24.  
  25. 编辑/etc/php.d/memcache.ini
  26. 将Session设置用Memcache保存
  27.  
  28.  
  29. 编辑
  30. /etc/cachefilesd.conf
  31. 缓存目录位置
  32.  
  33. /etc/sysctl.conf
  34. net.ipv4.conf.default.arp_ignore = 1
  35. net.ipv4.conf.default.arp_announce = 2
  36. net.ipv4.conf.all.arp_ignore = 1
  37. net.ipv4.conf.all.arp_announce = 2
  38.  
  39.  
  40. chkconfig --level 2345 httpd on
  41. chkconfig --level 2345 cachefilesd on

Comments (1)

redhat as使用centos源

通过 http://mirror-status.centos.org 网站查找离自己最近的镜像站点,替换下面文件中的相应地址:

1.修改 /etc/yum.repos.d/rhel-debuginfo.repo 为如下内容:

  1. [base]
  2. name=Red Hat Enterprise Linux $releasever -Base
  3. baseurl=http://mirror.be10.com/centos/5.0/os/$basearch/
  4. gpgcheck=1
  5. [update]
  6. name=Red Hat Enterprise Linux $releasever -Updates
  7. baseurl=http://mirror.be10.com/centos/5.0/updates/$basearch/
  8. gpgcheck=1
  9. [extras]
  10. name=Red Hat Enterprise Linux $releasever -Extras
  11. baseurl=http://mirror.be10.com/centos/5.0/extras/$basearch/
  12. gpgcheck=1
  13. [addons]
  14. name=Red Hat Enterprise Linux $releasever -Addons
  15. baseurl=http://mirror.be10.com/centos/5.0/addons/$basearch/
  16. gpgcheck=1

2.下载并导入KEY

cd /etc/pki/rpm-gpg
wget http://mirror.be10.com/centos/RPM-GPG-KEY-CentOS-5
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*

评论

NFS資料

设定最佳的NFSD的COPY数目。

linux中的NFSD的COPY数目是在/etc/rc.d/init.d/nfs这个启动文件中设置的,默认是8个NFSD,对于这个参数的设置一般是要根据可能的CLIENT数目来进行设定的,和WSIZE、RSIZE一样也是要通过测试来找到最近的数值。 Read the rest of this entry »

评论

uschedule 實現每秒執行cron

FreeBSD安裝很簡單,只要進入

/usr/ports/sysutils/uschedule/

make install clean

就完成了相關的安裝

配置

uscheduleconf /etc/schedule-root root root

添加執行的命令行

uschedulecmd -i dosomething ~/bin/dosomething

這樣寫是執行~/bin/dosomething命令,還需要配置運行間隔

uschedule –late 1 dosomething ’*-*-* 08:00:00’

這樣寫是每天八點的時候,每一秒運行一次dosomething ,而dosomething 在上面配置的。

如果需要一直運行的話,只要這樣寫就行了

uschedule –late 1 dosomething ’*-*-* *:*:*’

命令配置好,之後就是啟動相關的進程

uscheduled &

還有停止某進程之類的,麻煩自己看一下幫助,很簡單的。

Comments (1)

Apache+Tomcat虚拟主机配置

评论

以秒运行Crontab

在Liux或BSD下,Crontab可以实现以秒运行程序的。

格式如下:

1 minute 1
1,5 minutes 1 and 5
* any minute
*/5 any minute that is divisible by 5

1:2 second 2 of minute 1
1:2,5:10 second 2 of minute 1 and second 10 of minute 5
*:3 second 3 of any minute
*:*/5 any second that is divisible by 5

只是设置分钟那里跟平时的不大一样,其他部分一样。

Comments (4)