mac 安装 solr
在终端输入:
brew install solr
就直接安装了,但是不巧的是我的 mac 上没有安装 Homebrew 所以这个命令就不能使用
接下来就 安装Homebrew
安装Homebrew其实也非常的简单
打开终端,输入以下命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
注意:
因网络的原因,可能会不成功,请多尝试几次,一直到成功安装.
中间会出现一个 Press RETURN to continue or any other key to abort,请及时回车,不要傻等着…
不要加 sudo, 加了也没关系,待会会提示你 Don’t run as root
如果出现了某个包导致的安装失败,你仅需要按照提示进行操作即可
Homebrew成功安装之后就可以使用上面的命令安装 solr 了
安装成功之后我们启动它:
solr start
当出现下面这句话的时候说明 solr 已经启动成功了
Waiting up to 180 seconds to see Solr running on port 8983 [\] Started Solr server on port 8983 (pid=2965). Happy searching!
solr 的默认端口是8983
,我们在浏览器中输入 http://localhost:8983/solr/
即可看到下面的页面
接下来咱们创建一个 名为 test 的 core
solr create -c test
返回以下信息,则表示创建成功:
Copying configuration to new core instance directory:
/usr/local/Cellar/solr/6.1.0/server/solr/test
Creating new core 'test' using command:
http://localhost:8983/solr/admin/cores?action=CREATE&name=test&instanceDir=test
{
"responseHeader":{
"status":0,
"QTime":8845},
"core":"test"}
这一命令会在/usr/local/Cellar/solr/6.1.0/server/solr/
目录下创建一个命令test/
的目录,test/
目录中包含了test core
相关的数据文件和配置文件。
在Solr Admin管理界面可以看到test core
的信息:
写在最后
原理和案例详解: https://github.com/haoxiaoyong1014/springboot-lucene-solr