仿照Solr 中同步索引数据的方式用rsync 把index mster 上的索引同步到各个 search slave 。同步的操作可以简单描述为:
cp -lr ${data_dir}/index ${data_dir}/${short_name}-wip
rm -f ${data_dir}/${short_name}-wip/segments
rm -f ${data_dir}/${short_name}-wip/*.del
rsync -Wa --size-only --delete rsync://${master_host}:${rsync_port}/${module}/${short_name}/ ${data_dir}/${short_name}-wip
mv ${data_dir}/${short_name}-wip ${data_dir}/${short_name}
注意source path 结尾处的'/':A trailing '/' on a source name means "copy the contents of this directory". Without a trailing slash it means "copy the directory". 下面是rsync 的man page 中给出的两者的区别。
rsync -avz foo:src/bar /data/tmp
this would recursively transfer all files from the directory src/bar
on the machine foo into the /data/tmp/bar directory on the local machine.
The files are transferred in "archive" mode, which ensures that symbolic links,
devices, attributes, permissions, ownerships etc are preserved in the transfer.
Additionally, compression will be used to reduce the size of data portions of the transfer.
rsync -avz foo:src/bar/ /data/tmp
a trailing slash on the source changes this behavior to transfer all files
from the directory src/bar on the machine foo into the /data/tmp/.
A trailing / on a source name means "copy the contents of this directory".
Without a trailing slash it means "copy the directory".
This difference becomes particularly important when using the --delete option.
参考:
developing notes about sf search engine.
Subscribe to:
Post Comments (Atom)
Blog Archive
About Me
- 吕克让
- lhelper 原名吕克让 工学学士 2002年毕业于北京工业大学计算机学院。 他最喜欢的花是文竹;最想做的是成为一名像 Richard Stallman 一样优秀的 Hacker。 最近他正在专心sf search 的升级与开发。
No comments:
Post a Comment