Friday, December 16, 2011

NFS quick howto for centos 5

NFS quick howto for centos 5


To use nfs successfully, you have to configure the server and the client. In this example, the client is 192.168.0.3 and the server is 192.168.0.1. The folder to be shared is /home/sharing, and to be mounted to /mnt on the client

On the server

  1. Make directory that you want to use.


    • # mkdir /home/sharing


  2. Edit /etc/exports, insert the client machine's ip


    • # vi /etc/exports


      • Add this line:




        • /home/sharing 192.168.0.3/255.255.255.255(rw,sync)


      • Save



  3. Edit /etc/hosts.allow


    • # vi /etc/hosts.allow


      • Add this line:


        • portmap: 192.168.0.0/255.255.255.0


      • Save



  4. Start nfs and portmap


    • # /etc/init.d /nfs start

    • # /etc/init.d/portmap start



On the client


  1. Start portmap


    • # /etc/init.d/portmap start


  2. Mount the nfs folder


    • # mount 192.168.0.1:/home/sharing /mnt


  3. Check /var/log/messages for any error that might occur


    • # tailf /var/log/messages


  4. Use mount to check if the folder is mounted properly


    • # mount 


      • This should be the output:


        • 192.168.0.1:/home/sharing on /mnt type nfs (rw,addr=192.168.0.1)




  5. Edit /etc/fstab to mount the shared folder on boot


    • # vi /etc/fstab


      • Add this line


        • 192.168.0.1:/mnt/sdb1/backup /mnt nfs rw,hard,intr 0 0


      • Save




You can use 'man exports' to see the options available for /etc/exports

Wednesday, October 26, 2011

Squid 2.7 通过域名反向代理多个服务器配置

[cc lang='apache' line_numbers='false']visible_hostname squid1.abc.com

#设定squid的主机名,如无此项squid将无法启动

http_port 80 accel vhost vport

#设定squid为accel加速模式,vhost必须要加.否则将无法将主机头转发至后端服务器,访问时就会出现无法找到主机头的错误

cache_peer 192.168.1.88 parent 80 0 no-query originserver name=contentchina

cache_peer 192.168.1.88 parent 80 0 no-query originserver name=bbs

cache_peer 192.168.1.1 parent 80 0 no-query originserver name=ihompy

#定义不同的父节点,将节点设为no-query以及originserver说明这些节点是实际服务器

cache_peer_domain contentchina aaa.abc.com

cache_peer_domain bbs bbb.abc.com

cache_peer_domain ihompy ccc.abc.com

#设定不同域名转发到不同的cache_peer上,如果没有这项.不同域名的域名可能被分发到同一台服务器上.

acl all src 0.0.0.0/0.0.0.0

no_cache deny all

http_access allow all

#允许所有客户端访问

cache_log /var/log/squid/cache.log

#记录日志

#***********ACL存取控制*************

#acl QueryString url_regex .php?

#***********缓冲存取控制*************

#no_cache deny QueryString

#不对符合QueryString的ACL内容进行缓冲

#***********性能优化配置*************

maximum_object_size 320010 KB

#大于此容量的对象将不会被保存在磁盘上,默认大小是4M,如果squid服务器用于缓冲flash等大型文件,建议将此值变大.否则过大的文件在下次重启后将需要重新获取

maximum_object_size_in_memory 100 KB

#最大位于内存中的对象的大小,默认大小是8K,如果服务器内存很大.可以适当提高此值的大小,建议根据网站的80%图片的大小来定.或者根据WEB服务器实际存取文件中最常访问的文件大小来定制

#***********其他可选配置*************

#dns_nameservers 10.0.0.1 192.172.0.4

#配置DNS服务器地址.获取后端时将从此dns获取IP地址

#cache_mgr ggg_g@tom.com

#在错误日志中出现的webmaster地址.

[/cc]

Thursday, September 29, 2011

rsync 增量备份

[cc lang="text"]rsync --force --ignore-errors --delete --delete-excluded --exclude "logs/" --exclude "umslog/" 192.168.254.221::www-back /Datas/Backup/Rsync-YuKuai/app-daily --log-file=/Datas/Backup/Rsync-YuKuai/logs/`date +%Y-%m-%d`.log -azv -backup --backup-dir=/Datas/Backup/Rsync-YuKuai/app-daily-arch/`date +%Y-%m-%d`[/cc]

Monday, September 19, 2011

thinkpad只插电源适配器会锁频

在Gentoo上捣鼓 cpufreq-info 时发现只插电源适配器会锁频,可能是电源适配器只有65W 的原因。

Monday, September 12, 2011

Cloud computing software

Cloud computing related open source softwares. IAAS: OpenNebula , OpenStack , Eucalyptus, CloudForms, CloudStack/Cloud.com(part of cloudstack), ibvirt, AbiCloud, Nimbus, OpenNebula, OpenQRM, ConVirt, OpenVZ ; PAAS:Makara/OpenShift, Cloud Foundry,Aeolus(iPaaS) , AppScale, CloudStack.