| Subcribe via RSS

几个linux集群节点的辅助管理工具

8月 14th, 2008 | 3 Comments | Posted in 新知
集群节点监控: Ganglia

Ganglia is a scalable distributed monitoring system for high-performance computing systems such as clusters and Grids. It is based on a hierarchical design targeted at federations of clusters. Uses multicast and/or unicast to inject xml data into an rrdtool frontend. Makes it very easy to make custom graphs as it was originally written to handle stats data from HPC clusters http://ganglia.sourceforge.net/
SystemImager

节点统一自动安装部署: SystemImager

SystemImager is software which automates Linux installs, software distribution, and production deployment. SystemImager is a part of System Installation Suite. SystemImager makes it easy to do automated installs (clones), software distribution, content or data distribution, configuration changes, and operating system updates to your network of Linux machines. You can even update from one Linux release version to another! It can also be used to ensure safe production deployments. By saving your current production image before updating to your new production image, you have a highly reliable contingency mechanism. If the new production enviroment is found to be flawed, simply roll-back to the last production image with a simple update command! Some typical environments include: Internet server farms, database server farms, high performance clusters, computer labs, and corporate desktop environments. http://systemimager.org

使用subversion集中管理配置文件版本:ubcon

Subcon allows you to store your essential system configuration files in a subversion repository and easily deploy different configurations to machines in a cluster. It also features optional integration with SystemImager, enabling the deployment of system images and configuration in a single step. A flexible configuration file provides the ability to start, stop, or restart services or run arbitrary scripts when a change in a file or set of files is detected. http://code.google.com/p/subcon/

相关文章:
Tags: , ,

tomcat性能监控工具 lambda probe

8月 14th, 2008 | No Comments | Posted in 新知

lambda probe是一个tomcat性能监控工具,它提供了比tomcat管理控制台更加强大的功能,它自身也是一个web应用,直接部署到tomcat下就可以通过web方式来访问了.

lambda probe提供了非常丰富的功能,下面是它的一些特性:

* Comprehensive JVM memory usage monitor.
* JBoss compatibility
* Display of deployed applications, their status, session count, session object count, context object count, datasource usage etc.
* Start, stop, restart, deploy and updeploy of applications
* Ability to view deployed JSP files
* Ability to compile all or selected JSP files at any time.
* Ability to pre-compile JSP files on application deployment.
* Ability to view auto-generated JSP servlets
* Display of list of sessions for a particular application
* Display of session attributes and their values for a particular application. Ability to remove session attributes.
* Ability to view application context attributes and their values.
* Ability to expire selected sessions
* Graphical display of datasource details including maximum number of connections, number of busy connections and configuration details
* Ability to group datasource properties by URL to help visualizing impact on the databases
* Ability to reset data sources in case of applications leaking connection
* Display of system information including System.properties, memory usage bar and OS details
* Display of JK connector status including the list of requests pending execution
* Real-time connector usage charts and statistics.
* Real-time cluster monitoring and clulster traffic charts
* Real time OS memory usage, swap usage and CPU utilisation monitoring
* Ability to show information about log files and download selected files
* Ability to tail log files in real time from a browser.
* Ability to interrupt execution of “hang” requests without server restart
* Ability to restart Tomcat/JVM via Java Serview Wrapper.
* Availability “Quick check”

网址: http://www.lambdaprobe.org/d/index.htm

在线演示: http://demo.lambdaprobe.org/ 用户名密码为demo/demo 。

相关文章:
Tags: , ,

在CentOs中安装Memcached

7月 27th, 2008 | No Comments | Posted in 心得
准备安装:

需要先安装gcc,libevent

yum install gcc wget http://monkey.org/~provos/libevent-1.4.4-stable.tar.gz tar xvzf libevent-1.4.4-stable.tar.gz cd libevent-1.4.4-stable ./configure –prefix=/usr/local/libevent make make install

编译安装:

