分页: 5/20 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]
某些时候硬盘有问题了会导致硬盘挂起为只读,比如:

[root@local ~]# cd /tmp/
[root@local tmp]# touch c
touch: cannot touch `c': Read-only file system

某些服务会有问题:
[root@local php-cgi]# sbin/php-fpm restart
Shutting down php_fpm warning, no pid file found - php-fpm is not running ?
Starting php_fpm xc_fcntl_create: open(/tmp/.xcache.0.0.1804289383.lock, O_RDWR|O_CREAT, 0666) failed:PHP Fatal error:  XCache: can't create lock in Unknown on line 0
PHP Fatal error:  XCache: failed init opcode cache in Unknown on line 0
done

如果不能重启,那我们可以使用挂载的方式使得某个路径可以使用,比如 /tmp/ 目录。

如果有另外一块可用的硬盘,比如 /Data/ 是挂载的是另外一个磁盘,而且可用,那我们就可以开工了。

创建loop device文件,然后设置为loop设备,格式化并且挂载:

[root@local www.aslibra.com]# dd if=/dev/zero of=/Data/tmp/tmp.img bs=1M count=500
500+0 records in
500+0 records out
[root@local www.aslibra.com]# losetup /dev/loop0 /Data/tmp/tmp.img
[root@local www.aslibra.com]# mkfs.ext3 /dev/loop0
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
//省略其它信息
[root@local www.aslibra.com]# mount -o loop /dev/loop0 /tmp/
[root@local /]# chmod 1777 /tmp


有需要写入/tmp目录的时候就不会出错了。
你可能得到类似信息:

[root@local ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
//省略其它
/dev/loop0            485M   11M  449M   3% /tmp
Tags: , ,
本人也就是查找64bit系统里安装memcached时的问题找到的资料。

引用
LD_DEBUG
The dynamic library loader used in linux (part of glibc) has some neat tricks. One of these is that you can set an environment variable called
LD_DEBUG

to show how symbols (variables and functions, for example) are resolved for a dynamic executable. This can sometimes help resolve obscure bugs where your application isn’t doing what you expect (assuming it is caused by symbols being resolved differently to what you were expecting).

This is very useful if you get segmentation violations or aborts for a program - this can sometimes be caused by linking against the wrong version of a library. This is also a really good way to understand what happens when you run any program! It has some self-documentation - for the impatient, you can do

原文引述一下memcached的问题:

LD_DEBUG 是 glibc 中的 loader 为了方便自身调试而设置的一个环境变量。通过设置这个环境变量,可以方便的看到 loader 的加载过程。 以在 64位 centos 上编译安装 memcached 为例,安装阶段顺利,执行 memcached 命令时出现错误:

#memcached –h
/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-1.4.so.2:
cannot open shared object file: No such file or directory
#find / -name libevent-1.4.so.2
/usr/lib/libevent-1.4.so.2


设置 LD_DEBUG 变量获得更多信息:
Tags: ,
很多时候我们在一个机器上使用的某个命令,到另外一个机器上没有,那想安装在另外一个机器,需要知道它是属于哪个rpm的,比如redhat下有一个setup的命令,可以图形化的管理很多系统设置:

[root@localhost www.aslibra.com]# setup
-bash: setup: command not found
[root@localhost www.aslibra.com]# yum -y install setup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
addons                                                                                                       |  951 B     00:00    
base                                                                                                         | 2.1 kB     00:00    
extras                                                                                                       | 2.1 kB     00:00    
updates                                                                                                      | 1.9 kB     00:00    
Setting up Install Process
Package setup-2.5.58-7.el5.noarch already installed and latest version
Nothing to do

我们在另外一个可以的机器做个查询 rpm -qf 某个命令:
Tags: , ,
今天发现一个简便方式安装:

1.系统centos5.3安装好后,定义非官方库,好安装其它软件.

建立dag.repo,定义非官方库

[root@sample ~]#cat /etc/yum.repos.d/dag.repo 

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

导入非官方库的GPG。

[root@sample ~]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

2 定义国内CentOS的源,忽略。

3 yum -y install cacti

如果你已经有mysql的服务器,可以使用自己的,不用一起安装的

4 设置数据库

create database cacti default character set utf8;
GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON cacti.* TO cacti@localhost IDENTIFIED BY 'passwd';
flush privileges;

5 修改cacti的mysql参数
/var/www/cacti/include/config.php

6 导入默认数据

[root@sample ~]# cd /var/www/cacti
[root@sample cacti]# mysql -u cacti -p cacti < cacti.sql

7 配置web服务器,可以是你现在的环境

8 打开cacti页面,进行初安装

9 最后的最后让系统每5分钟收集,需要设置

[root@sample ~]# crontab -e
*/5 * * * * cacti php /var/www/cacti/poller.php &>/dev/null

参考原文:
http://hi.baidu.com/user_xia/blog/item/0273b362ca80ea690d33fa4e.html
Tags: ,
rhel服务器可以使用yum更新,但需要先卸载原先的yum,并且安装新的yum,然后可以更新。

1 卸载原先的yum

rpm -aq|grep yum|xargs rpm -e --nodeps

如果有卸载不了的,试试 --nodeps
如果是定义的安装包,试试  --allmatches

2 下载新的yum,并且安装

wget http://centos.ustc.edu.cn/centos/5.3/os/i386/CentOS/yum-3.2.19-18.el5.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/5.3/os/i386/CentOS/yum-metadata-parser-1.1.2-2.el5.i386.rpm
wget http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
rpm -ivh yum-*


4 更改yum源

cd /etc/yum.repos.d/
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo


注:别的centos源要把repo文件里的 $releasever 换成版本号,比如换成5

引用
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
变成:
baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/


5 全部更新

yum -y update


参考文章: http://www.linuxtone.org/html/79/t-3979.html
Tags: , , ,
今日科比同学看到我用init 0关机说应该用shutdown,init有个不好的地方,可他也没法说清楚。
也许这几个关机命令没多大区别,查了一下资料,至少init 0是无大碍的:

在linux下一些常用的关机/重启命令有shutdown、halt、reboot、及init

它们都可以达到重启系统的目的,但每个命令的内部工作过程是不同的,通过本文的介绍,希望你可以更加灵活的运用各种关机命令。

1.shutdown

shutdown命令安全地将系统关机。 有些用户会使用直接断掉电源的方式来关闭linux,这是十分危险的。因为linux与windows不同,其后台运行着许多进程,所以强制关机可能会导致进程的数据丢失﹐使系统处于不稳定的状态﹐甚至在有的系统中会损坏硬件设备。
而在系统关机前使用shutdown命令﹐系统管理员会通知所有登录的用户系统将要关闭。并且login指令会被冻结﹐即新的用户不能再登录。直接关机或者延迟一定的时间才关机都是可能的﹐还可能重启。这是由所有进程〔process〕都会收到系统所送达的信号〔signal〕决定的。这让像vi之类的程序有时间储存目前正在编辑的文档﹐而像处理邮件〔mail〕和新闻〔news〕的程序则可以正常地离开等等。
shutdown执行它的工作是送信号〔signal〕给init程序﹐要求它改变runlevel。Runlevel 0被用来停机〔halt〕﹐runlevel 6是用来重新激活〔reboot〕系统﹐而runlevel 1则是被用来让系统进入管理工作可以进行的状态﹔这是预设的﹐假定没有-h也没有-r参数给shutdown。要想了解在停机〔halt〕或者重新开机〔reboot〕过程中做了哪些动作﹐你可以在这个文件/etc/inittab里看到这些runlevels相关的资料。
Tags:
机房之间传文件一般都担心带宽占用太多,特别是在共用带宽的情况下。常用的两个软件都可以限速:

scp可以加上 -l 参数:

引用
     -l limit
             Limits the used bandwidth, specified in Kbit/s.


rsync可以加上 --bwlimit 参数

引用
        -i, --itemize-changes       output a change-summary for all updates
            --log-format=FORMAT     output filenames using the specified format
            --password-file=FILE    read password from FILE
            --list-only             list the files instead of copying them
            --bwlimit=KBPS          limit I/O bandwidth; KBytes per second
            --write-batch=FILE      write a batched update to FILE
            --only-write-batch=FILE like --write-batch but w/o updating dest


Tags: , ,
分页: 5/20 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