adnanmuttaleb
adnanmuttaleb

Reputation: 3604

can not create core in solr [ERROR: Solr requires authentication]

when I create solr core:

bin/solr create -c my_core

I get the following error:

ERROR: Solr requires authentication for http://localhost:8983/solr/admin/info/system. Please supply valid credentials. HTTP code=401

even I had logged in into solr admin panel. is there any way to provide my credential info with the create command?

Upvotes: 3

Views: 3117

Answers (3)

Alejandro Hurtado
Alejandro Hurtado

Reputation: 1

in my case in solr 6.5 I did these steps: 1: disable security option in solr, at the end of lines should be sudo nano /opt/solr/server/etc/webdefault.xml

<!-- <security-constraint>
    <web-resource-collection>
      <web-resource-name>Solr authenticated application</web-resource-name>
      <url-pattern>/</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>admin-role</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Test Realm</realm-name>
  </login-config> -->

aftter restart solr

sudo service solr restart

Upvotes: 0

Artur Cichosz
Artur Cichosz

Reputation: 1054

Even if it is an old question. Just for reference in case somebody like me looks for the answer in the future.

In my case of Solr 6 setting the following two environment variables did the job:

export SOLR_AUTH_TYPE='basic'
export SOLR_AUTHENTICATION_OPTS='-Dbasicauth=username:password'

Now I was able to issue 'bin/solr create ...' etc. from the same console session

Upvotes: 4

adnanmuttaleb
adnanmuttaleb

Reputation: 3604

as work around not a solution, I had to delete the security,json file, restart solr, then create the core finally put back the security.json file.

Upvotes: 0

Related Questions