./configure –prefix=/usr/local/memcached –build=i686-pc-linux-gnu \ –with-libevent=/usr/local/libevent make make install

启动:

$ /usr/local/memcached/bin/memcached -p 11211 -m 64m -d -u root

 

使用memcached -h可以查看所有可用选项:

  • 选项     说明-p     使用的TCP端口。默认为11211

    -m     最大内存大小。默认为64M

    -vv     用very vrebose模式启动,调试信息和错误输出到控制台

    -d     作为daemon在后台启动

  • -u     运行Memcache的用户,默认不能用root启动,所以当前用户为root用户时,需要用-u参数来指定。
  • -l       监听的服务器的ip
  • -c      最大并发连接数,默认为1024
  • -P     指定pid文件
常见问题:

1. 编译memcached时出现下面错误:

./configure checking build system type… Invalid configuration `i686-pc-linux-’: machine `i686-pc-linux‘ not recognized configure: error: /bin/sh ./config.sub i686-pc-linux- failed

解决方法:

在./configure 时加入参数–build=i686-pc-linux-gnu

2.启动时找不到libevent库

memcached: error while loading shared libraries: libevent-1.3c.so.1: cannot open shared object file: No such file or directory 

解决办法:

将libevent库所在路径加入LIBRARY_PATH,在/etc/profile中加入

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/libevent/lib
相关文章:
Tags: , , ,

PostgreSQL性能优化相关资料大全

1月 14th, 2008 | No Comments | Posted in 资料

很久没用postgresql了,有点怀念.

PostgreSQL 8.0 Performance Checklist

Tuning PostgreSQL for performance July 3, 2003,covers 7.3 and 7.4

Annotated POSTGRESQL.CONF Guide for PostgreSQL

PostgreSQL Performance Tuning August 1st, 2001

PostgreSQL Hardware Performance Tuning 2003

PostgreSQL Application Performance Tips 1 2006

PostgreSQL Application Performance Tips 2 2006

Performance Tuning PostgreSQL

Performance tuning for PostgreSQL database (Linux) August 10, 2006

Collection of PostgreSQL Performance Tips 25 Apr 2002

PowerPostgreSQL many docs

PostgreSQL Performance Tuning

postgresql 性能问题邮件列表

相关文章:
Tags: ,

关于javascript和xhtml的资料

11月 18th, 2007 | No Comments | Posted in 资料

超全中文资料 http://w3school.com.cn/

api搜索(英文) http://www.gotapi.com/jsdomw3s

prototype扩展资源大全 http://www.scripteka.com/

IE下的js调试工具

IE下的css调试工具

相关文章:
Tags: , , ,

几个不常用但很有用的javascript方法

11月 12th, 2007 | No Comments | Posted in 心得
1. javascript代码延迟执行。

我们经常可以看到这样的应用,鼠标放到tab上时切换tab内容为当前tab.但是这样就会有个问题,怎么样防止鼠标不经意划过tab时触发这个事件呢?可以通过延迟触发来避免这种情况,但是javascript中没有这样的函数。

javascript提供了一个函数 setTimeout(),可以延迟一个操作的执行,但是这个操作最终还是要执行的。我们需要的是鼠标放在tab上超过0.5s才执行某个操作,否则什么都不发生。

幸好,javascript还提供了另外一个函数,叫做clearTimeout(),于是这个问题就解决了。

 var tabId;
 var timeoutId;
 //鼠标放上时
 function tabOnMouseOver(tabid)
 {
 tabId=tabid;
 //延时500毫秒
 timeoutId=setTimeout(changeTab,500);
 }
 //鼠标移开时清除定时器
 function tabOnMouseOut()
 {
 clearTimeout(timeoutId);
 tabId=0;
 }
2. 设置下拉列表的默认值。

通常的做法是用jsp标签在页面上判断当前默认应该选中哪个value.这样不但繁琐,程序的可读性也很差。这个工作完全交给javascript去做。

