加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何使用docker-solrs图像扩展机制创建solr核心?

发布时间:2020-12-16 03:41:55 所属栏目:安全 来源:网络整理
导读:我想创建一个solr的docker镜像,在启动时创建一个核心.因此我使用的是针对solr docker容器描述的 docker-entrypoint-initdb.d extension mechanism.文件说 The third way of creating a core at startup is to use the image extension mechanism explained i

我想创建一个solr的docker镜像,在启动时创建一个核心.因此我使用的是针对solr docker容器描述的docker-entrypoint-initdb.d extension mechanism.文件说

The third way of creating a core at startup is to use the image
extension mechanism explained in the next section.

但它并没有解释如何实现这一目标.

我正在使用的Dockerfile是:

FROM solr:6.6

USER root

RUN mkdir /A12Core && chown -R solr:solr /A12Core

COPY --chown=solr:solr ./services-core/search/A12Core /A12Core/
COPY --chown=solr:solr ./create-a12core.sh /docker-entrypoint-initdb.d/

USER solr

RUN chmod -R a+X /A12Core

文件夹A12Core包含核心的solr配置文件.创建核心的脚本create-a12core.sh是:

#!/bin/bash

solr-precreate A12Core /A12Core

/ A12Core目录包含以下文件:

./core.properties
./conf
./conf/update-script.js
./conf/mapping-ISOLatin1Accent.txt
./conf/schema.xml
./conf/spellings.txt
./conf/solrconfig.xml
./conf/currency.xml
./conf/mapping-FoldToASCII.txt
./conf/_schema_analysis_stopwords_english.json
./conf/stopwords.txt
./conf/synonyms.txt
./conf/elevate.xml
./conf/lang
./conf/lang/stopwords_en.txt
./conf/lang/stopwords_de.txt

但是,当使用上面的Dockerfile和脚本启动图像构建时,似乎会创建一个无限循环.输出是:

/opt/docker-solr/scripts/solr-foreground: running /docker-entrypoint-initdb.d/create-a12core.sh
Executing /opt/docker-solr/scripts/solr-precreate A12Core /A12Core
/opt/docker-solr/scripts/solr-precreate: running /docker-entrypoint-initdb.d/create-a12core.sh
Executing /opt/docker-solr/scripts/solr-precreate A12Core /A12Core
/opt/docker-solr/scripts/solr-precreate: running /docker-entrypoint-initdb.d/create-a12core.sh
Executing /opt/docker-solr/scripts/solr-precreate A12Core /A12Core
/opt/docker-solr/scripts/solr-precreate: running /docker-entrypoint-initdb.d/create-a12core.sh
...

如何使用docker-entrypoint-initdb.d扩展机制创建核心?

最佳答案
提供要执行的precreate-core文件位置,因此请编辑create-a12core.sh,如下所示

 #!/bin/bash
 /opt/docker-solr/scripts/precreate-core  A12Core /A12Core

经过测试和工作!!!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读