简介: 使用 Sockets API,我们可以开发客户机和服务器应用程序,它们可以在本地网络上进行通信,也可以通过 Internet 在全球范围内进行通信。与其他 API 一样,您可以通过一些方法使用 Sockets API,从而提高 Socket 的性能,或者限制 Socket 的性能。本文探索了 4 种使用 Sockets API 来获取应用程序的最大性能并对 GNU/Linux® 环境进行优化从而达到最好结果的方法。

本日志由 flyinweb 于 2011-08-09 15:35:02 发表到 Linux 中,目前已经被浏览 576 次,评论 0 次;

作者添加了以下标签: Linux socket 性能Socket

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

1.查看系统Swap空间使用

[root@~ usr]# free
total used free shared buffers cached
Mem: 513980 493640 20340 0 143808 271780
-/+ buffers/cache: 78052 435928
Swap: 1052248 21256 1030992

2.在空间合适处创建swap文件

[root@~ usr]# mkdir swap
[root@~ usr]# cd swap
[root@~ swap]# dd if=/dev/zero of=swapfile bs=1024 count=10000
10000+0 records in
10000+0 records out
[root@~ swap]# ls -al
total 10024
drwxr-xr-x 2 root root 4096 7月 28 14:58 .
drwxr-xr-x 19 root root 4096 7月 28 14:57 ..
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
[root@~ swap]# mkswap swapfile
Setting up swapspace version 1, size = 9996 KiB

本日志由 flyinweb 于 2011-06-29 16:49:45 发表到 Linux 中,目前已经被浏览 1276 次,评论 0 次;

作者添加了以下标签: swapmkswapswapon

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

NFSv4, network file system version 4, is the new version of NFS (for setting up the older NFSv3, see Nfs) with new features like strong authentication and integrity via Kerberos and SPKM-3, improved performance, safe file caching, lock migration, UTF-8, ACLs and better support for Windows file sharing semantics.

This article covers installing and configuring NFSv4.

Contents

[hide]

本日志由 flyinweb 于 2011-06-02 18:38:11 发表到 Linux 中,目前已经被浏览 865 次,评论 0 次;

作者添加了以下标签: NFSv4

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

CentOS and RHEL both supports network installation using the NFS, FTP, or HTTP protocols. A network installation can be started from a boot media or a bootable flash memory drive. Alternatively, if the system to be installed contains a network interface card (NIC) with Pre-Execution Environment (PXE) support, Pre-Execution Environment (PXE) can also be used to install CentOS and RHEL.

How PXE works

The client's NIC with PXE support sends out a broadcast request for DHCP information and the DHCP server provides the client with an IP address, name server information, the hostname or IP address of the tftp server and the location of the installation files on the tftp server.

Following are the main steps required to configure PXE Server.

本日志由 flyinweb 于 2011-06-01 09:21:15 发表到 Linux 中,目前已经被浏览 825 次,评论 0 次;

作者添加了以下标签: PXEPXE Server

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

1、启动系统,我是用iso镜像挂载,挂载到/media/cdrom
mkdir /media/cdrom
mount -a -t iso9660 -o loop /home/user1/CentOS-5.6-i386-bin-DVD.iso /media/cdrom
2、安装FTP服务(如果系统已带则在桌面 管理-服务器设置-服务 可以很方便的启动vsftpd服务)
cd /media/cdrom/CentOS
rpm -ivh vsftpd*
chkconfig vsftpd on
service vsftpd start
3、安装createrepo的软件包
cd /media/cdrom/CentOS
rpm -ivh createrepo*
4、拷贝系统盘里的文件到本机
cp -R /media/cdrom/CentOS /var/ftp/pub
cp -R /media/cdrom/repodata /var/ftp/pub
5、生成yum源
(1)生成依赖关系
[root@flyinweb repodata]# createrepo -g /var/ftp/pub/repodata/comps.xml /var/ftp/pub/CentOS/
2682/2682 - nfs-utils-lib-devel-1.0.8-7.6.el5.i386.rpm                         
Saving Primary metadata
Saving file lists metadata
Saving other metadata

本日志由 flyinweb 于 2011-05-31 18:14:27 发表到 Linux 中,目前已经被浏览 1090 次,评论 0 次;

作者添加了以下标签: yum

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

iSCSI是internet Small Computer System Interface的缩写,又称为IP-SAN,是一种基于因特网及SCSI-3协议下的存储技术,由IETF提出,并于2003年2月11日成为正式的标准。

iSCSI的目的是为了用IP协议将存储设备连接在一起。通过在IP网上传送SCSI命令和数据,iSCSI推动了数据在网络之间的传递,同时也促进了数据的远距离管理。由于其出色的数据传输能力,iSCSI协议被认为是促进存储区域网(SAN)市场快速发展的关键因素之一。因为IP网络的广泛应用,iSCSI能够在LAN、WAN甚至Internet上进行数据传送,使得数据的存储不再受地域的现在。iSCSI技术的核心是在TCP/IP网络上传输SCSI协议,即使用TCP/IP报文和iSCSI报文封装SCSI报文,使得SCSI命令和数据可以在普通以太网络上进行传输,如下图所示。

iSCSI的工作过程:当iSCSI主机应用程序发出数据读写请求后,操作系统会生成一个相应的SCSI命令,该SCSI命令在iSCSI initiator层被封装成ISCSI消息包并通过TCP/IP传送到设备侧,设备侧的iSCSI target层会解开iSCSI消息包,得到SCSI命令的内容,然后传送给SCSI设备执行;设备执行SCSI命令后的响应,在经过设备侧iSCSI target层时被封装成ISCSI响应PDU,通过TCP/IP网络传送给主机的ISCSI initiator层,iSCSI initiator会从ISCSI响应PDU里解析出SCSI响应并传送给操作系统,操作系统再响应给应用程序。

iet(iSCSI Enterprise Target)是Linux下的iSCSI Target实现,open-iscsi是Linux下的iscsi initiator实现,使用iet(官方网站:http://iscsitarget.sourceforge.net)和open-iscsi就可以方便的实现简单的IPSAN,同时iet也可以和其他系统的iscsi initiator配合使用。

本日志由 flyinweb 于 2011-05-27 17:29:56 发表到 Linux 中,目前已经被浏览 1494 次,评论 0 次;

作者添加了以下标签: ISCSIIETiscsi-target

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

这几天格式化硬盘,记录一下用到的命令:

[root@db ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 253981.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 2089.0 GB, 2089072092672 bytes
255 heads, 63 sectors/track, 253981 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 124495 1000006056 83 Linux

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (124496-253981, default 124496):
Using default value 124496
Last cylinder or +size or +sizeM or +sizeK (124496-253981, default 253981):
Using default value 253981


Command (m for help): p

Disk /dev/sdb: 2089.0 GB, 2089072092672 bytes
255 heads, 63 sectors/track, 253981 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 124495 1000006056 83 Linux
/dev/sdb2 124496 253981 1040096295 83 Linux


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.

Syncing disks.


此时,分区里看不到新建的磁盘分区,提示通过重启才可以重用分区表,此时可以通过partprobe探测硬盘:

本日志由 flyinweb 于 2011-05-27 16:52:56 发表到 Linux 中,目前已经被浏览 845 次,评论 0 次;

作者添加了以下标签: partprobefdisk

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

背景:6块硬盘,每个1TB,用一块硬盘做raid0,安装系统,剩余5块做raid5。由于ext3文件系统不支持大于2TB的分区,所以考虑使用GPT首先以root身份登录系统,查看硬盘信息:fdisk -l
[root@libftp ~]# fdisk -l

Disk /dev/cciss/c0d0: 1000.1 GB, 1000171331584 bytes
255 heads, 63 sectors/track, 121597 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 33 265041 83 Linux
/dev/cciss/c0d0p2 34 116105 932348340 83 Linux
/dev/cciss/c0d0p3 116106 118655 20482875 83 Linux
/dev/cciss/c0d0p4 118656 121597 23631615 5 Extended
/dev/cciss/c0d0p5 118656 120567 15358108+ 83 Linux
/dev/cciss/c0d0p6 120568 121587 8193118+ 82 Linux swap / Solaris

WARNING: GPT (GUID Partition Table) detected on '/dev/cciss/c0d1'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/cciss/c0d1: 4000.6 GB, 4000684662784 bytes
255 heads, 63 sectors/track, 486388 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d1p1 1 267350 2147483647+ ee EFI GPT

本日志由 flyinweb 于 2011-05-25 15:07:59 发表到 Linux 中,目前已经被浏览 1129 次,评论 0 次;

作者添加了以下标签: GPTparted

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

2484/31