// 设置下拉列表的默认值,用于设置表单初始值,表单加载结束时调用
 function setSelectDefaultValue(eleId,value)
 {
 var options=document.getElementById(eleId).options;
 for(i=0;i<options.length;i++)
 {
 if(options[i].value==value)
 {
 options[i].selected =true;
 }
 }
 }

这样,每次页面加载完之后调用这个方法set下拉列表的默认值就可以了。

3. 计算两个日期间隔。

这里要求日期的格式必须为”yyyy-MM-dd”格式。

//检查日期间隔不能大于interval天
 function checkInterval(date1,date2,interval)
 {
 //将天数转为毫秒数
 iseconds = 1000 * 3600 * 24 * interval;
 date1=Date.parse(new Date(date1.replace(/-/g,"/")));
 date2=Date.parse(new Date(date2.replace(/-/g,"/")));
 if(date2-date1)>iseconds)
 {
 alert("查询时间间隔不能超过" + interval + "天") ;
 return false;
 }
 if(date2-date1)<0)
 {
 alert("请设置正确的查询间隔,开始时间不能晚于结束时间");
 return false;
 }
 return true
 }
相关文章:
Tags: , , ,

Groovy WebSite Generator(Groovy 网站生成器)开源啦

11月 11th, 2007 | No Comments | Posted in 心得

用于生成bestunix 的程序发布在google code上,网址为 http://gwg.googlecode.com .

可以通过 svn checkout http://gwg.googlecode.com/svn/trunk/ gwg 取得最新代码。也可以在网站上下载打包好的代码。

经过两次比较大的重构(更新历史),目前gwg的主要功能有:

  1. 使用groovy根据rss生成网站首页,detail页面,分类页面,tag页面;
  2. 使用google ajax api实现了站内搜索功能;
  3. 页面内容中的tag链接替换为本地链接;
  4. 实现了本地rss输出;
  5. 实现了google sitemap;

gwg的价值在哪里:

  1. 可以快速的生成自己的独立网站;
  2. 只有一个配置文件需要修改;
  3. 网页风格可以通过dreamweaver的模板快速更改;
  4. gwg本身也是很好的groovy资料

快速启动:

  1. 首先需要配置好groovy运行环境;
  2. 进入gwg/src 目录,修改Config中的sourcePath和topFolder路径
  3. 在命令行运行 groovy start.groovy

相关文章:
Tags: , ,

sequoia中的日志

11月 10th, 2007 | No Comments | Posted in 方案

Sequoia 提供了基于log4j的日志服务。

它的日志系统允许你选择,比如:

  • 哪个组件要记录日志
  • 要创建哪些日志文件。
  • 不同的日志级别决定日志记录的详细程度
  • 不同的appender决定日志的输出形式。默认地,Sequoia 日志保存在日志文件里,同时提供屏幕输出。你可以选择其他的appender,比如发送日志到一个远程的日志服务器或者email.

你安装完之后,在Sequoia的安装目录会有一个名为log4j.properties 的配置文件。你可以在运行时通过修改这个配置文件来控制日志输出。

日志级别

你可以为每个组件指定具体的日志级别。如果日志级别为OFF ,那么这个Sequoia 组件的日志就被关掉了。

下面是5种可用的日志级别:

  • DEBUG
  • INFO
  • WARN
  • ERROR
  • FATAL .

日志级别决定了记录事件的严重性级别。比如,如果日志级别为ERROR,那么只有ERRORFATAL级别的事件才会被记录。

相关文章:
Tags: , , , , , ,

sequoia中的自动故障处理

11月 10th, 2007 | No Comments | Posted in 方案

Sequoia 提供了完全透明的故障处理。这意味着只要保证至少有一个后端处于enable状态,客户端应用就感觉不到故障的发生。因此,客户端不需要针对集群的异常做任何处理。

下面将更详细地说明不同情况的故障处理:

处理控制器连接失败

如果一个控制器实例连接失败,Sequoia 连接器会根据预定义的规则透明地将客户端连接重新连接到另一个控制器。参考在控制器之间分配客户端连接。

