logrotateの設定でdailyにしてもなぜか反映されない

答えは
http://www.itmedia.co.jp/help/tips/linux/l0291.html

 ここで注意しておきたいのは,「/etc/logrotate.d」下のファイルで「daily」と指定してもlogrotate.conf内で「weekly」と指定されていると「daily」実行されない点だ。個々のサービスでローテート間隔を変えたい場合には,logrotate.conf では「daily」にしておいて,「/etc/logrotate.d」下の設定ファイルそれぞれで定義しておく必要がある。

debianでpound

debian sid の pound(2.0-1) で mongrel_cluster を動かそうとしたけどうまくいかない。
/etc/pound/pound.cfg で文字列を""で囲んだりエラーが出る設定をコメントアウトしたりで何とか動いたものの「MONITOR: worker exited on signal 11, restarting...」という訳分からないエラーが発生。
結局 http://www.anarchogeek.com/articles/page/2 を見てSESSIONの設定を追加したら動いた。
以下動いた設定ファイル

## Minimal sample pound.cfg
##
## see pound(8) for details


######################################################################
## global options:

User            "www-data"
Group           "www-data"
#RootJail       /chroot/pound

## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
#ExtendedHTTP   "0"

#WebDAV         "0"

## Logging: (goes to syslog by default)
##      0       no logging
##      1       normal
##      2       extended
##      3       Apache-style (common log format)
LogLevel        1

## check backend every X secs:
Alive           30

## use hardware-accelleration card supported by openssl(1):
#SSLEngine      


######################################################################
## listen, redirect and ... to:

## redirect all requests on port 8888 ("ListenHTTP") to the local webserver see "UrlGroup" bel
ow):
#ListenHTTP 127.0.0.1,8080

ListenHTTP
  Address 0.0.0.0
  Port    8888
  Service
    BackEnd
      Address 127.0.0.1
      Port    3030
    End
    BackEnd
      Address 127.0.0.1
      Port    3031
    End
    BackEnd
      Address 127.0.0.1
      Port    3032
    End
    Session
      Type    BASIC
      TTL     300
    END
  End
End

##
#UrlGroup ".*"
#BackEnd 127.0.0.1,80,1
#EndGroup

DebianでThunderbirdの日本語化

日本語パックがオフィシャルに入ったのでインストールしてみたけど、なぜか英語のまま。いろいろ調べてやってみたけどうもうまくいかない。拡張機能をよく見てみると、どうやらThunderbird本体とバージョンが違っているため、無効になっていた。


thunderbird 1.5.0.4
thunderbird-locale-ja 1.5.0.2


結局 /usr/lib/thunderbird/extensions/langpack-ja@thunderbird.mozilla.org/install.rdf をいじることで日本語表示に成功した。


  
    
      
        {3550f703-e582-4d05-9a08-453d09bdfdc6}
        1.5.0.2
 -       1.5.0.2
 +       1.5.0.4
      
    
  

コネクションプール都市伝説


WEB+DB PRESS Vol.33
in Livedoor特集
mysqlの場合コネクションプール使わなくてもパフォーマンスには影響しないらしい。

てことは http://d.hatena.ne.jp/tategamii/20060629 のリクエスト毎にコネクション取得で問題なさそう。

railsで複数DB


1.テーブル毎に切り替え

  • ユーザ認証DBだけ別サーバなんて場合に使える。

config/database.yml

development:
  adapter: mysql
  database: xxx
  username: foo
  password: bar
  host: server
  encoding: utf8

development2:
  adapter: mysql
  database: xxx
  username: foo
  password: bar
  host: server2
  encoding: utf8

app/models/user.rb

class User
  establish_connection :development2
end

2.リクエスト毎に切り替え

http://techno.hippy.jp/rorwiki/?cmd=view&p=HowtoUseMultipleDatabases&key=howtouse

  • Controllerのbefore_filterでActiveRecode::Base.establish_connectionを呼ぶ。
  • リクエストの度にコネクション取得し直しぽい。

3.DB呼び出し毎に切り替え(コネクション保持)

  • マスタ(更新系)・スレーブ(検索系)構成でも使える??
  • config/database.yamlは1と同じ

app/models/user.rb

class User
end

app/models/slave_user.rb

class SlaveUser
  set_table_name "users"
  establish_connection(:development2)
end

ruby script/console

>> User.connection.active?
=> true

>> SlaveUser.connection.active?
=> true

>> User.create
=> #<User:0xb74dd714 @errors=#<ActiveRecord::Errors:0xb74db644 @base=#<User:0xb74dd714 ...>, @errors={}>, @new_record=false, @new_record_before_save=true, @attributes={"name"=>nil, "id"=>1}>           

>> User.find(:all)
=> [#<User:0xb74d6360 @attributes={"name"=>nil, "id"=>"1"}>]

>> SlaveUser.find(:all)
=> []

>> SlaveUser.superclass.find(:all)
=> [#<User:0xb74b78e8 @attributes={"name"=>nil, "id"=>"1"}>]

関連テーブルの扱いがややこしそう。


マージンFXのひまわり証券さん、ニンテンドーDS Lite欲しい!