系统管理 分类中的最新日记

开机时跳过键盘检查

| 暂无评论 | 暂无引用通告

    有两台PC,安装了Linux系统,通过ssh进行控制,没连显示器和键盘,每次重启,系统自检,检查键盘的时就会停止,提示按F1继续。解决方法:

      自检时按DEL进入CMOS,进入Standard CMOS Features后选Halt On,然后选择"All,But Keyboard",缺省的是"All Errors",以下是几个选项:

No Errors

不管任何错误,均开机

All Errors

有任何错误均暂停,等候处理

All,But Keyboard

有任何错误均暂停,等候处理,除了键盘以外

All,But Diskette

有任何错误均暂停,等候处理,除了软驱以外

All,But Disk/Key

有任何错误均暂停,等候处理,除了软驱和键盘以外

jdk快速安装脚本

| 暂无评论 | 暂无引用通告

如果你有多台服务器需要安装JDK,不妨使用以下的脚本,在安装前定制一下脚本中的变量:JKD_ARCHIVE(jdk压缩包文件名) JDK_VERSION(解压后的目录名) INSTALL_DIR(目标目录)

 

#!/bin/sh

#auther:supersun

#email:supersun06@gmail.com

#homepage:http://supersun.biz

 

JKD_ARCHIVE="jdk1.5.tgz"

JDK_VERSION="jdk1.5.0_017"

INSTALL_DIR="/usr/local/"

 

HOSTLISTS="$*"

 

for HOST in $HOSTLISTS

do

 

ssh $HOST " if [ -d ${INSTALL_DIR}${JDK_VERSION} ]

then

 echo $JDK_VERSION has been installed

else

 echo  $JDK_VERSION hasnot been installed

 cd $INSTALL_DIR

 tar zxf -

 test -L java && rm java

 ln -s $JDK_VERSION java

 cat >/etc/profile.d/java.sh <<'EOF'

#!/bin/sh

JAVA_HOME=/usr/local/java

PATH=\$JAVA_HOME/bin:\$PATH

 

export JAVA_HOME PATH

EOF

 

fi" <$JKD_ARCHIVE

done

 

用法如下

[supersun@supersun.biz java]$ sudo sh ins_jdk.sh host1

Password:

jdk1.5.0_017 hasnot been installed

[supersun@supersun.biz java java]$ s ssh mss1

Last login: Thu Dec 11 15:47:12 2008 from supersun.biz

[root@host1 ~]# which java

/usr/local/java/bin/java

 

    inotify是Linux内核的新功能,用于监控文件系统的事件,此功能对于海量小文件的备份很有帮助。

    我手头管理着一组服务器,每台服务器上存放大量小文件,一天之中,更新的文件数量达到30万左右(这个数据是从rsync的日志中得到的,每天我们会运行一组rsync脚本,用于备份数据。完成同步需要6个小时左右,每天的同一文件的多次变动还未计算在内),为了将在发生意外时,数据的损失减少到尽可能的小,我们通过linux的inotify功能,监控数据文件的目录,对创建,更改操作进行监控,并将文件的路径记入到日志文件中,每一分钟备份一次更新的文件。

整个脚本的部署分为以下几个步骤:

1、升级Linux内核,使其支持inotify功能

2、安装脚本所需的Perl模块。

3、生成监控数据,运行脚本

4、定制并运行日志外理命令。

5、管理inotify脚本。


apache的基本认证的密码是通过命令htpasswd来生成的,方法如下:

[supersun@supersun.biz conf]$../bin/htpasswd -bc password supersun hello

[supersun@supersun.biz conf]$cat password

supersun:Pajgyd5fZISUs

有时手头没有htpasswd这个命令,或者给别人建个账号而不想知道别人的密码,这时我们只需要将别人发过来的密码加密串添到加password文件中就行。这里有一个perl的加密脚本crypt.pl,内容如下:

#!/usr/bin/perl

use strict;

my $passWord=$ARGV[0];

print crypt($passWord,$passWord)."\n";

运行perl crypt.pl hello

[supersun@supersun.biz ~]$ perl crypt.pl hello

heFw0NKyvGSTg

然后将加密串和账号添加到password中。

httpd.conf中的配置为如下格式

<Location />

        AuthType Basic

        AuthName "hello"

        AuthUserFile /home/apache/conf/password

        Require valid-user

</Location>

原文见http://bash.cyberciti.biz/web-server/htpasswd-replacement-perl-script/

 

