我按照说明在Ubuntu 12.04 LTS上安装ckan作为软件包。
我还配置了数据存储扩展。已创建数据库,并且已在/etc/ckan/default/production.ini中配置了默认用户和密码
我的问题是每次我想将数据集上传到DataStore时(使用“上传到DataStore”按钮),首先看来一切正常。但是如果我点击其他地方并再次点击DataStore,我会得到以下红色错误框:
错误:CKAN DataStore响应错误。状态码:409冲突。在: http://xubuntu12ltsckan/api/3/action/datastore_create。 HTTP状态 代码:409响应:{“help”: “http://xubuntu12ltsckan/api/3/action/help_show?name=datastore_create”, “成功”:false,“error”:{“fields”:[“\”2016-01-07 14:35:12错误: 连接到服务器时出错:致命错误:密码...请求的网址: hhttp:// xubuntu12ltsckan / API / 3 /动作/ datastore_create
(第三个网址受损,因为我没有发布超过2个网址的声誉)
/var/log/apache2/datapusher.error.log列出了这些行:
Fri Jan 22 13:38:24 2016] [error] /usr/lib/ckan/datapusher/lib/python2.7/site-packages/sqlalchemy/sql/sqltypes.py:185: SAWarning: Unicode type received non-unicode bind param value '42e50497-2231-4c86-b8db-d...'. (this warning may be suppressed after 10 occurrences)
[Fri Jan 22 13:38:24 2016] [error] (util.ellipses_string(value),))
[Fri Jan 22 13:38:24 2016] [error] Fetching from: http://xubuntu12ltsckan/dataset/f4f9e859-fa6a-4257-8727-32358b448864/resource/d938a82f-95f7-4abd-b982-b32174dfa584/download/pgadmin.log
[Fri Jan 22 13:38:24 2016] [error] Deleting "d938a82f-95f7-4abd-b982-b32174dfa584" from datastore.
[Fri Jan 22 13:38:24 2016] [error] Determined headers and types: [{'type': u'text', 'id': u'2016-01-07 14:35:12 ERROR : Error connecting to the server: FATAL: password authentication failed for user "postgres"'}]
[Fri Jan 22 13:38:24 2016] [error] Saving chunk 0
[Fri Jan 22 13:38:24 2016] [error] Job "push_to_datastore (trigger: RunTriggerNow, run = True, next run at: None)" raised an exception
[Fri Jan 22 13:38:24 2016] [error] Traceback (most recent call last):
[Fri Jan 22 13:38:24 2016] [error] File "/usr/lib/ckan/datapusher/lib/python2.7/site-packages/apscheduler/scheduler.py", line 512, in _run_job
[Fri Jan 22 13:38:24 2016] [error] retval = job.func(*job.args, **job.kwargs)
[Fri Jan 22 13:38:24 2016] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 387, in push_to_datastore
[Fri Jan 22 13:38:24 2016] [error] records, api_key, ckan_url)
[Fri Jan 22 13:38:24 2016] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 203, in send_resource_to_datastore
[Fri Jan 22 13:38:24 2016] [error] check_response(r, url, 'CKAN DataStore')
[Fri Jan 22 13:38:24 2016] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 137, in check_response
[Fri Jan 22 13:38:24 2016] [error] request_url=request_url, response=response.text)
[Fri Jan 22 13:38:24 2016] [error] HTTPError
所以我的问题是由于某些原因我不知道ckan尝试用postgres用户连接到postgres数据库。
我的production.ini看起来像这样:
## Database Settings
sqlalchemy.url = postgresql://ckan_default:xxx@localhost/ckan_default
ckan.datastore.write_url = postgresql://ckan_default:xxx@localhost/datastore_default
ckan.datastore.read_url = postgresql://datastore_default:xxx@localhost/datastore_default
此文件中没有对默认数据库管理员用户的引用。角色“ckan_default”具有CREATE / TEMP / CONNECT权限,“datastore_default”具有对datastore_default数据库的CONNECT权限。
我在这里看不到任何访问限制。有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
我会验证你正在查看的production.ini文件是CKAN真正加载的文件。看看/etc/ckan/default/apache.wsgi
并确保您拥有:
config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'production.ini')
如果主机不在生产环境中,您还可以在production.ini(或development.ini)中设置debug = true
,这会在发生此类错误时为您提供有用的调试界面。它允许您检查堆栈上不同级别的变量。它非常有用,只是不要在世界上可访问的机器上启用调试。