Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Cannot switch to old mode now' Error in Elasticdump

I tried backing up and restoring an index to json in Elasticsearch using elasticdump (on Node.js):

[Backup]
elasticdump --input=http://cred:[email protected]:9200/.kibana --output=kibana.json --type=data (Works)

[Restore]
elasticdump --output=http://cred:[email protected]:9200/.kibana --input=kibana.json --type=data (Gives an error)

The error is:

_stream_readable.js:749
    throw new Error('Cannot switch to old mode now.');
          ^
Error: Cannot switch to old mode now.
    at emitDataEvents (_stream_readable.js:749:11)
    at ReadStream.Readable.pause (_stream_readable.js:740:3)
    at file.completeBatch (/usr/lib/node_modules/elasticdump/lib/transports/file.js:75:19)
    at Stream.<anonymous> (/usr/lib/node_modules/elasticdump/lib/transports/file.js:65:10)
    at Stream.emit (events.js:117:20)
    at drain (/usr/lib/node_modules/elasticdump/node_modules/through/index.js:34:23)

Does anyone know what is going and how to fix it?

like image 876
Phil B Avatar asked Mar 09 '16 05:03

Phil B


1 Answers

Your node version is outdated.

Try running node --version and if you get anything below 1.0.0 then you need to upgrade your local version of node.

In order to manage several node versions locally you can use the n module. Simply run the below steps

sudo npm install -g n
sudo n stable

And then you'll have the latest version of node installed and elasticdump will work again.

like image 147
Val Avatar answered Nov 19 '22 14:11

Val