Knife search ... always fails with a Server Error


#1

Hey there. Chef newbie here. I’ve installed chef-server and I have
gotten many things working, but I’m unable to do a search from the
client-side using knife as mentioned in the docs.

[root@chefserver-test1 ~]# chef-solo --version
Chef: 0.9.12
Steve-Webbs-MacBook-Pro:~ swebb$ knife --version
Chef: 0.10.0

Steve-Webbs-MacBook-Pro:~ swebb$ knife node list
cacti-server.gnip.com
chefserver-test1

Steve-Webbs-MacBook-Pro:~ swebb$ knife search node ":"
ERROR: Server returned error for
http://chefserver-test1.gnip.com:4000/search/node?q=%253A&sort=&start=0&rows=20,
retrying 1/5 in 3s
ERROR: Server returned error for
http://chefserver-test1.gnip.com:4000/search/node?q=%253A&sort=&start=0&rows=20,
retrying 2/5 in 8s

I can do searches from the chef-gui and it seems to work. I can re-index
and that seems to work:

Steve-Webbs-MacBook-Pro:~ swebb$ knife index rebuild -y
Chef::ApiClient: success
Chef::DataBag: success
Chef::Node: success
Chef::Role: success

solr is running:

[root@chefserver-test1 ~]# ps auxw | grep solr
root 17007 3.3 1.3 31380 24468 pts/1 Sl 17:02 0:48
/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
/usr/local/rvm/gems/ruby-1.9.2-p180/bin/chef-solr-indexer
root 17215 0.0 0.0 1848 508 pts/1 R+ 17:25 0:00 grep solr
root 18848 0.0 11.6 420088 203236 ? Sl May03 0:19 java
-Xmx256M -Xms256M -Dsolr.data.dir=/var/chef/solr/data
-Dsolr.solr.home=/var/chef/solr -jar /var/chef/solr-jetty/start.jar

However, I’m not using a solr.conf file, so it’s using the defaults for
solr.

Any ideas what’s wrong with my ‘knife search …’ command?

Thanks in advance.

  • Steve Webb


Steve Webb - Senior System Administrator for gnip.com


#2

On Thu, May 12, 2011 at 2:26 PM, Steve Webb swebb@gnip.com wrote:

Hey there. Chef newbie here. I’ve installed chef-server and I have gotten
many things working, but I’m unable to do a search from the client-side
using knife as mentioned in the docs.

[root@chefserver-test1 ~]# chef-solo --version
Chef: 0.9.12

Chef-solo is a separate tool which allows you to run chef cookbooks
locally on a system without a server. Notable to this conversation, it
doesn’t support search. You’ll probably want to look over the
architecture document on the wiki:

http://wiki.opscode.com/display/chef/Architecture

Steve-Webbs-MacBook-Pro:~ swebb$ knife --version
Chef: 0.10.0

It would be interesting what version of the server you are running,
presumably 0.9.12. I would wonder if the 0.10.0 knife is backwards
compatible with that old of a Chef release. I would upgrade the server
to 0.9.16 at least.

Steve-Webbs-MacBook-Pro:~ swebb$ knife search node ":"
ERROR: Server returned error for
http://chefserver-test1.gnip.com:4000/search/node?q=%253A&sort=&start=0&rows=20,
retrying 1/5 in 3s
ERROR: Server returned error for
http://chefserver-test1.gnip.com:4000/search/node?q=%253A&sort=&start=0&rows=20,
retrying 2/5 in 8s

ubuntu@ip-10-32-155-39:~ ps ax | grep solr 5887 ? Sl 0:02 java -Xmx256M -Xms256M -Dsolr.data.dir=/var/cache/chef/solr/data -Dsolr.solr.home=/var/lib/chef/solr -DSTART=/var/lib/chef/solr/solr-jetty/etc/start.config -jar /var/lib/chef/solr/solr-jetty/start.jar 5948 ? S 0:03 ruby /usr/sbin/chef-solr-indexer -d -P /var/run/chef/solr-indexer.pid -c /etc/chef/solr.rb -L /var/log/chef/solr-indexer.log -u chef -g chef 6348 pts/0 S+ 0:00 grep --color=auto solr ubuntu@ip-10-32-155-39:~ chef-server --version
Chef Server (API) Version: 0.9.16

I can confirm that syntax works on a knife 0.9.16 versus chef 0.9.16.
Have you checked the solr logs yet?

Bryan


#3

[root@chefserver-test1 ~]# chef-solo --version
Chef: 0.9.12

Chef-solo is a separate tool which allows you to run chef cookbooks
locally on a system without a server. Notable to this conversation, it
doesn’t support search. You’ll probably want to look over the
architecture document on the wiki:

Yea, I know, sorry. The chef-server is the same version:

[root@chefserver-test1 ~]# chef-server --version
Chef Server (API) Version: 0.9.12

