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

Intermittent Connection Failure #386

Open
chirdeeptomar opened this issue Sep 8, 2022 · 0 comments
Open

Intermittent Connection Failure #386

chirdeeptomar opened this issue Sep 8, 2022 · 0 comments

Comments

@chirdeeptomar
Copy link

chirdeeptomar commented Sep 8, 2022

I am connecting to solr cluster using SolrCloud with Kerberos authentication is enabled. We are getting connection failures every next day after the app is not used overnight.

2022-09-08 16:56:13,754 - kazoo.client - WARNING - Connection dropped: socket connection error: Connection refused

We then decided to open and close connection on every request but something the problem remains.

@contextmanager
def open_connection(collection) -> pysolr.SolrCloud:
    """create Pysolr connection"""
    os.environ["KRB5_CLIENT_KTNAME"] = KEYTAB
    solr: pysolr.SolrCloud = None
    try:
        logger.info("Opening solr connection")
        zookeeper = pysolr.ZooKeeper(ZOOKEEPER_URL)
        kerberos_auth = HTTPKerberosAuth(principal=PRINCIPAL, force_preemptive=True)
        solr = pysolr.SolrCloud(
            zookeeper,
            collection,
            auth=kerberos_auth,
            verify=False,
            search_handler="/select",
        )
        yield solr
    finally:
        if solr:
            logger.info("Closing solr connection")
            solr.get_session().close()

Configuration

  • Operating system version: RHEL 7.3
  • Search engine version: 8.6
  • Python version: 3.6
  • pysolr version: 3.9.0
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

No branches or pull requests

1 participant