Archive for the ‘Tokyo Cabinet’ Category

 

tokyotyrant backup | tcrmgr copy

1月 12th, 2012

http://alpha.mixi.co.jp/blog/?p=147
# tcrmgr copy -port 1978 localhost /tmp/backup.tch
ホットコピーできるので、mysqldumpよりも楽です。
* ulogも入れておきましょう。
* 更新しない物は、コピーだけでOK
こんな感じで簡単なスクリプト

#!/bin/sh
copy_tt()
{
# 1 output_file 2 port
tcrmgr copy -port ${2} localhost ${1}
}

SRC_IP=’333.333.333.333′
SRC_DIR=”/home/bkup/data/bkup/tt/servicename”
TO_IP=’99.99.99.99′
TO_DIR=”/home/bkup/data/${SRC_IP}/tt/servicename”

mkdir -p ${SRC_DIR}
copy_tt “${SRC_DIR}/a.tch” 51101
copy_tt “${SRC_DIR}/b.tch” 51102

ssh ${TO_IP} mkdir -p ${TO_DIR}
rsync -auz ${SRC_DIR}/ ${TO_IP}:${TO_DIR}/

Read full article | コメントは受け付けていません。

Tokyo cabinet/tyrant install centos 64bit

11月 14th, 2010

bzlib.hが無いと言われたので

# yum install bzip*
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
bzip2-devel [...]

Read full article | コメントは受け付けていません。

TokyoTyrant TokyoCabinet 2GBファイルサイズ制限が・・・

7月 24th, 2010

ファイルサイズが2GBで止まってしまったので
調べたら tokyocabinet のconfigureで –enable-off64をつけないといけないようでした。

# ./configure –enable-off64

2GBでファイルサイズエラーになってつながらなくなっていたので・・・調査。
システム的には2GBは問題ないようだけど。。。と調べたら configure時に”–enable-off64”をしていないといけなかったようでした。
でtokyotyrantをrestart.ここでインデックスファイルは消して再構築しました~
ファイルサイズ LFS Large File Support

Read full article | コメントは受け付けていません。

tokyo dystopia 使ってみた。

6月 5th, 2010

http://1978th.net/tokyodystopia/spex.html#tcqdbapi
qgramで40万レコードを入れてみました。 id + 文字列(100文字以内の日本語タイトル的なもの)
$ /usr/local/bin/tcqmgr inform /home/data/itemIndex
path: /home/data/itemIndex
database type: qgram
inode number: 6754296
modified time: 2010-06-05T21:01:20+09:00
options:
token number: 229823
file size: 132282880
ファイルサイズは 130M
$ /usr/local/bin/tcqmgr search -ph /home/data/itemIndex DELL
hits: 49
time: 0.012566
1037246
1040312
1069149
1069162
1072779
1077409
1092249
1112770
1126030
1126362
検索結果もこんな感じで time: 0.012566 と超満足できる結果です。
お手軽検索に持って来いですね!お勧めです。
数百万件まで増やしてまたメモします。

Read full article | コメントは受け付けていません。

Tokyo Dystopiaをインストールしてみる

6月 3rd, 2010

Tokyo Dystopia: a full-text search system.
http://1978th.net/tokyodystopia/tokyodystopia-0.9.14.tar.gz
./configure
make
make install
で問題なくインストールできました。
tokyocabinet-1.4.43はインストール済みです。
コマンドをテストしてみる。
$ dystmgr create test
$ dystmgr put test 1 “test”

$ dystmgr search test1 “es”
1

とOKぽいです。
test1ディレクトリ以下に

-rw-r–r–  41984  6月  3 01:36 0001
-rw-r–r–  8393048  6月  3 01:36 dystopia.tch
なファイルが作成されます。

Read full article | コメントは受け付けていません。

qgramで全文検索 Tokyo cabinet tyrant

5月 28th, 2010

http://alpha.mixi.co.jp/blog/?p=1112
# tctmgr inform -nl /var/ttserver/auctionItem/auctionItem.tct
path: /var/ttserver/auctionItem/auctionItem.tct
database type: table
additional flags: open
bucket number: 131071
alignment: 256
free block pool: 1024
index number: 5
name=bid, type=decimal, rnum=1232262, fsiz=20391168
name=mon, type=decimal, rnum=1232262, fsiz=14535680
name=key, type=lexical, rnum=1232262, fsiz=32897792
name=det, type=qgram, rnum=0, fsiz=131601664
name=pri, type=decimal, rnum=0, fsiz=5216512
unique ID seed: 1232263
inode number: 37617667
modified time: 2010-05-28T02:08:58+09:00
options:
record number: 1232262
file size: 1315273472
インデックス構築に時間がかかっている様子。10分以上かかるかな?
http://www.php.net/manual/ja/class.tokyotyrant.php#tokyotyrant.constants.RDBQCFTS_PH
で検索してみる。

