专注业务连续性支持与数据保护
2010-01-25关注学习

Linux NFS Root and PXE-Boot已关闭评论

Linux NFS Root and PXE-Boot

Linux kernel hacking and test running on the same machine becomes a major pain. This tutorial explains how to separate the two easily for a quick code-and-test loop. This tutorial explains how to setup a Linux thin client that boots using PXE by pulling a remote Linux kernel image and mounting a remote root file system over NFS. This is only possible if your client machine has a network card that supports this (do you remember seeing some type of option like press N to boot from network just after posting?). I am using Fedora Core 5 as my server, so some of the details may be specific to FC.

Most of the details of setting up the PXE boot server were found at Setting up a PXE-Boot Server.

1) yum install tftp-server dhcp
Make sure you have an NFS server.

2) create /etc/dhcpd.conf
继续阅读 »

2010-01-25关注学习

PXELINUX已关闭评论

PXELINUX

What is PXELINUX?

PXELINUX is a SYSLINUX derivative, for booting Linux off a network server, using a network ROM conforming to the Intel PXE (Pre-Execution Environment) specification. PXELINUX is not a program that is intended to be flashed or burned into a PROM on the network card; if you want that, check out Etherboot ( http://www.etherboot.org/).

If you want to create PXE-compliant boot PROM for your network card (to use with PXELINUX, for example), check out NetBoot (http://netboot.sourceforge.net/).

How do I Configure PXELINUX?

PXELINUX operates in many ways like SYSLINUX. If you are not familiar with SYSLINUX, read the SYSLINUX FAQ first, since this documentation only explains the differences.

继续阅读 »

2010-01-25关注学习

Setting up a PXE-Boot Server已关闭评论

Setting up a PXE-Boot Server

This documents how to setup a PXE boot server for Linux. This assumes that you’re using Redhat/FC as the PXE boot server. The vast majority of the information has been obtained from the following webpages:

http://dev.brantleyonline.com/wiki/index.php/General_Network_%28PXE%29_Booting
http://dev.brantleyonline.com/wiki/index.php/PXE_Booting_-_Fedora_Core

0) The first thing to note is that you need to setup your own mini-network that is completely disconnected from the network, since part of this process requires setting up a DHCP server which could conflict with the corporate DHCP server if they were both running on the same network simultaneously. So get yourself a switch from IT up front. You do *NOT* need the switch immediately, so just put it aside until I mention it again
later on.

1) The next step is to choose a box to be the PXE boot server. This can really be any box at all, as long as you have a NIC in it that works reliably under Linux. For the purposes of this documentation, I’m going to assume that you’ve loaded Fedora Core 4 on this box (do that now, if you’ve not already). Get this box onto the network with DHCP (just like a normal installation).
继续阅读 »

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)的值!

继续阅读 »