最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Mac中安装Solr的server并启动Solr服务

Mac crifan 3669浏览 0评论

折腾:

【已解决】Python中solr出错:SolrClient.exceptions.ConnectionError NewConnectionError Failed to establish a new connection Errno 61 Connection refused

期间,感觉像是:

后台没有运行Solr的服务,所以solr的client运行才出错,连不上server。

所以需要在此处的Mac本地中安装Slor的server并运行。

solr server mac

Installing Solr | Apache Solr Reference Guide 6.6

Installing Solr | Apache Solr Reference Guide 7.1

好像直接安装即可,然后运行bin即可。不需要用brew?

macos – How install Solr on mac using homebrew? – Stack Overflow

用brew安装试试:

➜  ~ brew install solr

==> Downloading https://www.apache.org/dyn/closer.cgi?path=lucene/solr/7.2.1/solr-7.2.1.tgz

==> Best Mirror http://mirrors.hust.edu.cn/apache/lucene/solr/7.2.1/solr-7.2.1.tgz

curl: (22) The requested URL returned error: 404 Not Found

Trying a mirror…

==> Downloading https://archive.apache.org/dist/lucene/solr/7.2.1/solr-7.2.1.tgz

######################################################################## 100.0%

==> Caveats

To have launchd start solr now and restart at login:

  brew services start solr

Or, if you don’t want/need a background service you can just run:

  solr start

==> Summary

🍺  /usr/local/Cellar/solr/7.2.1: 1,521 files, 165.8MB, built in 2 minutes 1 second

solr的在mac上的安装配置以及同步mysql数据 – CSDN博客

Step 1. Installing Solr 4.5 – Home

Running SOLR on a Mac | Chris Brew’s Blog

Installing Apache Solr for Drupal on Mac OSX

然后去运行:

➜  ~ solr start &

[1] 83779

➜  ~ solWaiting up to 180 seconds to see Solr running on port 8983r   [-]

ERROR: s is not a valid command!

Usage: solr COMMAND OPTIONS

       where COMMAND is one of: start, stop, restart, status, healthcheck, create, create_core, create_collection, delete, version, zk, auth, assert

  Standalone server example (start Solr running in the background on port 8984):

    ./solr start -p 8984

  SolrCloud example (start Solr running in SolrCloud mode using localhost:2181 to connect to Zookeeper, with 1g max heap size and remote Java debug options enabled):

    ./solr start -c -m 1g -z localhost:2181 -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044"

Pass -help after any COMMAND to see command-specific usage information,

  such as:    ./solr start -help or ./solr stop -help

[/]

Started Solr server on port 8983 (pid=83817). Happy searching!

[1]  + 83779 done       solr start

➜  ~

然后再去看看状态:

➜  ~ which solr

/usr/local/bin/solr

➜  ~ solr –help

Usage: solr COMMAND OPTIONS

       where COMMAND is one of: start, stop, restart, status, healthcheck, create, create_core, create_collection, delete, version, zk, auth, assert

  Standalone server example (start Solr running in the background on port 8984):

    ./solr start -p 8984

  SolrCloud example (start Solr running in SolrCloud mode using localhost:2181 to connect to Zookeeper, with 1g max heap size and remote Java debug options enabled):

    ./solr start -c -m 1g -z localhost:2181 -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044"

Pass -help after any COMMAND to see command-specific usage information,

  such as:    ./solr start -help or ./solr stop -help

➜  ~ solr status

Found 1 Solr nodes:

Solr process 83817 running on port 8983

{

  "solr_home":"/usr/local/Cellar/solr/7.2.1/server/solr",

  "version":"7.2.1 b2b6438b37073bee1fca40374e85bf91aa457c0b – ubuntu – 2018-01-10 00:54:21",

  "startTime":"2018-08-16T06:24:08.798Z",

  "uptime":"0 days, 0 hours, 0 minutes, 43 seconds",

  "memory":"21 MB (%4.3) of 490.7 MB"}

或许这样就可以了?

带后续验证,代码中的:

http://localhost:8983/solr

能否正常连接上solr才知道结果

后来从:

https://lucene.apache.org/solr/guide/7_1/installing-solr.html

看到:

http://localhost:8983/solr/

打开看看:

https://gist.github.com/hlandry/3785269

-》

http://localhost:8983/solr/admin/

还是跳转到:

http://localhost:8983/solr/#/

然后再去运行代码试试,出现类似错误:

【已解决】python的solr运行出错:SolrClient.exceptions.ConnectionError: 404

【总结】

此处正常的新建名为qa的collection,导入数据建立索引,然后就可以正常启动solr,供后续client去访问了。

详见:

【记录】Mac本地Solr中新建qa的collection再运行脚本导入数据

转载请注明:在路上 » 【已解决】Mac中安装Solr的server并启动Solr服务

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.171 seconds, using 22.13MB memory