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

【记录】Mac本地运行Python脚本把MongoDB数据导入SOLR

Mac crifan 2463浏览 0评论

折腾:

【已解决】Mac本地搭建用Flask绘本查询推荐系统后台

后,此时之前同事已经实现了基本的搜索功能,现在要去合并到本地项目中。

所以先要去运行其处理数据的脚本,把数据从MongoDB导入到SOLR中。

先去安装新增的库:

➜  xx git:(master) ✗ cat Pipfile

[[source]]

#url = "https://pypi.python.org/simple"

url = "https://pypi.tuna.tsinghua.edu.cn/simple"

verify_ssl = true

name = "pypi"

[packages]

flask = "*"

flask-restful = "*"

flask-pymongo = "*"

gunicorn = "*"

flask-cors = "*"

python-dotenv = "*"

gevent = "*"

greenlet = "*"

solrclient = "*"

tqdm = "*"

[dev-packages]

[requires]

python_version = "3.6"

[pipenv]

allow_prereleases = true

➜  x git:(master) ✗ pipenv install

Pipfile.lock (28e8c6) out of date, updating to (d76c9e)…

Locking [dev-packages] dependencies…

Locking [packages] dependencies…

Updated Pipfile.lock (d76c9e)!

Installing dependencies from Pipfile.lock (d76c9e)…

  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 25/25 — 00:00:06

To activate this project’s virtualenv, run pipenv shell.

Alternatively, run a command inside the virtualenv with pipenv run.

然后再去运行本地solr的server

然后才能运行脚本导入数据

参考:

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

然后再去创建solr的collection:

先看看本地情况:

➜  x git:(master) ✗ which solr

/usr/local/bin/solr

➜  x git:(master) ✗ solr status

Found 1 Solr nodes:

Solr process 12925 from /usr/local/Cellar/solr/7.2.1/bin/solr-8983.pid not found.

然后遇到:

【已解决】Mac本地创建solr的collection出错:Failed to determine the port of a local Solr instance, cannot create

然后继续操作:

去运行脚本,很快就导入了数据了:

然后就可以正常调试了:

转载请注明:在路上 » 【记录】Mac本地运行Python脚本把MongoDB数据导入SOLR

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.550 seconds, using 22.14MB memory