TokyoTyrantã®ã¬ããªã±ã¼ã·ã§ã³ã¨Railsã§ã®å©ç¨
ã¬ããªã±ã¼ã·ã§ã³ã®è¨å®
movedã«ãã Replication ã®ä¾ããã£ã¦ã¿ã
ãã¹ã¿ã¼å´
% mkdir ulog-1 % ttserver -port 1978 -ulog ulog-1 -sid 1 casket-1.tch
ãã¡ãã¯é常ã®è¨å®ã§ããï¼1ã¤æ´æ°ãã°(ulog)ã®é¨åã追å ããã¦ãã¾ãï¼前回ã¯æ´æ°ãã°ã¯ãã¡ã¤ã«ã ã¨æã£ã¦è¨å®ãããã§ããï¼å®ã¯ãã£ã¬ã¯ããªãæå®ããã¹ãã§ããï¼ãã㯠MySQL ã§ãããã¤ããªãã°(binlog)ã«ç¸å½ãããã®ã§ãããããï¼ä¸èº«è¦ãã¨ï¼
ã¹ã¬ã¼ãå´
% mkdir ulog-2 % ttserver -port 1979 -ulog ulog-2 -sid 2 -mhost localhost -mport 1978 -rts 2.rts casket-2.tch
ã¹ã¬ã¼ãå´ã§ã¯ãã¹ã¿ã¼ãæå®ãã¾ãï¼mhost ããã¹ã¿ã¼ã®ãã¹ãåï¼mport ããã¹ã¿ã¼ã®ãã¼ãçªå·ï¼rts ãã¬ããªã±ã¼ã·ã§ã³ã¿ã¤ã ã¹ã¿ã³ããã¡ã¤ã«ã®æå®ã§ãï¼
åä½ãã¹ã
% tcrmgr put -port 1978 localhost one first % tcrmgr put -port 1978 localhost two second % tcrmgr put -port 1978 localhost three third % tcrmgr mget -port 1978 localhost one two three one first two second three third % tcrmgr mget -port 1979 localhost one two three one first two second three third
確ãã«ã¬ããªã±ã¼ã·ã§ã³ãã¦ãã¾ãï¼
Railsãã使ã
前回ã® Rails ã®ãµã³ãã«ãå°ãæ¹è¯ãã¾ãï¼
ãµã¼ããç«ã¡ä¸ãã
ããã§åé¡çºçï¼åä¸ãã¹ãä¸ã§ master/slave å ±ã« daemon(-dmn)ã«ããã¨ï¼ãã°ã«
do_repl: tculrdnew failed
ã¨åºã¦ï¼ã¬ããªã±ã¼ã·ã§ã³ããã¾ããï¼ãªãã§ã ãï¼ã¨ããããï¼master ã foreground ã§å®è¡ãããã¨ã§å¯¾å¦ï¼
master å´ % ttserver -log "$PWD/ttserver.log" -port 1978 -pid "$PWD/ttserver.pid" -ulog ulog-1 -ulim "256m" -sid 1 "$PWD/casket.tch#bnum=1000000" slave å´ % ttserver -dmn -log "$PWD/ttserver2.log" -port 1979 -pid "$PWD/ttserver2.pid" -ulog ulog-2 -sid 2 -mhost localhost -mport 1978 -rts "$PWD/ttserver2.rts" "$PWD/casket2.tch#bnum=1000000"
ogawa@:[~/work/tokyocabinet/tt-test]% ruby script/console Loading development environment (Rails 2.2.2) >> u = User.find(1) => #<User id: 1, name: "hogehoge", created_at: "2009-01-09 04:11:26", updated_at: "2009-01-09 04:11:26"> >> u.access_time => nil >> u.access_time = Time.now => Fri Jan 09 15:15:46 0900 2009 >> u.access_time => Fri Jan 09 15:15:46 0900 2009 >> exit % ruby script/console Loading development environment (Rails 2.2.2) >> u = User.find(1) => #<User id: 1, name: "hogehoge", created_at: "2009-01-09 04:11:26", updated_at: "2009-01-09 04:11:26"> >> u.access_time => Fri Jan 09 15:15:46 0900 2009
ã¨ã¾ãæå¤(ã§ããªãã)ã«ç°¡åã«ã§ãã¾ããï¼ãã¦ï¼ãããå®ãµã¼ãã¹ã«ã©ãçµã¿è¾¼ãããªã»ã»ã»ã»