Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the solr zk invocation #756

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

elangelo
Copy link
Contributor

@elangelo elangelo commented Feb 6, 2025

Apparently if you invoke solr zk you need to pass in the --zk-host argument as it will not read the environment variable ZK_HOST.

Copy link

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM.

@gerlowskija
Copy link
Contributor

Hi @elangelo - what Solr version are you running? And are there any particular steps needed to reproduce the issue?

I tried playing with this a bit this morning but haven't been able to reproduce on the versions I tried (9.7.0 and the unreleased 10.0):

# Try without a ZK_HOST initially
$ bin/solr zk cp foo.json zk:/foo.json  
Neither --zk-host or --solr-url parameters provided so assuming solr url is http://localhost:8983.

ERROR: Server refused connection at: http://localhost:8983/solr/admin/info/system
...
# With ZK_HOST value
$ export ZK_HOST=localhost:9765
$ bin/solr zk cp foo.json zk:/foo.json
Copying from 'foo.json' to 'zk:/foo.json'. ZooKeeper at localhost:9765

@elangelo
Copy link
Contributor Author

I was doing this with solr 9.8.0 and solr-operator 0.8
When ZK_HOST is set (which is default in the init container) I always get that error message:
Neither --zk-host or --solr-url parameters provided so assuming solr url is http://localhost:8983
that obviously fails as i'm running this on kubernetes.

@epugh
Copy link

epugh commented Feb 12, 2025

just a bit of poking, and i don't think we look up from env var the ZK_HOST:

https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/cli/CLIUtils.java#L223

eventually, we do have a look up for a Solr URL, but it doesn't use ZK_HOST, instead it uses these processes:

https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/cli/CLIUtils.java#L71

@epugh
Copy link

epugh commented Feb 12, 2025

personally, when it comes to invoking the SolrCLI, I like the verbosity of passing in all the args, so there is less magic. I actually don't love that we look up from env vars the solr url!

@gerlowskija
Copy link
Contributor

gerlowskija commented Feb 16, 2025

@epugh - I believe what you're saying about ZK_HOST not being obeyed by bin/solr the way we thought, but I'm not sure how to square that with what I saw in my quick repro attempt above. It looked very much to me like having a "ZK_HOST" set was impacting things, even if we can't find the codepath by which that happens. But what am I missing?

personally, when it comes to invoking the SolrCLI, I like the verbosity of passing in all the args, so there is less magic.

I like the env-vars, personally. But if you think that's worth pursuing, a dev@ thread might be the best way to weigh support/consensus there?

I was doing this with solr 9.8.0 and solr-operator 0.8

You're sure your deployment used operator-0.8 @elangelo ? The 0.8 operator used a completely different CLI/client for talking to ZK than this code on 'main' currently uses. (The operator used zkcli.sh in 0.8, vs bin/solr zk in >= 0.9.0).

Will try to do a bit more poking around here this week, but appreciate any clarification in the meantime.

@elangelo
Copy link
Contributor Author

elangelo commented Feb 17, 2025

@gerlowskija you are right of course... I was using solr-operator 0.9. I initially was doing this with 0.8 but that wasn't working as well. I then upgraded to 0.9 and there found it broken too.
I did bring up my own custom initcontainer and confirmed it immediately worked if i added --zk-host to the cli.
I understand we might want a longer term fix than this and obviously I'm good with that, but short term this means that initializing authentication on solr 9.8 and younger is broken? If we need to fix the solr cli tool we would have to backport it?

@HoustonPutman
Copy link
Contributor

Yeah, this will need a bug fix release probably

@HoustonPutman
Copy link
Contributor

We also desperately need integration tests for the basic auth stuff. Our biggest testing gap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants