2016-01-22 53 views
0

我按照說明在Ubuntu 12.04 LTS上安裝ckan作爲軟件包。無法上傳到ckan 2.5.1中的數據存儲:使用postgres用戶而不是配置一個

我還配置了數據存儲擴展。數據庫已創建,默認用戶和密碼已在/etc/ckan/default/production.ini配置

我的問題是,每次我想上傳一個數據集到DataStore(使用按鈕「上傳到DataStore「),它似乎一切正常。但是,如果我點擊別的地方,然後再次單擊數據存儲中我碰到下面的紅色錯誤框:

Error: CKAN DataStore bad response. Status code: 409 Conflict. At: http://xubuntu12ltsckan/api/3/action/datastore_create . HTTP status code: 409 Response: {"help": " http://xubuntu12ltsckan/api/3/action/help_show?name=datastore_create ", "success": false, "error": {"fields": ["\"2016-01-07 14:35:12 ERROR : Error connecting to the server: FATAL: password... Requested URL: hhttp://xubuntu12ltsckan/api/3/action/datastore_create

(三URL錯位的,因爲我沒有名聲後超過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:[email protected]/ckan_default 

ckan.datastore.write_url = postgresql://ckan_default:[email protected]/datastore_default 
ckan.datastore.read_url = postgresql://datastore_default:[email protected]/datastore_default 

還有就是在這個文件中的默認數據庫管理員用戶沒有提及。 「ckan_default」角色具有CREATE/TEMP/CONNECT權限,「datastore_default」具有datastore_default數據庫上的CONNECT權限。

我在這裏看不到任何訪問限制。有人可以幫我解決這個問題嗎?

回答

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設置debug = true(或development.ini),它爲您提供了一個有用的調試當發生這樣的錯誤時發生界面。它允許您檢查棧上不同層次的變量。這非常有用,只是不要在世界上可用的機器上啓用調試。

相關問題