用screen管理远程会话

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

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
错误不再出现。

让perl程序以daemon方式运行

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

use POSIX;

sub daemonize {

        chdir "/";

        open STDIN, "</dev/null";

        open STDOUT, ">/dev/null";

        open STDERR, ">&STDOUT";

        defined(my $pid=fork) or die "Can't fork: $!\n";

        exit if($pid);

        POSIX::setsid() or die "Can't start a new session: $!";

        umask 0;

}

&daemonize;

编译内核的步骤

| 暂无评论 | 暂无引用通告
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

一、主机列表

主机:

10.167.33.11            host1

10.167.33.12            host2

host1 host2GFS节点

host1同时担当gnbd服务器导出/dev/sda3分区(如果有san存储的,gfs节点较少的话就不用gnbd服务器了)

 

二、安装所需的软件包

在两台主机上安装以下软件包:

安装新内核(因为没有旧内核RPM)

rpm -ivh kernel-smp-2.6.9-78.0.1.EL.x86_64.rpm

 

重启服务器使用新的内核.

 

安装gnbd内核模块

 rpm -ivh gnbd-kernel-smp-2.6.9-10.50.el4.centos.1.x86_64.rpm

 

安装gnbd工具包

当根用户试图登陆时,login程序首先查阅/etc/securetty, 看看其中是否列出了当前字符终端设备:

如果没有找到, login会认为它不安全,而提示口令,而后报告Login  incorrect 错误;

如果没有/etc/securetty文件,根用户可以从任何一台字符终端上登陆,从而造成安全问题

/etc/securetty的权限应是600400

cacti的常用模板

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

Handy Repopulate Poller Cache Script

Download and Documentation

http://forums.cacti.net/about10292.html

New Advanced Ping Template Version

Download and Documentation

http://forums.cacti.net/about10049.html

Powerware 9120 UPS via SNMP

Download and Documentation

http://forums.cacti.net/about5427.html


    在/var/log/messages中发现大量错误,内容如下:

Oct 29 09:27:55 tomcat4 kernel: printk: 95 messages suppressed.
Oct 29 09:27:55 tomcat4 kernel: TCP: time wait bucket table overflow

原因:/proc/sys/net/ipv4/tcp_max_tw_buckets的值太小,才2000

解决方法:echo 180000 > /proc/sys/net/ipv4/tcp_max_tw_buckets

tcp_max_tw_buckets 参数类型:整型
    系统在同时所处理的最大timewait sockets 数目。如果超过此数的话﹐time-wait socket 会被立即砍除并且显示警告信息。之所以要设定这个限制﹐纯粹为了抵御那些简单的 DoS 攻击﹐千万不要人为的降低这个限制﹐不过﹐如果网络条件需要比默认值更多﹐则可以提高它(或许还要增加内存)。

最近评论

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