我已经尝试过多次尝试将CKAN数据库加载到另一台主机中的另一个CKAN实例。
我的工作流程如下:
paster db dump -c /etc/ckan/ckan_p_instance/production.ini instance_p_db_dump.sql
. /usr/lib/ckan/ckan_t_instance/bin/activate
paster db clean -c /etc/ckan/spatial_hub/development.ini
paster db load -c /etc/ckan/spatial_hub/development.ini ~/instance_p_db_dump.sql
/bin/sh: 1: Syntax error: "&&" unexpected
Traceback (most recent call last):
File "/usr/lib/ckan/spatial_hub/bin/paster", line 11, in <module>
sys.exit(run())
File "/usr/lib/ckan/spatial_hub/local/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/spatial_hub/local/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/spatial_hub/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
result = self.command()
File "/usr/lib/ckan/spatial_hub/src/ckan/ckan/lib/cli.py", line 238, in command
self.load()
File "/usr/lib/ckan/spatial_hub/src/ckan/ckan/lib/cli.py", line 315, in load
pg_cmd = self._postgres_load(dump_path)
File "/usr/lib/ckan/spatial_hub/src/ckan/ckan/lib/cli.py", line 290, in _postgres_load
self._run_cmd(pg_cmd)
File "/usr/lib/ckan/spatial_hub/src/ckan/ckan/lib/cli.py", line 297, in _run_cmd
raise SystemError('Command exited with errorcode: %i' % retcode)
SystemError: Command exited with errorcode: 2
我不确定如何解释上述错误,因此非常感谢任何帮助。
答案 0 :(得分:4)
看起来您正在遇到a known bug,其中密码中的特殊字符未被正确转义。由于此原因和其他原因,将不推荐使用paster db dump
和load
命令。官方的建议是使用PostgreSQL自己的工具(例如pg_dump
和pg_restore
)与paster db upgrade
(将被保留)相结合。
作为短期解决方法,请确保您的密码不包含shell特有的字符。
更新:CKAN文档已更新,其中包含有关how to dump and load the CKAN database using pg_dump
and pg_restore
的信息。