Skip to content

Lesson Start FCRepo and Solr

Justin Coyne edited this page Dec 5, 2017 · 21 revisions

Goals

  • Install FCRepo and Solr
  • Learn to start and stop FCRepo and Solr

Explanation

In order to use blacklight and hydra-head you need an installation of Solr. In addition, hydra-head requires a copy of Fedora. Fedora and Solr are both Java web applications.

For developer environments, we have created a solr_wrapper and fcrepo_wrapper -- commands to assist you in starting Solr and Fedora. Whenever you need Fedora and Solr running in your development environment, just start or stop that copy of solr_wrapper or fcrepo_wrapper

TIP DO NOT use solr_wrapper or fcrepo_wrapper for production installations.

**WORKSHOPS & HYDRA CAMP** if you're using a VM provided for the workshop, there's probably a copy of solr and fedora already on your VM, follow the instructions your facilitator provides to copy the files instead of having to download them again. Probably something like ``` cp /var/tmp/* /tmp ``` >

Step 1: Start Solr

Open a new terminal window and type:

# cd <hydra-demo app path>
solr_wrapper -d solr/config/ --collection_name hydra-development

You may get 404 errors while starting Solr, which looks something like this:

Starting Solr 6.0.1 on port 8983 ...                                                                                                    .../.rbenv/versions/2.3.1/lib/ruby/2.3.0/open-uri.rb:359:in `open_http': 404 Not Found (OpenURI::HTTPError)% ( ETA: ??:??:?? )
	from .../.rbenv/versions/2.3.1/lib/ruby/2.3.0/open-uri.rb:737:in `buffer_open'

This is due to Solr archiving older versions of their software to a different location on their website. To get around this, you can tell solr_wrapper to use the most recent version of Solr. First, go to the Solr website and determine what the latest version number is. Then pass that version number to solr_wrapper as an additional parameter to the above command. If the current version is 6.3.0, the command will now look like this:

solr_wrapper -d solr/config/ --collection_name hydra-development --version 6.3.0

You can check to see if Solr is started by going to http://localhost:8983/

If you're running a VM, remember that in addition to opening a new terminal window, you need to connect to your VM and change to your application directory again:

vagrant ssh
cd /vagrant/hydra-demo
solr_wrapper

ADDITIONAL TIP Running solr_wrapper in a tmux panel can silently fail. Use a separate new terminal window, or install https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard for Mac OSX.

Step 2: Start FCRepo

Open a new terminal window and type:

fcrepo_wrapper

You can check to see if FCRepo is started by going to http://localhost:8984/

Remember to connect to your VM again. On a VM, you also need to make sure the fedora data directory is not hosted on a shared folder:

vagrant ssh
cd /vagrant/hydra-demo
fcrepo_wrapper -d ~/services/fcrepo-data

ADDITIONAL TIP If fedora fails on startup, make sure that the data directory -d is pointed at an unshared folder.

FYI: Stopping FCRepo and Solr

In order to stop either service, open the window they are running in and type <Control>-C. Wait a few moments for the process to terminate.

Tip: Sometimes people are confused about whether they need to restart Fedora or Solr when they restart their Rails application. In most cases it is fine to leave Fedora and Solr running when you start, stop, and restart the Rails application. The only exception is when you make changes to Solr's configuration or Fedora's configuration -- these would be changes to files inside of your copy of the solr configuration (i.e. solr/config), not changes to files in your Rails application's Ruby code. In those cases, where you have made changes to Solr or Fedora's configuration, you need to restart the processes in order for those changes to take effect. The most common change that requires restarting Solr is when you modify the solrconfig.xml or schema.xml in your solr config directory. Normally, changes to your data steams or models do not require restarts to Solr and Fedora because these changes are indexed dynamically by Hydra.

Next Step

Go on to Lesson - Start the Application & Search for Results or return to the Dive into Hydra page.