按照"安装ckan on centos 7"教程并做了一些修改(比如使用postgres密码替换传递并用我自己的ip替换域名),我已经启动并运行了postgresql和solr(开始使用tomcat,在端口8080上)。
在development.ini中,我指定了solr_url = http://127.0.0.1:8080/solr/ckan-schema-2.3,我认为应该没问题。
curl http://127.0.0.1:8080/solr/
Response:
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico"></link>
<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
<title>Welcome to Solr</title>
</head>
<body>
<h1>Welcome to Solr!</h1>
<a href="."><img border="0" align="right" height="78" width="142" src="admin/solr_small.png" alt="Solr"/></a>
<a href="ckan-schema-2.3/admin/">Admin ckan-schema-2.3</a><br/>
<a href="ckan-schema-1.4/admin/">Admin ckan-schema-1.4</a><br/>
</body>
</html>
curl -s 'http://127.0.0.1:8080/solr/admin/cores?wt=json&indent=true'
{
"responseHeader":{
"status":0,
"QTime":6},
"status":{
"ckan-schema-2.3":{
"name":"ckan-schema-2.3",
"instanceDir":"/usr/share/solr/core0/",
"dataDir":"/var/lib/solr/data/core0/",
"startTime":"2017-10-12T02:13:14.678Z",
"uptime":129083472,
"index":{
"numDocs":0,
"maxDoc":0,
"version":1507774394724,
"optimized":false,
"current":true,
"hasDeletions":false,
"directory":"org.apache.lucene.store.NIOFSDirectory:org.apache.lucene.store.NIOFSDirectory@/var/lib/solr/data/core0/index",
"lastModified":"2017-10-12T02:13:14Z"}},
"ckan-schema-1.4":{
"name":"ckan-schema-1.4",
"instanceDir":"/usr/share/solr/core1/",
"dataDir":"/var/lib/solr/data/core1/",
"startTime":"2017-10-12T02:13:15.599Z",
"uptime":129082552,
"index":{
"numDocs":0,
"maxDoc":0,
"version":1507774395601,
"optimized":false,
"current":true,
"hasDeletions":false,
"directory":"org.apache.lucene.store.NIOFSDirectory:org.apache.lucene.store.NIOFSDirectory@/var/lib/solr/data/core1/index",
"lastModified":"2017-10-12T02:13:15Z"}}}}
curl -s 'http://127.0.0.1:8080/solr/ckan-schema-2.3/admin/ping?wt=json&indent=true'
{
"responseHeader":{
"status":0,
"QTime":8,
"params":{
"echoParams":"all",
"q":"solrpingquery",
"qt":"standard",
"echoParams":"all",
"wt":"json",
"indent":"true"}},
"status":"OK"}
但是,当我在远程浏览器和localhost中访问CKAN时,我收到内部服务器错误(500)。
在检查了ckan.error.log之后,我发现了以下错误消息,我认为这可能是CKAN(2.4.1)和Solr(1.4.1)之间的连接问题。
我所遵循的教程的链接:https://github.com/ckan/ckan/wiki/How-to-install-CKAN-2.x-on-CentOS-7
[Thu Oct 12 02:42:57.185548 2017] [:error] [pid 2438] 2017-10-12 02:42:57,184 ERROR [ckan.lib.search.common] [Errno 13] Permission denied
[Thu Oct 12 02:42:57.185581 2017] [:error] [pid 2438] Traceback (most recent call last):
[Thu Oct 12 02:42:57.185584 2017] [:error] [pid 2438] File "/usr/lib/ckan/default/src/ckan/ckan/lib/search/common.py", line 51, in is_available
[Thu Oct 12 02:42:57.185586 2017] [:error] [pid 2438] conn.query("*:*", rows=1)
[Thu Oct 12 02:42:57.185588 2017] [:error] [pid 2438] File "/usr/lib/ckan/default/lib/python2.7/site-packages/solr/core.py", line 703, in query
[Thu Oct 12 02:42:57.185590 2017] [:error] [pid 2438] return self.select(*args, **params)
[Thu Oct 12 02:42:57.185592 2017] [:error] [pid 2438] File "/usr/lib/ckan/default/lib/python2.7/site-packages/solr/core.py", line 798, in __call__
[Thu Oct 12 02:42:57.185594 2017] [:error] [pid 2438] xml = self.raw(**params)
[Thu Oct 12 02:42:57.185596 2017] [:error] [pid 2438] File "/usr/lib/ckan/default/lib/python2.7/site-packages/solr/core.py", line 823, in raw
[Thu Oct 12 02:42:57.185598 2017] [:error] [pid 2438] rsp = conn._post(self.selector, request, conn.form_headers)
[Thu Oct 12 02:42:57.185600 2017] [:error] [pid 2438] File "/usr/lib/ckan/default/lib/python2.7/site-packages/solr/core.py", line 646, in _post
[Thu Oct 12 02:42:57.185602 2017] [:error] [pid 2438] self._reconnect()
[Thu Oct 12 02:42:57.185603 2017] [:error] [pid 2438] File "/usr/lib/ckan/default/lib/python2.7/site-packages/solr/core.py", line 625, in _reconnect
[Thu Oct 12 02:42:57.185605 2017] [:error] [pid 2438] self.conn.connect()
[Thu Oct 12 02:42:57.185607 2017] [:error] [pid 2438] File "/usr/lib64/python2.7/httplib.py", line 807, in connect
[Thu Oct 12 02:42:57.185609 2017] [:error] [pid 2438] self.timeout, self.source_address)
[Thu Oct 12 02:42:57.185610 2017] [:error] [pid 2438] File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
[Thu Oct 12 02:42:57.185612 2017] [:error] [pid 2438] raise err
[Thu Oct 12 02:42:57.185614 2017] [:error] [pid 2438] error: [Errno 13] Permission denied
[Thu Oct 12 02:42:57.185715 2017] [:error] [pid 2438] 2017-10-12 02:42:57,185 WARNI [ckan.lib.search] Problems were found while connecting to the SOLR server
[Thu Oct 12 02:42:57.222342 2017] [:error] [pid 2438] [remote 100.36.143.168:224] mod_wsgi (pid=2438): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
[Thu Oct 12 02:42:57.222360 2017] [:error] [pid 2438] [remote 100.36.143.168:224] mod_wsgi (pid=2438): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
[Thu Oct 12 02:42:57.222381 2017] [:error] [pid 2438] [remote 100.36.143.168:224] Traceback (most recent call last):
[Thu Oct 12 02:42:57.222396 2017] [:error] [pid 2438] [remote 100.36.143.168:224] File "/etc/ckan/default/apache.wsgi", line 9, in <module>
[Thu Oct 12 02:42:57.222449 2017] [:error] [pid 2438] [remote 100.36.143.168:224] application = loadapp('config:%s' % config_filepath)
答案 0 :(得分:0)
是的,此错误消息是关键消息:
Problems were found while connecting to the SOLR server
那些CKAN Centos安装说明配置CKAN:
solr_url=http://127.0.0.1:8080/solr/ckan-schema-2.3
当CKAN尝试使用该URL运行SOLR查询时,它失败了。具体来说,它无法连接到127.0.0.1:8080,这通常意味着什么都没有正在侦听,即可能SOLR没有运行。所以这听起来像是一个纯粹的SOLR问题,而不是CKAN问题。
首先检查SOLR是否正在运行并在其主管理界面上进行响应:
curl http://127.0.0.1:8080/solr/
现在检查CKAN所需的SOLR核心是否已配置:
curl -s 'http://127.0.0.1:8080/solr/admin/cores?wt=json&indent=true'
CKAN SOLR核心如下所示:
"ckan":{
"name":"ckan",
"instanceDir":"/etc/solr/ckan/",
"dataDir":"/var/lib/solr/data/",
"startTime":"2017-10-13T10:32:01.3Z",
"uptime":1805340,
"index":{
"numDocs":50,
"maxDoc":52,
"version":1490867603581,
"segmentCount":9,
"current":true,
"hasDeletions":true,
"directory":"org.apache.lucene.store.MMapDirectory:org.apache.lucene.store.MMapDirectory@/var/lib/solr/data/index lockFactory=org.apache.lucene.store.NativeFSLockFactory@4b3e213f",
"lastModified":"2017-10-13T10:44:47Z"}}
Centos安装指南为您提供了两个内核,但您只需要后一个内核 - 忽略旧的schema-1.4。检查schema-2.3的名称(核心的前2行)是否设置为:ckan-schema-2.3
,根据solr_url
中的最后一位(我刚刚ckan
上面的例子,这是默认的。)
您可以像这样检查SOLR核心的状态:
curl -s 'http://127.0.0.1:8983/solr/ckan-schema-2.3/admin/ping?wt=json&indent=true'
检查结束时为:"status":"OK"
答案 1 :(得分:0)
这可能是创建套接字连接的权限问题。这可能与SELinux有关。查看是否已启用SELinux强制执行:
getenforce
如果是,您需要阅读套接字的权限。