寻觅生命中的那一片浅草......

memcached start error:event_queue_remove

I configure Nginx+MySQL+PHP+Memcached enviroment.I use my script to start memcached,then I type “netstat -tlnp” to see if memcached listens on 11211,I can see 11211,but when I type “netstat -tlnp” again,the 11211 port has disappeared.I type this command manually:

/usr/local/bin/memcached -m 128 -c 4096 -p 11211 -u www -t 10

It runs about three seconds,and then crash.the only message logged is:

[err] event_queue_remove: 0x60cfc0(fd -1) not on queue 1

I search “event_queue_remove” in Google. Some guys guess that there is something wrong with libevent.

I type LD_DEBUG=libs /usr/local/bin/memcached -m 128 -c 4096 -p 11211 -u www -t 10

The output of libevent is :
6283: calling init: /usr/lib64/libevent-1.1a.so.1

this shows that the version of libevent is “libevent-1.1a”,but the one I install from source code is “libevent-1.4.9-stable”.

rpm -qa |grep libevent
the result is :
libevent-devel-1.1a-3.2.1
libevent-1.1a-3.2.1
libevent-devel-1.1a-3.2.1
libevent-1.1a-3.2.1

Oh,my god,there is an old version libevent installed by rpm.I uninstall libevent with “yum -y remove libevent libevent-devel”,reinstall memcached,then memcached start normally.

Reference articles:http://www.serverphorums.com/read.php?9,108005

Use Parted to create partitions

I create a RAID 1 driver with six 2TB disks.The size of this driver is 6.0 TB.Fdisk which I use usually to create partitions doesn’t support this big driver.When I run fdisk -l,the output messages suggest I can use Parted to create partitions on it.

Here are the steps:

#parted /dev/sdb

###type “help” to get tips

(parted) help

(parted) mkpart

Partition name?  []?

File system type?  [ext2]? ext3

Start? 1

End? 5997GB

(parted) quit

#make ext3 file system

#mkfs.ext3 /dev/sdb1

#mount /dev/sdb1 /data

#vi /etc/fstab

#add this line

/dev/sdb1             /data                   ext3    defaults        1 2

#save and quit

用curl检测URL返回状态

#!/bin/bash
#自动检测论坛php是否挂了

while true
do
URL=” http://bbs.example.cn”
RETURN=`curl -o /dev/null -s -w “%{http_code}” “${URL}”`
if [ $RETURN != ‘200’ ];then
/data/sh/fastcgi_restart
fi
sleep 12
done

关于MCV中用C编写module然后加载进PHP中

工具 swig

教程
1, 创建example.c
$cat example.c
int example(char *s) {
printf(“%s”, s);
}
2, 创建.o
cc -c example.c
得到 example.o
3, 创建example.i
$cat example.i
%module example
extern int example(char *s);
4, 创建wrap文件
$swig -php4 example.i
得到 example_wrap.c example.php php_example.h
5, 创建wrap.o
$cc -c example_wrap.c -I/usr/local/include/glib-2.0 -I/usr/local/include/php -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include/php/main -I/usr/local/include/php/regex
得到 example_wrap.o
6, 生成模块文件
$cc -shared -o php_example.so example.o example_wrap.o

得到的php_example.so及我们想要的lib包,可以将它放入到php.ini所指定的extension_dir中去
然后可以加上
extension=php_example.so

7, 测试文件
<?php
$s = “我的选择取决于你”;
example($s);
?>

转载自:http://blog.csdn.net/abaowu/archive/2005/07/20/429862.aspx

我的经历:

cc -shared -o php_example.so example.o example_wrap.o

