link on JianShu

rethinkdb backup rethinkdb import

# export
rethinkdb dump -e stf.usageRecord -f record.tag.gz
# import
rethinkdb import -f usageRecord.json --table stf.usageRecord --force

使用导出功能rethinkdb dump需要安装对应的python driver。默认安装的sudo pip install rethinkdb版本为 2.4.2,跟安装的rethinkdb 2.3.6版本不兼容,会提示 No handlers could be found for logger "rethinkdb.logger"问题

➜  ~ rethinkdb --version
rethinkdb --version
rethinkdb 2.3.6.srh.1~0bionic (CLANG 6.0.0 (tags/RELEASE_600/final))
➜  ~ sudo pip uninstall rethinkdb
The directory '/home/stf/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling rethinkdb-2.4.2.post1:

这里安装pip install rethinkdb==2.3.0.post6之后,就可以正常导出了

rethinkdb dump -e stf.usageRecord -f record.tar.gz
NOTE: 'rethinkdb-dump' saves data and secondary indexes, but does *not* save
 cluster metadata.  You will need to recreate your cluster setup yourself after
 you run 'rethinkdb-restore'.
Exporting to directory...
[========================================] 100%
155 rows exported from 1 table, with 0 secondary indexes
  Done (0 seconds)
Zipping export directory...
  Done (0 seconds)


└── stf
    └── usageRecord.json

1 directory, 2 files


rethinkdb import -f usageRecord.json --table stf.usageRecord --force
[========================================] 100%
155 rows imported in 1 table
  Done (0 seconds)
comments powered by Disqus