如果是在一个事务内部发生故障,事务的上下文会在重新连接时自动保存。

处理控制器失败

如果一个控制器失败,这个控制器上的后端会被disable掉。现有的客户端连接也会自动的根据预定义的规则重新连接到另外一个控制器上。

正在执行的查询,按下面方法处理:

  • 如果控制器在读写查询执行之前失败,那么这些读写查询会被自动恢复重新执行(甚至在事务内部也可以) 。
  • 如果查询已经执行了但是尚未返回结果,这个时候控制器失败了,那么结果仍然可以得到。

当控制器无法从错误中恢复时,Sequoia 会在log目录自动生成一个名为sequoia.report的trace文件.

处理后端错误

如果后端失败了,它会从负载均衡器上自动去掉。失败操作的处理则取决于查询类型:

  • 如果在读操作时后端失败,这个操作会在另外一个后端上重试。如果重试成功了,第一个后端会被disabled掉。如果在所有的后端上都失败了,那么这个查询可能有问题。.
  • 如果在写操作的过程中后端失败,但是这个写操作在其他后端上执行成功,那么这个失败会被忽略。

这样,所有的失败都可以对客户端透明地处理。

相关文章:
Tags: , , , , , ,

sequoia中添加和同步集群节点

11月 10th, 2007 | No Comments | Posted in 方案

当一个新的后端添加到集群中时,它下面的数据库必须被初始化为跟其他活动节点下的数据库相同的状态。

在Sequoia中,当一个新的节点添加到集群中时,会用recovery log这个节点初始化为跟集群中其他节点相同的状态。这个进程不会影响到集群的其他操作,这使得Sequoia可以不停机的进行故障恢复。

Sequoia 的控制器为每个虚拟数据库保留一份recovery log,这个log记录了所有更新过虚拟数据库的查询和事务。recovery log包含下面内容::

  • 指向数据库dump的元数据,这个dump是某个时间点的数据库状态的快照 (这个数据库快照存放在文件系统中。)
  • 数据库dump创建以后,所有的更新过数据库的查询和数据库的记录。
disable掉的节点自动记录recovery log

当你disable掉一个后端,比如,执行数据库维护,Sequoia 将会:

  1. 自动在recovery log中插入一个checkpoint来记录它下面数据库的状态。
  2. 继续记录来自客户端的请求.

当你重新enable这个后端时,系统将会播放recovery log中从指定checkpoint以后的所有来自客户端的update请求,同步它下面的数据库。

从数据库dump中恢复数据库

如果你在正在使用的集群中添加一个新的后端,或者恢复一个失败的后端,你必须先考虑一下有没有可以用来自动同步数据的数据库快照。因此,数据库并不是简单地只用recovery log就可以同步的。

在这种情况下,你必须先从一个有效的数据库dump中恢复数据库。从有效的dump文件中恢复数据库也为你想用的后端增加了一个干净的checkpoint.

注意:

你应该定期备份你的数据库,以获得一个有效的数据库dump.

数据库备份

使用备份管理器,你可以备份一个数据库来创建一个dump;或者一个表结构和特定数据库的数据作为一个dump。你可以使用这个dump来:

  • 为你准备添加到集群中的后端来恢复数据, 或者
  • 恢复失败的后端.

备份操作的过程是这样的:

  1. 如果后端处于enable状态,那么在备份时它将会被disable掉。它下面的数据库会继续运行。
  2. 在数据库备份过程中,来自客户端的请求将被记录到 recovery log.
  3. 如果一个正在备份的后端被切换到enable状态,它会在备份结束后自动使用recovery log同步数据库,然后enable它自己。
警告

如果只有一个enable的后端可用,你对它执行备份操作会导致它转入disable状态。因此,整个集群在备份期间将停止服务。

你应该定时进行数据库备份以避免需要停止整个集群来备份的情况发生。

相关文章:
Tags: , , , , , ,