ubuntu@ip-10-32-155-39:~ ps ax | grep solr 5887 ? Sl 0:02 java -Xmx256M -Xms256M -Dsolr.data.dir=/var/cache/chef/solr/data -Dsolr.solr.home=/var/lib/chef/solr -DSTART=/var/lib/chef/solr/solr-jetty/etc/start.config -jar /var/lib/chef/solr/solr-jetty/start.jar 5948 ? S 0:03 ruby /usr/sbin/chef-solr-indexer -d -P /var/run/chef/solr-indexer.pid -c /etc/chef/solr.rb -L /var/log/chef/solr-indexer.log -u chef -g chef 6348 pts/0 S+ 0:00 grep --color=auto solr ubuntu@ip-10-32-155-39:~ chef-server --version
Chef Server (API) Version: 0.9.16

[root@chefserver-test1 ~]# ps auxw | grep solr
root 17007 1.6 1.3 31380 24468 pts/1 Sl 17:02 0:48
/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
/usr/local/rvm/gems/ruby-1.9.2-p180/bin/chef-solr-indexer
root 17484 0.0 0.0 1844 508 pts/1 R+ 17:50 0:00 grep solr
root 18848 0.0 11.6 420088 203236 ? Sl May03 0:19 java
-Xmx256M -Xms256M -Dsolr.data.dir=/var/chef/solr/data
-Dsolr.solr.home=/var/chef/solr -jar /var/chef/solr-jetty/start.jar

I can confirm that syntax works on a knife 0.9.16 versus chef 0.9.16.
Have you checked the solr logs yet?

I don’t see any logs in /var/chef/solr/ or in /var/log/
In /var/chef/solr-jetty/logs I see some logs:

[root@chefserver-test1 logs]# tail 2011_05_12.request.log
127.0.0.1 - - [12/05/2011:21:25:46 +0000] “POST /solr/update HTTP/1.1” 200 147
127.0.0.1 - - [12/05/2011:21:25:46 +0000] “POST /solr/update HTTP/1.1” 200 147
127.0.0.1 - - [12/05/2011:21:46:40 +0000] “GET /solr/select?q=%2A%253A%2A&start=0&rows=20&wt=ruby&indent=off&fq=%2BX_CHEF_database_CHEF_X%3Achef+%2BX_CHEF_type_CHEF_X%3Aclient HTTP/1.1” 400 1505
127.0.0.1 - - [12/05/2011:21:47:21 +0000] “GET /solr/select?q=%2A%3A%2A&start=0&rows=1000&sort=X_CHEF_id_CHEF_X+asc&wt=ruby&indent=off&fq=%2BX_CHEF_database_CHEF_X%3Achef+%2BX_CHEF_type_CHEF_X%3Anode HTTP/1.1” 200 620

  • Steve


Steve Webb - Senior System Administrator for gnip.com


#4

On Thu, May 12, 2011 at 2:55 PM, Steve Webb swebb@gnip.com wrote:

[root@chefserver-test1 ~]# chef-server --version
Chef Server (API) Version: 0.9.12

Have you tried that query on the server against the server, so that
way you’re using the same version of knife as the server?

Bryan


#5

Brian -

Yea, it works on the server:

[swebb@chefserver-test1 log] knife search node "*:*" | head { "total": 2, "start": 0, "rows": [ { "name": "cacti-server.gnip.com", "json_class": "Chef::Node", "automatic": { "keys": { "ssh": { [swebb@chefserver-test1 log]

Q: Does this mean that the ‘search’ syntax changed between 0.9.12 and
0.10.0?

  • Steve


Steve Webb - Senior System Administrator for gnip.com

On Thu, 12 May 2011, Bryan McLellan wrote:

On Thu, May 12, 2011 at 2:55 PM, Steve Webb swebb@gnip.com wrote:

[root@chefserver-test1 ~]# chef-server --version
Chef Server (API) Version: 0.9.12

Have you tried that query on the server against the server, so that
way you’re using the same version of knife as the server?

Bryan


#6

On Thu, May 12, 2011 at 3:02 PM, Steve Webb swebb@gnip.com wrote:

Q: Does this mean that the ‘search’ syntax changed between 0.9.12 and
0.10.0?

I don’t know the specifics, but I would expect this. There were a
number of breaking changes that got saved for the 0.10 release. Solr
was upgraded and received a new schema, as well as the
chef-solr-indexer was replaced with chef-expander.


http://wiki.opscode.com/display/chef/Chef+Indexer#ChefIndexer-ChefExpander

Bryan


#7

On Thursday, May 12, 2011 at 3:22 PM, Bryan McLellan wrote:
On Thu, May 12, 2011 at 3:02 PM, Steve Webb swebb@gnip.com wrote:

Q: Does this mean that the ‘search’ syntax changed between 0.9.12 and
0.10.0?

I don’t know the specifics, but I would expect this. There were a
number of breaking changes that got saved for the 0.10 release. Solr
was upgraded and received a new schema, as well as the
chef-solr-indexer was replaced with chef-expander.

http://www.opscode.com/blog/2011/05/02/chef-0-10-0-released/
http://wiki.opscode.com/display/chef/Chef+Indexer#ChefIndexer-ChefExpander

Bryan
As mentioned in those articles, you need to be running 0.10 on the server before you can use 0.10 clients/knife. Some commands may work, but others will not.

However, you can run 0.9.x clients against a 0.10 server, so you do not need to upgrade your clients in lockstep.


Dan DeLeo