Error when creating collection

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error when creating collection

Mark Olsen
Solr version: 4.2.1

I'm creating a collection via Java using this function call:

String collection = "profile-2";
CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create();
createRequest.setCoreName(collection);
createRequest.setCollection(collection);
createRequest.setInstanceDir(collection);
createRequest.setNumShards(1);
createRequest.process(server);

It is timing out with this exception (from the solr.out logs):

SEVERE: org.apache.solr.common.SolrException: Error CREATEing SolrCore 'profile-2': Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
at org.apache.solr.handler.admin.CoreAdminHandler.handleCreateAction(CoreAdminHandler.java:483)
at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:140)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:591)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:192)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
...
Caused by: org.apache.solr.common.SolrException: Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
at org.apache.solr.cloud.ZkController.doGetShardIdProcess(ZkController.java:1221)
at org.apache.solr.cloud.ZkController.preRegister(ZkController.java:1290)
at org.apache.solr.core.CoreContainer.registerCore(CoreContainer.java:861)

In a "development" environment the zookeeper/solr instances are running with elevated permissions and this function worked without error.
In a "test" environment (which matches the "production" environment) the permissions are more restricted. I made sure the group/owner of the /usr/local/solr directory are set up to be the correct user.


Any insight into potential file permissions that I may be overlooking?


Thank you,
Mark

Reply | Threaded
Open this post in threaded view
|

Re: Error when creating collection

Shawn Heisey-4
On 5/13/2014 4:39 PM, Mark Olsen wrote:

> I'm creating a collection via Java using this function call:
>
> String collection = "profile-2";
> CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create();
> createRequest.setCoreName(collection);
> createRequest.setCollection(collection);
> createRequest.setInstanceDir(collection);
> createRequest.setNumShards(1);
> createRequest.process(server);
>
> It is timing out with this exception (from the solr.out logs):
>
> SEVERE: org.apache.solr.common.SolrException: Error CREATEing SolrCore 'profile-2': Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
> at org.apache.solr.handler.admin.CoreAdminHandler.handleCreateAction(CoreAdminHandler.java:483)
> at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:140)
> at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
> at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:591)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:192)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
> ...
> Caused by: org.apache.solr.common.SolrException: Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
> at org.apache.solr.cloud.ZkController.doGetShardIdProcess(ZkController.java:1221)
> at org.apache.solr.cloud.ZkController.preRegister(ZkController.java:1290)
> at org.apache.solr.core.CoreContainer.registerCore(CoreContainer.java:861)
>
> In a "development" environment the zookeeper/solr instances are running with elevated permissions and this function worked without error.
> In a "test" environment (which matches the "production" environment) the permissions are more restricted. I made sure the group/owner of the /usr/local/solr directory are set up to be the correct user.

This is happening because you never set the shard ID.  See the "Caused
by" message above.  There is a setShardID method on the class that you
are using.  I believe this would typically get something like "shard1"
as a value.

The user that runs Solr must typically have write permissions to the
solr home and all of its descendants.

Note that with the CoreAdminRequest class, you are not creating a
collection.  You are creating a core.  If you want to create an entire
collection (which will typically create at least two cores on different
Solr instances), you need to use CollectionAdminRequest instead.

https://lucene.apache.org/solr/4_8_0/solr-solrj/org/apache/solr/client/solrj/request/CollectionAdminRequest.Create.html

http://wiki.apache.org/solr/SolrTerminology

Thanks,
Shawn

Reply | Threaded
Open this post in threaded view
|

Re: Error when creating collection

Mark Olsen
Shawn,

I set a shard ID however am still getting the same issue. The logs on the solr server are reporting the following:

The request is being performed on 192.168.1.155 and it is timing out when contacting another server in the zookeeper group (192.168.1.152). There are no firewall rules in place and I am able to lynx from 192.168.1.155 to 192.168.1.152 on that port.

SEVERE: Error while trying to recover. core=collection1:org.apache.solr.client.solrj.SolrServerException: Timeout occured while waiting response from server at: http://192.168.1.152:8983/solr
        at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:412)
        at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
        at org.apache.solr.cloud.RecoveryStrategy.sendPrepRecoveryCmd(RecoveryStrategy.java:202)
        at org.apache.solr.cloud.RecoveryStrategy.doRecovery(RecoveryStrategy.java:346)
        at org.apache.solr.cloud.RecoveryStrategy.run(RecoveryStrategy.java:223)
Caused by: java.net.SocketTimeoutException: Read timed out

Thanks,
Mark


----- Original Message -----
From: "Shawn Heisey" <[hidden email]>
To: [hidden email]
Sent: Wednesday, May 14, 2014 12:43:00 PM
Subject: Re: Error when creating collection

On 5/13/2014 4:39 PM, Mark Olsen wrote:

