Linux Kernel 將不提供 bzip2 格式了...

kernel.org 上看到 Linux Kernel 將不提更 bzip2 格式的原始程式包了:「Happy new year and good-bye bzip2」。

之後只會提供 .tar.gz (為了廣泛的可用性) 與 .tar.xz (為了大小,降低傳輸量)。xz 壓出來小不少,也愈來愈多的單位在用了...

bzip2 也一陣子沒更新了,上次更新是 1.0.6,是為了安全性更新 CVE-2010-0405,而 1.0.5 也是安全性更新,真正有新版本是 1.0.4 (2006 年 12 月)。

算是功成身退了?

GPS logger:環天的 DG-100...

24h 上買了這顆「DG-100 GPS 數據紀錄器」,然後在 VirtualBox 裡吃鱉了好幾次,所以還是整理一下,讓之後的人比較好辦事 XD

用過的兩顆 GPS logger 都是用 Prolific 的 PL2303 系列晶片,透過 Serial port 的架構溝通,所以 Ubuntu 下會抓到 /dev/ttyUSB0 這種界面。

由於我的目的比較簡單,只要可以抓 gpx 資訊給我就好,後來在 OpenStreetMap 的 wiki 上找到「Globalsat」的資訊,發現了 GPSBabel 這個軟體可以直接在 Mac OS XLinux 下抓 DG-100 的資料:

gpsbabel -i dg-100,erase=0 -f /dev/ttyUSB0 -o gpx -F "track.gpx"

(話說 GPSBabel 的網站感覺回到十年前...)

看指令,如果指定 erase=1 的話就會清掉記錄?另外在 Mac OS X 下則是指定 /dev/cu.PL2303 開頭的 device。

抓下來以後丟到 Dropbox,然後到世界迷霧裡更新,發現就算是已經跑到爛掉的路線,GPS logger 仍然可以記錄到 iPhone 記錄不到的...

Percona 提供 Linux 平台上 MySQL server 調整的參數...

Percona 的人針對 Linux 平台跑 MySQL 的建議:「Linux performance tuning tips for MySQL」。

檔案系統方面建議用 ext4 或是 xfs,記得要用 noatime。(我建議再加上 nodiratime)

然後 i/o schedular 建議用 deadline 或是 noop,這點可以參考之前寫的「關於 Linux 的 Disk I/O 調整...」。

記憶體的部份要處理 swap 與 NUMA 的控制,然後 CPU 的部份要把自動調整速度的功能關掉 (可以省電,不過對忙碌的資料庫應該用不到)。

看起來是比較一般性的方向,不過應該是蠻好用的建議 :p

Linux kernel 內的資料結構與演算法...

Theoretical Computer Science Stack Exchange 上,有人問到有沒有哪些軟硬體的 source code 是可以跟學生說明某些經典演算法的重要性:「Core algorithms deployed」。

下面就有人列了 Linux kernel 內的演算法,以及對應的程式碼。相當長的一份列表...

除了 Linux kernel 外,也還有其他大型 open source 專案用到的資料結構與演算法...

不過看到 Bubble sort 是怎樣呢... XD

Google 將發現安全問題的獎勵延伸到 Open Source 專案上...

Slashdot 上看到 Google 將發現安全問題的獎勵從自家產品延伸到 Open Source 專案上:「Google Offers Cash For Security Fixes To Linux and Other FOSS Projects」。

官方的公告在「Going beyond vulnerability rewards」,規則則是在「Patch Rewards – Application Security – Google」。

初期限制在這些專案上:(直接複製過來)

  • Core infrastructure network services: OpenSSH, BIND, ISC DHCP
  • Core infrastructure image parsers: libjpeg, libjpeg-turbo, libpng, giflib
  • Open-source foundations of Google Chrome: Chromium, Blink
  • Other high-impact libraries: OpenSSL, zlib
  • Security-critical, commonly used components of the Linux kernel (including KVM)

獎勵金額從 USD$500 到 USD$3133.7,這邊的 31337 應該是出自「Leet」吧...

這算是一種回饋社群的方式...

關於 Linux 的 Disk I/O 調整...

Twitter 上看到 tka 的 retweet,介紹了 Linux 下 Disk I/O 的調整:「PostgreSQL: Linux kernel I/O tuning」。

文章裡介紹了三種 scheduler,NOOP、CFQ、Deadline,其中 CFQ 是系統預設值。

