rethinkdb-python
rethinkdb-python copied to clipboard
Python Error: %d format: a number is required, not str
rethinkdb export does not work!
It causes the python driver to crash: ReQL error during 'version check': Could not connect to localhost:28015. Error: %d format: a number is required, not str
the driver seems to be up-to-date:
sudo pip show rethinkdb
---
Name: rethinkdb
Version: 2.3.0
Location: /usr/lib/python2.7/site-packages
Requires:
Running command:
/usr/bin/rethinkdb dump --password '*******' --temp-dir $TEMPDIR --file "$BACKUPDIR/rethinkdb_dump_$(date +'%Y%m%d_%H%M%S').tar.gz"
@fkollmann , issue rethinkdb/rethinkdb#5624 discusses the same error. It was caused by providing an invalid password. Not a very informational error message, but sounds like it'll be fixed in the next version.
The password is correct. I just changed it:
r.db('rethinkdb').table('users').get('admin').update({ password: '*****' })
Hey @fkollmann , the --password option should interactively allow you to input the password, rather than typing the password as an argument to the option. Is this the behavior that you're seeing on your end?
Okay, I found the issue. I use the following command to do the backup:
/usr/bin/rethinkdb dump --password-file /etc/rethinkdb-admin-pwd --temp-dir $TEMPDIR --file "$BACKUPDIR/rethinkdb_dump_$(date +'%Y%m%d_%H%M%S').tar.gz"
This command works, if issued from the shell. But it always fails, if running inside a script.
From shell:
exg-retdb001:~ # /usr/bin/rethinkdb dump --password-file /etc/rethinkdb-admin-pwd --temp-dir $TEMPDIR --file "$BACKUPDIR/rethinkdb_dump_$(date +'%Y%m%d_%H%M%S').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%
10269 rows exported from 20 tables, with 50 secondary indexes
Done (3 seconds)
Zipping export directory...
Done (0 seconds)
from script:
exg-retdb001:~ # backup-rethinkdb.sh
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...
ReQL error during 'version check': Could not connect to localhost:28015. Error: %d format: a number is required, not str
Error: rethinkdb-export failed
Thanks for your research @fkollmann . Sounds like we might have an issue with non-interactive sessions even when the --password-file
option is used instead of --password
. We'll look into it.
@fkollmann I actually can't reproduce this so far. Are you able to share the full backup-rethinkdb.sh script? You can also email it to me: [email protected]
The full backups script:
#!/bin/bash
set -e
BACKUPDIR=/mnt/resource/db_backups
TEMPDIR=/mnt/resource/db_backups_tmp
mkdir -p $BACKUPDIR
mkdir -p $TEMPDIR
# create dump
/usr/bin/rethinkdb dump --password-file /etc/rethinkdb-admin-pwd --temp-dir $TEMPDIR --file "$BACKUPDIR/rethinkdb_dump_$(date +'%Y%m%d_%H%M%S').tar.gz"
# on success, delete old backups
/usr/bin/find $BACKUPDIR -maxdepth 1 -name 'rethinkdb_dump_*' -ctime '+2' -delete
# upload backup
/usr/bin/mozyutil start
I tested the script running in a sudo shell (sudo -i
) on SLES 12 server.
@fkollmann Thanks for sharing your script. It still appears to be working for me. What is the Python version that comes with SLES 12? (python --version
)
exg-retdb001:~ # python --version
Python 2.7.9
exg-retdb001:~ # bash --version
GNU bash, version 4.2.47(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.