陈沙克

Jul 152012
 

本地的源,可以为你节省大量的时间,尤其在我们这种网络不是太好的环境下。现在很多朋友遇到的无法找到某个包,这种问题基本都是网络造成的。

对于服务器来说,其实只需要64bit就可以,不过你会发现,如果你运行 apt-get update 的话,默认源的设置,还是需要下载i386.

所以未来避免那种错误的提示,你需要把ubuntu 12.04源里所有的东西都下载回来。包括64bit,32bit,源码包。

这个脚本运行环境,需要debmirror. 这是老外写的脚本,我改了一下,加上一个参数:–ignore-release-gpg

http://ubuntuforums.org/showpost.php?p=7367273&postcount=237

http://www.gtkdb.de/index_7_1670.html

###########################################################################
##                                                                       ##
##                         Ubuntu Mirror Script                          ##
##                                                                       ##
## Creation:    06.07.2008                                               ##
## Last Update: 02.06.2012                                               ##
##                                                                       ##
## Copyright (c) 2008-2012 by Georg Kainzbauer <georgkainzbauer@gmx.net> ##
##                                                                       ##
## This program is free software; you can redistribute it and/or modify  ##
## it under the terms of the GNU General Public License as published by  ##
## the Free Software Foundation; either version 2 of the License, or     ##
## (at your option) any later version.                                   ##
##                                                                       ##
###########################################################################
#!/bin/sh

# Ubuntu mirror server and mirror directory
#SOURCE_SRV=cn.archive.ubuntu.com
#SOURCE_SRV=archive.ubuntu.com
SOURCE_SRV=mirrors.163.com
SOURCE_DIR=/ubuntu

# Distribution, section and architecture list
DIST=precise,precise-security,precise-updates,precise-backports,precise-proposed
SECTION=main,main/debian-installer,restricted,restricted/debian-installer,universe,universe/debian-installer,multiverse,multiverse/debian-installer
ARCH=i386,amd64

# Local mirror directory
#MIRRORDIR=/var/ftp/pub/linux/ubuntu/
MIRRORDIR=/home/ubuntu/

# Log file
LOGFILE=/var/log/ubuntu_mirror.log

# Debug file (if you do not want to debug the download process set this option to "/dev/null")
DEBUGFILE=/var/log/ubuntu_mirror.debug

# Who will be informed in case if anything goes wrong (if you do not want to be informed via mail, set this option to "")
#MAILNOTIFY="root@localhost"

# Lock file
LOCK=/var/tmp/ubuntu_mirror.lock

##################################################################
# NORMALY THERE IS NO NEED TO CHANGE ANYTHING BELOW THIS COMMENT #
##################################################################

function log()
  {
    echo `date +%d.%m.%Y%t%H:%M:%S` "    LOG:" $1 >>${LOGFILE}
  }

function error()
  {
    echo `date +%d.%m.%Y%t%H:%M:%S` "    ERROR:" $1 >>${LOGFILE}
    if [ -n "$MAILNOTIFY" ] ; then
      echo `date +%d.%m.%Y%t%H:%M:%S` "    ERROR:" $1 | mail -s "ERROR while synchronizing Ubuntu" $MAILNOTIFY
    fi
       echo $1 | grep "Lockfile" >/dev/null
    if [ $? = 1 ] ; then
      rm -f ${LOCK}
    fi
    exit 1
  }

function status()
  {
    case "$1" in
      0)
        log "Synchronization completed."
        ;;
      1)
        error "DEBMIRROR: Connection closed"
        ;;
      2)
        error "DEBMIRROR: Timeout"
        ;;
      *)
        error "DEBMIRROR: Unknown error $1"
        ;;
    esac
  }

if [ -f ${LOCK} ] ; then
  error "Lockfile ${LOCK} exists."
fi

touch ${LOCK}

# Create local mirror directory if not exists
if [ ! -d ${MIRRORDIR} ] ; then
  log "Creating local mirror directory."
  mkdir -p ${MIRRORDIR}
fi

log "Starting Ubuntu download process."
debmirror -v -e http -h ${SOURCE_SRV} -r ${SOURCE_DIR} --ignore-release-gpg --dist=${DIST} --section=${SECTION} --arch=${ARCH} ${MIRRORDIR} >> ${DEBUGFILE} 2>&1
status $?

rm -f ${LOCK}

exit 0                                                         

设置log

/etc/logrotate.d/ubuntu_mirror

/var/log/ubuntu_mirror.log {
    monthly
    rotate 3
    compress
    delaycompress
    missingok
    notifempty
}

/var/log/ubuntu_mirror.debug {
    weekly
    rotate 3
    compress
    delaycompress
    missingok
    notifempty
}

这个时候,就可以查看到log。目前我正在同步中。

2012年7月17日更新

已经用上面脚本,成功把ubuntu 12.04的全部源都下载到本地,总共快120G,并且已经通过cobbler来安装ubuntu,非常顺利完成。

Jul 142012
 

ubuntu改变别的发行版的地方,就是固定时间发布版本,这点我还是比较喜欢的。ubuntu 12.04,是一个长期支持版本,后续的sp,也是定期发布。

https://wiki.ubuntu.com/PrecisePangolin/ReleaseSchedule/

2012年8月23号发布 12.04.1,这个版本上,相信安装Essex,应该就完全没任何的问题。

除了软件更新,还有一个重大的动作就是增加硬件的驱动,这是必须.

ubuntu-release-cycle-2

Jul 132012
 