Read full article | コメントは受け付けていません。

Tokyo Cabinet コマンドでインデックスを貼る

4月 4th, 2010

# /etc/init.d/tokyotyrant/keywords stop
Stopping the server of Tokyo Tyrant
Sending the terminal signal to the process: 6109
Done
# tctmgr setindex /var/ttserver/keywords/keywords.tct key
# /etc/init.d/tokyotyrant/keywords start
Starting the server
オプションで、トークン転置インデックスを利用
# tctmgr setindex -it token /var/ttserver/keywords/keywords.tct category
であってるのかな?
>> 引用元 :  開発メモ: [recent modification].
> 文字列型インデックス:
> 計算量が小さくなる演算子:STREQ、STRBW、STROREQ
> 計算量は同じだが高速化する演算子:STRINC、STREW、STRAND、STROR、STRRX、NUMEQ、NUMGT、NUMGE、NUMLT、NUMLE、NUMBT、NUMOREQ
> 計算量が小さくなる順序指定:STRASC、STRDESC
> 数値型インデックス:
> 計算量が小さくなる演算子:NUMEQ、NUMGT、NUMGE、NUMLT、NUMLE、NUMBT、NUMOREQ
> 計算量は同じだが高速化する演算子:STREQ、STRBW、STROREQ、STRINC、STREW、STRAND、STROR、STRRX
> 計算量が小さくなる順序指定:NUMASC、NUMDESC

Read full article | コメントは受け付けていません。

Tokyotyrant 実行スクリプト

3月 28th, 2010

http://1978th.net/tech/promenade.cgi?id=58
http://linux.papa.to/?date=20100315
http://alpha.mixi.co.jp/blog/?p=290
http://asakura.g.hatena.ne.jp/asakura-t/20100219/tokyo_tyrant
# cp /usr/local/sbin/ttservctl /etc/init.d/tokyotyrant/keywords
# vim /etc/init.d/tokyotyrant/keywords
上のほうを変更してみる。
# configuration variables
database = “keywords”
prog=”ttservctl”
cmd=”ttserver”
basedir=”/var/ttserver/$database”
port=”19781″
pidfile=”$basedir/pid”
#logfile=”$basedir/log”
#ulogdir=”$basedir/ulog”
ulimsiz=”64m”
#sid=1
#mhost=”remotehost1″
#mport=”1978″
#rtsfile=”$basedir/rts”
#dbname=”$basedir/$database.tch#bnum=1000000″
dbname=”$basedir/$database.tct#opts=l#apow=8#dfunit=2″
retval=0
実行してみる。
# chmod a+x /etc/init.d/tokyotyrant/keywords
# /etc/init.d/tokyotyrant/keywords start
Starting the server of Tokyo Tyrant
Executing: ttserver -port 19781 -dmn -pid /var/ttserver/keywords/pid -ulim 64m
Done
# ll /var/ttserver/keywords/
合計 4108
-rw-r–r– 1 root root 4198720 3月 28 18:45 keywords.tch
# /etc/init.d/tokyotyrant/keywords stop
Stopping the server of Tokyo Tyrant
Sending the terminal signal to the process: 3253
Done
OKぽい。

Read full article | コメントは受け付けていません。

Tokyo Tyrantをインストールする。

3月 22nd, 2010

# yum install gcc make zlib-devel bzip2-devel

# wget http://1978th.net/tokyotyrant/tokyotyrant-1.1.40.tar.gz
# cd tokyotyrant-1.1.40
# ./configure
# make
# make install
#================================================================
# Thanks for using Tokyo Tyrant.
#================================================================
入りました。
確認
# /usr/local/sbin/ttservctl start
Starting the server of Tokyo Tyrant
Executing: ttserver -port 1978 -dmn -pid /var/ttserver/pid
Done
こんな感じで start しました。
動かしつつ
[root@localhost tokyotyrant-1.1.40]# make check
ずらずら動いて
#================================================================
# Checking completed.
#================================================================
OKっぽいです。
# /usr/local/sbin/ttservctl stop
Stopping the server of Tokyo Tyrant
Sending the terminal signal to the process: 21047
Done
と終わりました。
Tokyo Tyrant: [...]

Read full article | コメントは受け付けていません。

Tokyo Cabinet をインストールしてみる。

3月 22nd, 2010

# yum install tokyocabinet*
Installing:
tokyocabinet               i386         1.4.9-1.el5         epel         458 k
tokyocabinet-devel         i386         1.4.9-1.el5         epel         556 k
だけど。tokyotyrantが駄目だった・・・なので入れなおし。

# wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.43.tar.gz
# tar xvfz …
# ./configure [...]

Read full article | コメントは受け付けていません。