> I'm creating a collection via Java using this function call:
>
> String collection = "profile-2";
> CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create();
> createRequest.setCoreName(collection);
> createRequest.setCollection(collection);
> createRequest.setInstanceDir(collection);
> createRequest.setNumShards(1);
> createRequest.process(server);
>
> It is timing out with this exception (from the solr.out logs):
>
> SEVERE: org.apache.solr.common.SolrException: Error CREATEing SolrCore 'profile-2': Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
> at org.apache.solr.handler.admin.CoreAdminHandler.handleCreateAction(CoreAdminHandler.java:483)
> at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:140)
> at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
> at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:591)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:192)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
> ...
> Caused by: org.apache.solr.common.SolrException: Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
> at org.apache.solr.cloud.ZkController.doGetShardIdProcess(ZkController.java:1221)
> at org.apache.solr.cloud.ZkController.preRegister(ZkController.java:1290)
> at org.apache.solr.core.CoreContainer.registerCore(CoreContainer.java:861)
>
> In a "development" environment the zookeeper/solr instances are running with elevated permissions and this function worked without error.
> In a "test" environment (which matches the "production" environment) the permissions are more restricted. I made sure the group/owner of the /usr/local/solr directory are set up to be the correct user.

This is happening because you never set the shard ID.  See the "Caused
by" message above.  There is a setShardID method on the class that you
are using.  I believe this would typically get something like "shard1"
as a value.

The user that runs Solr must typically have write permissions to the
solr home and all of its descendants.

Note that with the CoreAdminRequest class, you are not creating a
collection.  You are creating a core.  If you want to create an entire
collection (which will typically create at least two cores on different
Solr instances), you need to use CollectionAdminRequest instead.

https://lucene.apache.org/solr/4_8_0/solr-solrj/org/apache/solr/client/solrj/request/CollectionAdminRequest.Create.html

http://wiki.apache.org/solr/SolrTerminology

Thanks,
Shawn

Reply | Threaded
Open this post in threaded view
|

Re: Error when creating collection

Mark Olsen
Looking on the logs of the other server, I see this:

SEVERE: org.apache.solr.common.SolrException: I was asked to wait on state recovering for 192.168.1.155:8983_solr but I still do not see the requested state. I see state: active live:true
   at org.apache.solr.handler.admin.CoreAdminHandler.handleWaitForStateAction(CoreAdminHandler.java:890)
   at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:186)
   at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
   at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:591)
   at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:192)
   at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)


----- Original Message -----
From: "Mark Olsen" <[hidden email]>
To: [hidden email]
Sent: Monday, May 19, 2014 3:54:30 PM
Subject: Re: Error when creating collection

Shawn,

I set a shard ID however am still getting the same issue. The logs on the solr server are reporting the following:

The request is being performed on 192.168.1.155 and it is timing out when contacting another server in the zookeeper group (192.168.1.152). There are no firewall rules in place and I am able to lynx from 192.168.1.155 to 192.168.1.152 on that port.

SEVERE: Error while trying to recover. core=collection1:org.apache.solr.client.solrj.SolrServerException: Timeout occured while waiting response from server at: http://192.168.1.152:8983/solr
        at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:412)
        at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
        at org.apache.solr.cloud.RecoveryStrategy.sendPrepRecoveryCmd(RecoveryStrategy.java:202)
        at org.apache.solr.cloud.RecoveryStrategy.doRecovery(RecoveryStrategy.java:346)
        at org.apache.solr.cloud.RecoveryStrategy.run(RecoveryStrategy.java:223)
Caused by: java.net.SocketTimeoutException: Read timed out

Thanks,
Mark


----- Original Message -----
From: "Shawn Heisey" <[hidden email]>
To: [hidden email]
Sent: Wednesday, May 14, 2014 12:43:00 PM
Subject: Re: Error when creating collection

On 5/13/2014 4:39 PM, Mark Olsen wrote:

> I'm creating a collection via Java using this function call:
>
> String collection = "profile-2";
> CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create();
> createRequest.setCoreName(collection);
> createRequest.setCollection(collection);
> createRequest.setInstanceDir(collection);
> createRequest.setNumShards(1);
> createRequest.process(server);
>
> It is timing out with this exception (from the solr.out logs):
>
> SEVERE: org.apache.solr.common.SolrException: Error CREATEing SolrCore 'profile-2': Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
> at org.apache.solr.handler.admin.CoreAdminHandler.handleCreateAction(CoreAdminHandler.java:483)
> at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:140)
> at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
> at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:591)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:192)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
> ...
> Caused by: org.apache.solr.common.SolrException: Could not get shard_id for core: profile-2 coreNodeName:192.168.1.152:8983_solr_profile-2
> at org.apache.solr.cloud.ZkController.doGetShardIdProcess(ZkController.java:1221)
> at org.apache.solr.cloud.ZkController.preRegister(ZkController.java:1290)
> at org.apache.solr.core.CoreContainer.registerCore(CoreContainer.java:861)
>
> In a "development" environment the zookeeper/solr instances are running with elevated permissions and this function worked without error.
> In a "test" environment (which matches the "production" environment) the permissions are more restricted. I made sure the group/owner of the /usr/local/solr directory are set up to be the correct user.

This is happening because you never set the shard ID.  See the "Caused
by" message above.  There is a setShardID method on the class that you
are using.  I believe this would typically get something like "shard1"
as a value.

The user that runs Solr must typically have write permissions to the
solr home and all of its descendants.

Note that with the CoreAdminRequest class, you are not creating a
collection.  You are creating a core.  If you want to create an entire
collection (which will typically create at least two cores on different
Solr instances), you need to use CollectionAdminRequest instead.

https://lucene.apache.org/solr/4_8_0/solr-solrj/org/apache/solr/client/solrj/request/CollectionAdminRequest.Create.html

http://wiki.apache.org/solr/SolrTerminology

Thanks,
Shawn