For my use case, the minimal workaround seems to be to replace that `solr
create_collection` script from create-collection with:
create-collections:
image: solr:8.11.2
environment:
- SOLR_HOST=solr1
- ZK_HOST=solr1:9983
- COLLECTION_NAME=myCollection
command:
- bash
- "-exc"
- |
wait-for-solr.sh --max-attempts 10 --wait-seconds 5 --solr-url
http://$$SOLR_HOST:8983/
solr zk upconfig -n "$${MY_COLLECTION}_conf" -d
"/opt/atlas/$${MY_COLLECTION}/ads/conf"
curl --get -sSf
"http://$$SOLR_HOST:8983/solr/admin/collections?action=CREATE&numShards=1&replicationFactor=1"
\
--data-urlencode "name=$${MY_COLLECTION}" \
--data-urlencode "collection.configName=$${MY_COLLECTION}_conf"
`solr zk upconfig`, unlike `solr create_collection` seems to respect the
`ZK_HOST` env variable.
Normally I would use Configset API but it doesn't allow to use <lib> directives
without enabling authentication and this is not something I want to deal with :)
I might dig into create_collections script late if I find the time.
Best,
Tomasz
> On 5. Feb 2023, at 17:12, Eric Pugh <[email protected]> wrote:
>
> That is a fair point. I’ve been wanting to make embedded zookeeper work as
> well as external zookeeper for a while. And give the bin/solr commands a
> good working over, get them to using the APIs to communicate with Solr
> (instead of working directly), and generally fix those issues.
>
> If you dig into create_collection, please do tag me on any PR’s and I’d love
> to work with you to get it fixed.
>
>> On Feb 5, 2023, at 11:09 AM, Tomasz Elendt <[email protected]> wrote:
>>
>> Yes, but there you run a separate 3 node Zookeeper cluster, similar to the
>> docker-compose file from the gist I linked to. Then you upload configset
>> with Configset API and create a collection with Collections API calls.
>> That's a lot of code and containers (for all these zookeeper instances).
>>
>> I will probably follow this path if I won't find anything simpler. But I
>> wanted to highlight a problem: `solr create_collection` tries to connect to
>> ZK_HOST announced by Solr, and if Solr and ZK run on the same host but `solr
>> create_collection` script runs on another host, then the script tries to
>> connect to the wrong address (localhost) and there seems to be no way to
>> correct it.
>>
>> Best,
>> Tomasz
>>
>>
>>> On 5. Feb 2023, at 16:49, Eric Pugh <[email protected]> wrote:
>>>
>>> https://github.com/querqy/chorus/blob/main/docker-compose.yml
>>> <https://github.com/querqy/chorus/blob/main/docker-compose.yml>
>>> and
>>> https://github.com/querqy/chorus/blob/main/quickstart.sh
>>> <https://github.com/querqy/chorus/blob/main/quickstart.sh>
>>>
>>>
>>>
>>>> On Feb 5, 2023, at 10:47 AM, Tomasz Elendt <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm trying trying to set up a single node Solr cloud cluster in
>>>> docker-compose and create a collection on startup.
>>>>
>>>> Even though I'm using Solr 8.11.2, I'm following "Solr in Docker"
>>>> instructions from Solr 9.1 reference guide.
>>>> (I believe that's fine and there are not many changes between 8 and 9 in
>>>> that regard.)
>>>>
>>>> Since the docker-compose file I'm working on is meant for developers'
>>>> convenience I want to define the absolute minimum setup that gets me what
>>>> I want. For creating collections I'm going with 3rd option of this guide:
>>>> https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html#creating-collections
>>>> Which suggests running `solr create_collection` from a separate container.
>>>>
>>>> This is illustrated by this docker-compose file:
>>>> https://gist.github.com/makuk66/0812f70b77aa92230c203cec41acac64#file-docker-compose-yml-L64-L76
>>>>
>>>> The problems start as soon as I change that setup to a single-node Solr
>>>> cluster (consisting of only solr1 node) with Zookeeper embedded.
>>>> In that case, `create_collection` tries to connect to localhost:9983 (an
>>>> address it gets from solr1 Solr I believe). That address of course is not
>>>> reachable on the create-collection host:
>>>>
>>>>> Connecting to ZooKeeper at localhost:9983 ...
>>>>> INFO - 2023-02-05 15:20:30.865;
>>>>> org.apache.solr.common.cloud.ConnectionManager; Waiting for client to
>>>>> connect to ZooKeeper
>>>>> ERROR: java.util.concurrent.TimeoutException: Could not connect to
>>>>> ZooKeeper localhost:9983 within 15000 ms
>>>>
>>>> Does anyone know if there is a workaround for this problem?
>>>>
>>>> Best,
>>>> Tomasz
>>>
>>> _______________________
>>> Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 |
>>> http://www.opensourceconnections.com
>>> <http://www.opensourceconnections.com/> | My Free/Busy
>>> <http://tinyurl.com/eric-cal>
>>> Co-Author: Apache Solr Enterprise Search Server, 3rd Ed
>>> <https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw>
>>>
>>> This e-mail and all contents, including attachments, is considered to be
>>> Company Confidential unless explicitly stated otherwise, regardless of
>>> whether attachments are marked as such.
>>>
>>
>
> _______________________
> Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 |
> http://www.opensourceconnections.com <http://www.opensourceconnections.com/>
> | My Free/Busy <http://tinyurl.com/eric-cal>
> Co-Author: Apache Solr Enterprise Search Server, 3rd Ed
> <https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw>
>
> This e-mail and all contents, including attachments, is considered to be
> Company Confidential unless explicitly stated otherwise, regardless of
> whether attachments are marked as such.
>