google developer day 2009でandroidの開発用端末が無償で配布されていたのでもらってきたよ。

箱の写真

起動してみた

端末は google dev phone1ではなく、HTC magicベースと推察されますので、結構最新なのかなという感じ。
裏には google developer day 2009の刻印もあるので限定2000台ってことでしょうか。。

SIMはmopera契約済のドコモか、普通のソフトバンクが使えるようです。
e-mobileは周波数は一緒なのですが使えないみたい。残念。
moperaの契約はオンラインでできます。

ちなみにgoogle的にはwifi接続推奨だそうです。
SIMを指してデータ通信した場合、パケット定額制範囲外になるので、危険とのこと。

以下使ってみたアプリ

iPhone版のページのほうが使いやすいです。タグも色分けできないのでこれは進化待ちでしょうか。

これはかなりキラーアプリな気がします。webと同じレベルでリアルタイムにチャットできるのでらくちん!

  • マーケット

外国のアプリがたくさん並んでいました。wifi接続であればサクサクダウンロードできます。
skypetwitter系をダウンロードしてみました。

友達がいないのでまだつかってません。

3,4個入れたのですが全滅しましたw バグかなー。

vmware infrastructure3 の環境構築に潜む罠 第一位(個人的感想)

  • vmware high availability (HA)のとき
When a new host is added into the VirtualCenter inventory, 
the host must be added by its hostname or the HA will not function property.

Mastering VMware infrastructure3 より引用。

つまり
server1.domain.tld (192.168.1.1)
server2.domain.tld (192.168.1.2)
server3.domain.tld (192.168.1.3)
とあった場合に、192.168.1.1とかipアドレス単位で virtual centerに登録すると100%失敗いたします。

ゆえに、何らかの名前解決手段によってhostネームべ登録されねばなりませぬ。
さらにDNSによる名前解決が推奨されているようなので、/etc/hostsでごまかすのも辞めた方がよいでありましょう。

virtual centerはwindows serverに入れると思いますので、それにくっついてくるDNSを使うとハヤイのではないでしょうか。

希望があれば続く。

Mastering VMware Infrastructure 3

Mastering VMware Infrastructure 3

bind9でNSレコードを他のDNSに権限委譲したときに、正しい値を返さない系の話

  • こんな感じでサブドメイン(others.sample.japan)を他のDNS(subdns1.sample.japan)に権限委譲するとする。
$ORIGIN .
$TTL 600        ; 10 minutes
sample.japan     IN SOA  ns1.sample.japan. root.sample.japan. (
                                2008080101 ; serial
                                7200       ; refresh (2 hours)
                                7200       ; retry (2 hours)
                                2419200    ; expire (4 weeks)
                                600        ; minimum (10 minutes)
                                )
                        NS      ns1.sample.japan.
                        NS      ns2.sample.japan.
                        A       192.168.1.10
                        MX      10 mail.sample.japan.
$ORIGIN sample.japan.
others                  NS      subns1.sample.china.
                        NS      subns2.sample.china.
ftp                     A       192.168.1.10
mail                    A       192.168.1.11
ns1                     A       192.168.1.1
ns2                     A       192.168.1.2
www                     A       192.168.1.10

これで others.sample.japan 正引きは subns1.sample.china と subns2.sample.china に委譲される。

  • おもむろに委譲側でnslookupとかしてみる。digでもいいけど。
$ nslookup
> server 192.168.1.1
Default server: ns1.sample.japan
Address: 192.168.1.1#53
> others.sample.japan
Server:         ns1.sample.japan
Address:        192.168.1.1#53

Non-authoritative answer:
Name:   others.sample.japan
Address: xxx.xxx.xxx.xxx (委譲されたNSで設定された値)

と返るのが期待値。
しかし、まったく返さない場合がある。

このときチェックするポイントは、

  1. 委譲された側(sample.china側)が正しくゾーンレコードを持っているか
  2. 委譲された側(sample.china側)がそもそもちゃんとゾーン自体を持っているか
  3. named.conf で resursion yes; って書いてあるか

って感じ。

言いたかったのは3つ目に注意ってことであります。

centos5.2 に bind9 を構築する。投稿するほどのものではない。

  1. 前提

global ip address を ドメイン名に変換するいわゆる外部向けDNS

  1. インストール
# yum install bind bind-chroot caching-nameserver

caching-nameserver 入れるとめんどくさい設定ファイル群最初に作ってくれるから便利。
信用ならぬという人は不要。ipv6関連の設定も紛れ込む。本質的に外部向けなら不要です。

  1. 設定

chroot入れてるので、/var/named/chroot/ 以下が本体。
cachong-nameserverの設定をぱくる。

# cp /var/named/chroot/etc/named.caching-nameserver.conf /var/named/chroot/etc/named.conf

書き直す

# diff named.conf named.caching-nameserver.conf 
16c16
<       //listen-on-v6 port 53 { ::1; };
    • -
> listen-on-v6 port 53 { ::1; }; 28,30d27 < recursion no; < version "unknown"; < allow-transfer { none; }; 38,47c35,39 < < zone "." { < type hint; < file "/dev/null"; < }; < < zone "sample.example.japan" { < type master; < file "sample.example.japan.zone"; < allow-transfer { none; };
    • -
> view localhost_resolver { > match-clients { localhost; }; > match-destinations { localhost; }; > recursion yes; > include "/etc/named.rfc1912.zones"; 49d40 <

zoneファイルは自分で書きましょう。
named.confの権限はnamedさんにしとく。

chown named:named /var/named/chroot/etc/named.conf
  1. 起動
# /etc/init.d/named start

/var/log/message で異常がないか見る。

おわり。

passenger (旧mod_rails)をcentos5.2に仕込む

前準備

ruby1.8.6使いたい人は手で入れた方がよいとおもう。

# yum install gcc gcc-c++ ruby ruby-devel ruby-rdoc

2.2系の最新(2.2.9とか)使いたい人は手で入れるよろし。

# yum install httpd httpd-devel

devel 入れないと passenger のインストーラにおこられます
自動起動するようにしとく。

# chkconfig httpd on
  • gem 入れる。外部レポジトリは好きじゃないので生で。
# wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
# tar xvzf rubygems-1.2.0.tgz 
# cd rubygems-1.2.0
# ruby ./setup.rb
  • passenger入れる。
# gem install passenger

g++ ないと怒られるよ。最近c++モノ増えたなぁ。依存関係にあるのもいれる。

  • passengerの設定をする。
# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v2.0.2.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/bin/rake
 * Apache 2... found at /usr/sbin/httpd
 * Apache 2 development headers... found at /usr/sbin/apxs
 * Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config
 * fastthread... found
 * rack... found
                                                                                      • -
                                                                                      • -
Compiling and installing Apache 2 module... 以下略
                                                                                      • -
The Apache 2 module was successfully installed. Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.2/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.2 PassengerRuby /usr/bin/ruby After you restart Apache, you are ready to deploy any number of Ruby on Rails applications on Apache, without any further Ruby on Rails-specific configuration! Press ENTER to continue.

完了
サンプルはこうやるらしい

                                                                                      • -
Deploying a Ruby on Rails application: an example Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host to your Apache configuration file, and set its DocumentRoot to /somewhere/public, like this: ServerName www.yourhost.com DocumentRoot /somewhere/public And that's it! You may also want to check the Users Guide for security and optimization tips and other useful information: /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.2/doc/Users guide.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) http://www.modrails.com/ Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.

いじょう。
気が向いたら何かdeployします。

ebb と thin と mongrel を比較してみる。

やり方はここをまねる。
http://izumi.plan99.net/blog/index.php/2008/03/31/benchmark-passenger-mod_rails-vs-mongrel-vs-thin/

  • 環境.
CPU:Dual-Core AMD Opteron(tm) Processor 2212 HE
MEM:MemTotal:1927784 kB
OS:CentOS release 5.2 (Final)
WEB:Apache 2.2.9 (compiled)
RUBY:1.8.5 (compiled)
DB:MySQL 5.0.28 (compiled)
  • 対象アプリ.
どこかで動いてる商用サイトのテストサーバ rails 1.2.6系

もちろん productionモード

  • その他の環境:

Apacheの設定はCentOSのデフォルトを流用。
mongrel clusterは10個構成で、mod_proxy_balancerで渡す。

ProxyPass / balancer://cluster/
ProxyPassReverse / balancer://cluster/

	BalancerMember http://127.0.0.1:3000
	BalancerMember http://127.0.0.1:3001
	BalancerMember http://127.0.0.1:3002
	BalancerMember http://127.0.0.1:3003
	BalancerMember http://127.0.0.1:3004
	BalancerMember http://127.0.0.1:3005
	BalancerMember http://127.0.0.1:3006
	BalancerMember http://127.0.0.1:3007
	BalancerMember http://127.0.0.1:3008
	BalancerMember http://127.0.0.1:3009

thin,ebbも基本はmongrelと同じ構成

1発目

ab -n 100 -c 10 http://target.server/

結果

Requests per second:    12.82 [#/sec] (mean)
Time per request:       780.323 [ms] (mean)
Time per request:       78.032 [ms] (mean, across all concurrent requests)
Transfer rate:          341.65 [Kbytes/sec] received

2発目

ab -n 1000 -c 100 http://target.server/

結果

Requests per second:    11.98 [#/sec] (mean)
Time per request:       8345.587 [ms] (mean)
Time per request:       83.456 [ms] (mean, across all concurrent requests)
Transfer rate:          319.44 [Kbytes/sec] received

以下そのうち書く。
まあぶっちゃけmysqlボトルネックになって大差ないわけだが。

というわけでリライト予定。

古いmegaraid(PERC2)を使ってるdellの古代兵器(poweredge 650とか)に

redhat es3(CentOS3)までに含まれていたraid controller(megaraid)ドライバが原因不明ですがCentOS4以降入ってないので、例によってHDDが見つからずインストールできない系の話。

基本的には、これの通りにやればいいわけですが、インストールするOSのkernelのバージョンが一致してないとうまくいかないケースが少々あるので注意。
つまり上記リンクにおけるCentOSは4とか4.1時代だと思われるので、2008年2月時点における現行の4.6のkernelを入れる場合、上記リンクにあるmegaraid.koやmegaraid.smp.koがそのまま使えないことがままある。

  1. インストールしたいOSをフロッピードライブ付きの仮想環境等にインストールする
  2. おもむろに上記リンクの通りに丁寧にmegaraid.koを作成する
  3. 頑張ってフロッピーにいれる
  4. 目的のマシンに入れる


あと適当な注意点としては、smpマシンと普通マシン用のmegaraid.koなドライバは違うので、CPUに合わせてつくっとくこと。


linux インストール時にフロッピーとか外部デバイスのドライバ使いたい場合、

linux noprobe

すること。

linuxのインストール画面とかでコマンドラインにいくには、

CTRL-ALT-F2

するべし。

あとインストール完了!なときに、再起動しちゃだめ。

/etc/modprobe.conf
で読み込まれるドライバ間違ってるから、

4c4< alias scsi_hostadapter1 megaraid

    • -

> alias scsi_hostadapter1 megaraid_mbox

してから再起動しないとまたHDDみえなくなる。
あとCentOS5はこの方法だと確かダメ。どっか書き換えるとか書いてあったけど昔の話なので忘れた。