tomcat http connector 参数

| 暂无评论 | 暂无引用通告
  • acceptCount - defines the maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full are refused. The default value is 10.

  • bufferSize - defines the size (in bytes) of the buffer to be provided for input streams created by this connector. By default, buffers of 2048 bytes are provided.

  • maxKeepAliveRequests - the maximum number of HTTP requests that can be held in the pipeline until the connection is closed by the server. Setting this attribute to 1 disables HTTP/1.0 keep-alive, as well as HTTP/1.1 keep-alive and pipelining. Setting this to -1 allows an unlimited number of pipelined or keep-alive HTTP requests. If not specified, this attribute is set to 100.

  • maxSpareThreads - the maximum number of unused request processing threads that are allowed to exist until the thread pool starts stopping the unnecessary threads. The default value is 50.

  • maxThreads - the maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200.

  • minSpareThreads - the number of request processing threads that are created when this Connector is first started. The connector will also make sure it has the specified number of idle processing threads available. This attribute should be set to a value smaller than that set for maxThreads. The default value is 4.

用screen管理远程会话

| 评论(1) | 暂无引用通告

screen是一个用于管理远程会话的程序,在很多时候会遇到这种情况,我们通过ssh登陆到某台服务器并同时启用多个需要占用当前终端的会话,这时候就要开多个ssh连接,多个窗口切来切去很是不便。然而我们使用screen的话就不必这个麻烦了,我们只要通过命令crtl+a c就可以开一个新的虚拟终端,crtl+a a切到最近使用的终端,ctrl+a [0-9]切到对应的终端上去。

screen还有一个很酷的功能就是在你离开的时候仍可保留会话的状况,当你重新登陆时恢复原会话。

以下是常用的命令

 

启用screen

[supersun@supersun.biz ~]$ screen

恢复会话

screen -R


用lvs搭建squid集群过程中,需要检测realserver的squid服务存活,如果使用ldirectord检测http服务的方式,将不能从squid中获取检测页面,应为检测http服务时访问检测页的地址是http://realserver_ip/test.html而不是http://realserver_domain/test.html,在使用squid的时候,访问地址中必须是域名。这样,我们需要手动定制一个脚本来检测squid是否存活。

 

先看一下ldirectord的检测类型:

checktype = connect|external|negotiate|off|on|ping|checktimeout

Connect测试能否建立一个tcp/ip连接

external使用外部脚本检测

Ping使用icmp检测

negotiate发送一个请求,批配接收到的字串

其他的几个自己看手册吧man ldirectord


从防火墙转发内网FTP服务

| 暂无评论 | 暂无引用通告
加载ftp模块:
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
外网口:
eth0 213.88.181.68
内网口:
ech1 192.168.150.3
FTP服务器:
192.168.150.10
HTTP服务器:
192.168.150.10

通过地址:
213.88.181.68即可访问192.168.150.10的FTP服务和HTTP服务

warning, got duplicate tcp line.

| 暂无评论 | 暂无引用通告
运行netstat,出现warning, got duplicate tcp line,
[root@supersun.biz ~]# netstat -at |grep 'ESTABLI' |wc -l
warning, got duplicate tcp line.
warning, got duplicate tcp line.
解决方法,升级net-tools的版本:
http://mirror.centos.org/centos/4/os/x86_64/CentOS/RPMS/net-tools-1.60-39.el4.x86_64.rpm

[root@supersun.biz ~]# rpm -Uvh net-tools-1.60-39.el4.x86_64.rpm
warning: net-tools-1.60-39.el4.x86_64.rpm: V3 DSA signature: NOKEY, key ID 443e1821
Preparing...                ########################################### [100%]
   1:net-tools              ########################################### [100%]

[root@supersun.biz ~]# netstat -at |grep 'ESTABLI' |wc -l
32
错误不再出现。

编译内核的步骤

| 暂无评论 | 暂无引用通告
KERNEL_DIR=$(pwd)
make mrproper
make menuconfig
make dep
make clean
make bzImage
cp arch/x86_64/boot/bzImage /boot/vmlinuz-2.6.26
make modules
make modules_install
cd /boot
mkinitrd initrd-2.6.26 2.6.26
cd $KERNEL_DIR
cp System.map /boot/System.map-2.6.26
cd /boot
ln -s System.map-2.6.26 System.map

关于此归档

这里是分类系统管理中的最新日记。

上一个分类数据库知识

首页归档页可以看到最新的日记和所有日记。