elastic searchデータ移行

 

今まで調べたとことだとelastic searchのデータを移行する方法は大きく以下の三つである

  1. ファイル丸ごと移動
  2. elastic search 1.0xのスナップショットレストア機能利用
  3. スクリプトを利用してポストで投げる
  4. snapshotプラグインを利用

 

elastic search 1.0xのスナップショットレストア機能利用

http://blog.negabaro.com/4067.htmlを参考ください。

 

snapshotプラグインを利用

http://blog.livedoor.jp/sasata299/archives/51979121.html

上記URLを参考してsnapshotプラグインを設置

/var/www/html/kibana3/elasticsearch/bin/plugin –install knapsack –url http://bit.ly/17cn710

再起動

service elasticsearch restart or ./elasticsearch –f &

バックアップ

curl -XPOST http://localhost:9200/dictionary/jmeter28/_export

こんなエラーが。。原因不明

[2014-04-03 04:21:42,576][WARN ][http.netty               ] [Devil-Slayer] Caught exception while handling client http traffic, closing connection [id: 0xf6eedfb2, /127.0.0.1:44182 => /127.0.0.1:9200]
java.lang.IncompatibleClassChangeError: Found class org.elasticsearch.rest.RestRequest, but interface was expected
        at org.xbib.elasticsearch.action.RestExportAction.handleRequest(RestExportAction.java:76)
        at org.elasticsearch.rest.RestController.executeHandler(RestController.java:159)
        at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:142)
        at org.elasticsearch.http.HttpServer.internalDispatchRequest(HttpServer.java:121)
        at org.elasticsearch.http.HttpServer$Dispatcher.dispatchRequest(HttpServer.java:83)
        at org.elasticsearch.http.netty.NettyHttpServerTransport.dispatchRequest(NettyHttpServerTransport.java:291)
        at org.elasticsearch.http.netty.HttpRequestHandler.messageReceived(HttpRequestHandler.java:43)
        at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.elasticsearch.common.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:145)
        at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
        at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459)
        at org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536)
        at org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)
        at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
        at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
        at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
        at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)
curl: (52) Empty reply from server

。。逃げろ!

 

 

 

ファイル丸ごと移動

 

elasticsearchデータ格納場所

 

元々はこんな場所にあった

cd /var/www/html/kibana3/elasticsearch/data/elasticsearch/nodes/0/indices/dictionary

[root@ip-172-31-8-24 dictionary]#  du -sh ./*  | grep -v K | sort -nk 1
219M    ./0
245M    ./4
274M    ./2
275M    ./3
276M    ./1

 

それを以下の設定ファイルを変更してnfsでマウントした /data/elasticsearchに移したい

 

vim /var/www/html/kibana3/elasticsearch/config/elasticsearch.yml
path.data = で 実態場所変更可能

path.data: /data/elasticsearch/

 

さて、吐く場所は変更されたのか

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です