现在到处都是大数据,天天都有专家关心所谓的数据安全。不过大家理解上差异很大。

看来下面这两段话,说不定能帮你把概念搞清楚。

1:数据安全

什么是数据安全呢?估计每个人的理解不见得都是一样的。

非常经典的解析。以前我一直没法解析清楚的问题。

http://coolshell.cn/articles/6976.html

在英文里,有两个单词,一个是Safe,一个是Security,很不幸的是,这两个英文单词翻译成中文都叫“安全”,

    所谓Safe,也就是数据不丢失的意思。这是目前云存储解决的问题,你可以把你的数据放在云端,你的所有的终端设备都可以通过云端来共享同步你的数据,这样,云端就成了你数据同步和备份的数据中枢。说得专业一点,这又叫Availability,中文叫可用性,意思是,你的数据总是可用的,基本不会丢失 ,

    所谓Security,也就是数据的隐私和不泄露。这就是德艺双馨的陈冠希老师的痛,因为本来隐私和机密的数据被泄露出去了。就目前而言,我看到的云存储解决的都是Availability,而不是Security。Security解决的是私密和不泄露的问题。所以,李开复同学要让陈冠希老师把他的那些数据存到云端是可笑的,对于那些私密照片,我相信陈冠希老师要求的是“Security”,而不是“Availability”。

数据持久性(Durability)与系统可用性(Availability)两个概念混淆,

前者也理解为数据的可靠性,是指数据存储到系统中后,到某一天数据丢失的可能性。例如Amazon S3的数据持久性是11个9,即如果存储1万(4个0)个文件到S3中,1千万(7个0)年之后,可能会丢失其中1个文件。那么Swift能提供多少个9 的SLA呢?下文会给出答案。针对Swift在新浪测试环境中的部署,我们从理论上测算过,Swift在5个Zone、5×10个存储节点的环境下,数据复制份是为3,数据持久性的SLA能达到10个9。

http://os.51cto.com/art/201207/347656.htm

Jul 132012
 

刚看到资料,苹果的数据中心是180英亩,赶紧查了一下,1英亩=6亩=4047平方米。那就是说苹果的数据中心,超过1000亩,还是非常大的。这么大的数据中心,工作人员才67人。数量少的惊人。原文

icloud

Jul 122012
 

对于KVM的优化,其实很少文章提交.今天刚好在邮件列表里看到,我也刚好能看懂.

在Redhat RHEL 6,有一个功能,就是内存合并, 简单说,就是把相同的内存合并,这样可以让你的系统跑更多的虚拟机.不过肯定也会造成性能的影响.

默认这个功能是开启的.如何关闭, 什么时候关闭. 开启的时候,有什么地方可以优化.

看原文吧,还是有收获的.How to improve KVM performance by adjusting KSM

发现文章是需要注册才能看到,这里就转载一下.

While the kernel-based virtual machine (KVM) is designed to self-optimize, there are a few parameters that can be adjusted to make a KVM host perform better. The most important of these is kernel samepage merging (KSM), a feature that allows the kernel to handle memory more efficiently. KSM allows the Linux kernel to recognize memory pages that contain the same content, then it can merge these memory pages, consolidating the data to one location to be referred to multiple times.

If KVM is used on a host, typically several guest operating systems (OSes) are activated and often these are running the same OS, which means that a huge amount of kernel pages are loaded multiple times. By applying KSM, more virtual machines (VMs) can be started using same amount of memory. In fact, KSM allows over-committing of  VMs. But, there is a performance penalty for using KSM. In average environments the performance price is about 10%, which is a reason to turn KSM off in some environments.

In Red Hat Enterprise Linux 6 and Fedora 14, KSM is switched on by default. It is implemented by two services that are started automatically at system initialization: ksmd and ksmtuned. Administrators should judge their environment and determine whether to keep KSM on or turn it off.

Determining whether to use KSM, or turn it off
If the purpose is to run as many VMs as possible, and performance is not an issue, KSM should be kept running. For example, it allows running 40 VMs on a host normally capable of running 30 VMs, which means maximum hardware usage efficiency. But, if a server is running with a relatively small amount of VMs and performance is an issue, KSM should be turned off.

The best choice for any system will depend on the memory calculation made while creating the virtual environment. If there is enough physical RAM in the virtualization host to meet the memory needs of the VMs without KSM, it is better to switch it off. Use chkconfig ksmd off, chkconfig ksmtuned off, service ksmd off and service ksmtuned off to switch off all parts of KSM. But if a host is tight on memory, it’s better to keep it on.

Tuning KSM for best performance
When using KSM, some of its parameters can be tuned for best performance. They are located in a small configuration file named /etc/ksmtuned.conf:

 

# Configuration file for ksmtuned.
# How long ksmtuned should sleep between tuning adjustments
# KSM_MONITOR_INTERVAL=60
# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# KSM_SLEEP_MSEC=10
# KSM_NPAGES_BOOST=300
# KSM_NPAGES_DECAY=-50
# KSM_NPAGES_MIN=64
# KSM_NPAGES_MAX=1250
# KSM_THRES_COEF=20
# KSM_THRES_CONST=2048
# uncomment the following if you want ksmtuned debug info
# LOGFILE=/var/log/ksmtuned
# DEBUG=1

The most important parameters in the configuration file is KSM_SLEEP_MSEC. The default value that is used on Fedora 14 is set for large servers. When running a few VMs on a host while using KSM, it’s better to give the host a higher sleep time. For example, try KSM_SLEEP_MSEC=50 to test the effect on the VMs.