其實 MySQL 的結論也差不多,Percona 在 2009 年的時候做過 benchmark,就直接看圖講故事吧:「Linux schedulers in tpcc like benchmark」。


數字愈大愈好。

noop 與 deadline 相當接近,對於 i/o bound 的人都應該要調整 :p

Google 開源的 lmctfy...

前幾天看到 Google 開源的 lmctfy (這名字還頗惡趣味,是「Let Me Contain That For You」的縮寫),是這樣介紹的:

lmctfy is the open source version of Google’s container stack, which provides Linux application containers.

看了一下說明,看起來跟 Docker 有點像啊?再查了查網路上的資料,發現有人更早之前寫過了:「lmctfy:Google的开源Linux容器」。

如果是在 Ubuntu 12.04 上,需要 3.3 或 3.8 的 Linux kernel。不過目前 Docker 還夠用,應該不會花時間去研究這個...

在 Ubuntu 12.04 LTS 上跑 Docker...

dockerdotCloud 發展出來的 LinuX Container 管理程式。

由於建議在 Linux Kernel 3.8 以上的版本跑,所以在 Ubuntu 12.04 LTS 上會需要 backport kernel,參考「ubuntu 12.04 kernel upgrade to 3.10」這篇的方法就可以了。

sudo apt-get install linux-image-generic-lts-raring
sudo apt-get install linux-headers-generic-lts-raring

裝完重開機後應該就可以看到新版 kernel:

$ uname -a
Linux GSLIN-DESKTOP 3.8.0-30-generic #44~precise1-Ubuntu SMP Fri Aug 23 18:32:41 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

接下來依照「使用 Docker/LXC 迅速启动一个桌面系统」這篇的方法,透過 ppa 安裝 docker。

sudo add-apt-repository ppa:dotcloud/lxc-docker
sudo apt-get update
sudo apt-get install software-properties-common lxc-docker

然後用標準的 ubuntu 系統,第一次跑需要抓檔案,但第二次跑就快很多了:

sudo docker run -i -t ubuntu /bin/bash

每次都是乾淨的環境,我第一次進去的時候 touch 一個檔案,第二次進去後就沒了:

gslin@GSLIN-DESKTOP [~] [04:52/W3] sudo docker run -i -t ubuntu /bin/bash
WARNING: Docker detected local DNS server on resolv.conf. Using default external servers: [8.8.8.8 8.8.4.4]
root@679a4301aecc:/# ls -al /tmp
total 8
drwxrwxrwt  2 root root 4096 Apr 11 21:11 .
drwxr-xr-x 24 root root 4096 Sep 22 20:52 ..
root@679a4301aecc:/# touch /tmp/foo.txt
root@679a4301aecc:/# ls -al /tmp
total 8
drwxrwxrwt  2 root root 4096 Sep 22 20:52 .
drwxr-xr-x 25 root root 4096 Sep 22 20:52 ..
-rw-r--r--  1 root root    0 Sep 22 20:52 foo.txt
root@679a4301aecc:/# exit
gslin@GSLIN-DESKTOP [~] [04:52/W3] sudo docker run -i -t ubuntu /bin/bash
WARNING: Docker detected local DNS server on resolv.conf. Using default external servers: [8.8.8.8 8.8.4.4]
root@7ced1a7c82bb:/# ls -al /tmp
total 8
drwxrwxrwt  2 root root 4096 Apr 11 21:11 .
drwxr-xr-x 24 root root 4096 Sep 22 20:52 ..
root@7ced1a7c82bb:/# exit

另外可以參考「Docker: Git for deployment」這篇。

看起來是拿來測試的好工具... 準備拿來測 Puppet

1999 年與 2008 年 Conference T-shirt size 的差別...

Twitter 上看到 b123400 的 retweet,專程貼出來有種好無奈的感覺... XD

PostgreSQL 筆記...

純粹是筆記...

對於架設 server 的文件可以參考 Ubuntu 這份「PostgreSQL - Community Ubuntu Documentation」,雖然 Debian 官方也有一份「PostgreSql - Debian Wiki」,不過沒講到遠端這塊...

設定的部份:

  • 要讓遠端可以存取有兩個地方要開,一個是 postgresql.conflisten_addresses 改成 "*",另外一個是增加 pg_hba.conf 遠端連線的權限。
  • CREATE USER test WITH PASSWORD 'test_password'; 以及 CREATE DATABASE test WITH OWNER = test; 把基本的東西建好。

然後把 firewall 打開,接下來就可以從其他台連進去了。