报错
/usr/bin/ld: example_wrap.o: relocation R_X86_64_32S against `a local symbol’ can not be used when making a shared object; recompile with -fPIC

example_wrap.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
加-fPIC参数后,可以顺利编译通过
cc -c -fPIC example.c
cc -c example_wrap.c -fPIC -I/usr/include/glib-2.0 -I/usr/local/php/include/php -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/main -I/usr/local/php/include/php/regex

Linux 下误删除数据时的拯救大行动记录

原创文章,转载请注明: 转载自听风细雨 – 大型网站运维

本文链接地址: Linux 下误删除数据时的拯救大行动记录

某日,某君,也就是我啦,进入到某台服务器,整理服务器时发现 /data目录下有db_mysql和mysql_data目录,查了mysql_data是不在使用的,所以想把mysql_data下的文件都删除了……
这个时候,估计也许可能脑袋锈抖,居然跑到上一层目录直接rm * -rf,这下糟了,把db_mysql也给删除了,db_mysql是在使用中的库啊!!我哭:&#39;( :&#39;(

哭也没用,这个时候还是想着怎么拯救吧!

拯救过程:
1、数据删除了,但mysql还在运行着,赶紧kill mysql,umount /dev/md0
2、使用网络上到处都是debugfs方式
debugfs /dev/md0

输入lsdel
理论上说这个时候这里可以看到被删除的文件,然后才有下一步的操作,可惜的是,这家伙貌似比较喜欢ext2,在ext3下没有任何东西显示,第一步拯救行动宣告失败

3、使用mc方式
yum install mc

安装完mc服务
直接输入mc
这里窗口最好小一点,不然是乱码
看到一个窗口,分别是一边显示删除文件,一边显示恢复文件(也许是这样,没做研究)
输入:
cd undel:/dev/md0

提示没有找到目录,无法chdir
继续:
cd /dev/md0

一样的结局
直接在窗口上鼠标点击进入,还是失败,第二个方法宣告失败

3、使用第三方软件ext3grep,哭诉,快OK吧,老天,再不行,我……我……被罚定啦

抱着丝丝希望开始了
安装e2fsprogs,据说必须要有e2fsprogs-libs,不然在后面ext3grep的安装会有问题。

下载ext3grep:http://code.google.com/p/ext3grep/downloads/list

目前最新版本是ext3grep-0.8.0.tar.gz

安装:
cd
wget http://ext3grep.googlecode.com/files/ext3grep-0.8.0.tar.gz
tar zxvf ext3grep-0.8.0.tar.gz
cd ext3grep-0.8.0
./configure
make install

安装过程很简单,运行ext3grep 就知道是否安装成功了
恢复开始了
ext3grep /dev/md0 -ls -inode 2

这个是创建扫描的,不是必须的

恢复:
ext3grep /dev/md0 –restore-all
……

如果是恢复某个文件命令是:ext3grep /dev/md0 –restore-file &#39;filepath&#39;

怀着忐忑的心情继续等待……

等扫描到:
Searching group 1088:
Searching group 1089:
Searching group 1090:
Searching group 1091:
Searching group 1092:
Searching group 1093:

有结果了,看截图,能恢复的都恢复了,恢复的文件在运行extgrep当前目录下的RESTORED_FILES目录下
查看一下该目录,除了某个log表的两个文件没有恢复全外,其他全部恢复

找XXX核对了一下这个log表的作用,运气好,得到的答复是这个表早已经没在使用了

把文件拷贝到相应的目录,启动mysql,测试OK

oh,耶!!!终于成功了
感谢天感谢地,感谢党,感谢人民,感谢网龙,感谢技术部,感谢WEB组,感谢冷温和,感谢阮胖子,感谢Carlo Wood

引用别人的一句话:
“我痛哭流涕,我要再次感谢 Carlo Wood 手贱删除了他的 ~/home 目录,由此诞生了如此强大的 ext3grep,也正是因此,我才有了继续打酱油的时间。 ”

其他恢复软件(未test)
http://www.datarecoverylinux.com/screens-linux.html
http://rapidshare.com/files/1166 … covery_Software.rar
http://downloads.nucleusdatarecovery.org/download-ext2-ext3.php
http://www.diskinternals.com/download.shtml
http://www.diskinternals.com/linux-recovery/
http://www.csummers.org/2005/12/ … nux-ext3-partition/
http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html
还有温和说很强大的testdisk

特别感谢拯救行动过程中 冷温和MM 的大力支持

2025年七月
« 5月    
 123456
78910111213
14151617181920
21222324252627
28293031