专注业务连续性支持与数据保护
2010-01-26技术合集

linux启动过程已关闭评论

linux启动过程

硬件读取引导扇区

加载LILO或者grub

加载内核

挂装根文件系统

启动/sbin/init ,一切进程的“祖父”

读取/etc/inittab文件

读取rc.sysinit文件

读取/etc/fstab文件

运行rcX.d下的文件(文件都是init.d下的符号链接)

其中有一个xinetd 的超级进程,调用/etc/xinetd.conf 配置文件,从配置文件中知道读/etc/xinetd.d 文件,结束后调用Miggetty

读取/etc/rc.d/rc.local文件

2010-01-26技术合集

Oracle数据库常用基本命令已关闭评论

Oracle数据库常用基本命令

1、得到数据库名和创建日期

SELECT name, created, log_mode, open_mode FROM v$database;

2、ORACLE数据库的计算机的主机名,ORACLE数据库的实例名及ORACLE数据库管理系统的版本信息

SELECT host_name, instance_name, version FROM v$instance;

3、为了知道oracle数据库版本的一些特殊信息

select * from v$version;

4、获取控制文件名字

select * from v$controlfile;

继续阅读 »

2010-01-25技术合集

php读取mac地址已关闭评论

php读取mac地址

1. 
2.
3. class GetMacAddress {
4. var $return_array = array();
5. var $mac_addr;
6.
7. function _construct($os_type) {
8. switch (strtolower($os_type)) {
9. case "linux":
10. $this->forLinux();
11. break;
12. default:
13. $this->forWindows();
14. break;
15. }
16.
17. $temp_array = array();
18. foreach ($this->return_array as $value) {
19. if (preg_match(/[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-]20. .[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f]/i”, $value, $temp_array)) {
21. $this->mac_addr = $temp_array[0];
22. break;
23. }
24. }
25.
26. unset($temp_array);
27. return $this->mac_addr;
28. }
29.
30. function forWindows() {
31. @exec(”ipconfig /all”, $this->return_array);
32.
33. if ($this->return_array) {
34. return $this->return_array;
35. } else {
36. $ipconfig = $_SERVER["SystemRoot"].”\system32\ipconfig.exe”;
37. if (is_file($ipconfig)) {
38. @exec($ipconfig./all”, $this->return_array);
39. } else {
40. @exec($_SERVER["WINDIR"].”\system\ipconfig.exe /all”, $this->return_array);
41. }
42. return $this->return_array;
43. }
44. }
45.
46. function forLinux() {
47. @exec(”ifconfig -a”, $this->return_array);
48. return $this->return_array;
49. }
50. }
51.
52. $mac = new GetMacAddress(null);
53. echo $mac->mac_addr;
54.
55. ?>
2010-01-22技术合集

网站负载测试工具webbench已关闭评论

网站负载测试工具webbench

webbench最多可以模拟3万个并发连接去测试网站的负载能力,个人感觉要比Apache自带的ab压力测试工具好,安装使用也特别方便。
  
1、适用系统:Linux
  
2、编译安装:
  

1
2
3
4
  wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
  tar zxvf webbench-1.5.tar.gz
  cd webbench-1.5
  make && make install

  
3、使用:
继续阅读 »

2010-01-22技术合集

关于MySQL的show status解详已关闭评论

关于MySQL的show status解详

Aborted_clients 由于客户没有正确关闭连接已经死掉,已经放弃的连接数量。
Aborted_connects 尝试已经失败的MySQL服务器的连接的次数。
Connections 试图连接MySQL服务器的次数。
Created_tmp_tables 当执行语句时,已经被创造了的隐含临时表的数量。
Delayed_insert_threads 正在使用的延迟插入处理器线程的数量。
Delayed_writes 用INSERT DELAYED写入的行数。
Delayed_errors 用INSERT DELAYED写入的发生某些错误(可能重复键值)的行数。
Flush_commands 执行FLUSH命令的次数。
Handler_delete 请求从一张表中删除行的次数。
Handler_read_first 请求读入表中第一行的次数。
Handler_read_key 请求数字基于键读行。
继续阅读 »

2010-01-22技术合集

MySQL优化建议已关闭评论

MySQL优化建议

1. key_buffer_size(VARIABLES)是针对Key_reads(STATUS)太大(Key_reads/Key_read_requests比率要尽量小,一般在1/1000以下);table_cache(VARIABLES)是针对Opened_tables(STATUS)太大,Opened_tables太大说明很多打开表的操作(访问一个表时,mysql将先打开这个表)必须在关闭其它表的状态下进行,所以必须增大table_cache的值

2. thread_created(STATUS)值比较大,而max_connections(VARIABLES)为300及max_used_connections(STATUS)不到300,可以考虑将thread_cache_size设为300,目的就是为了使thread_created/Connections比值尽量小!即增加thread的重用性!(手册上讲的很详细)

3. 为使Created_tmp_disk_tables(STATUS)尽量变为0,可以再适当增加tmp_table_size,这是为了尽量使临时表在内存中操作!同时也可以考虑增大max_tmp_tables(VARIABLES)的值!

继续阅读 »

2010-01-21技术合集

windows下自动切换ip小脚本已关闭评论

windows下自动切换ip小脚本

从办公到家庭环境,或者从会议室到办公工位上的IP切换.

1. 切换成自动获取IP

@echo off

netsh interface ip set address name=”local” source=dhcp

netsh interface ip set dns name=”local” source=dhcp

2. 切换成固定IP

@echo off

netsh interface ip set address local static 192.168.0.100 255.255.255.0 192.168.0.1

继续阅读 »