Skip to content

Commit

Permalink
Switch core name to core1 #4836
Browse files Browse the repository at this point in the history
We are not using collections, those are only a part of SolrCloud. This is the first half of fixing our installation steps via recommendation on solr's IRC
  • Loading branch information
matthew-a-dunlap committed Aug 6, 2018
1 parent 369e02f commit c7f56ea
Show file tree
Hide file tree
Showing 24 changed files with 44 additions and 44 deletions.
6 changes: 3 additions & 3 deletions conf/docker-aio/c7.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ RUN sudo -u postgres /usr/pgsql-9.6/bin/initdb -D /var/lib/pgsql/data

# copy configuration related files
RUN cp /tmp/dv/pg_hba.conf /var/lib/pgsql/data/
RUN cp -r /opt/solr-7.3.0/server/solr/configsets/_default /opt/solr-7.3.0/server/solr/collection1
RUN cp /tmp/dv/schema.xml /opt/solr-7.3.0/server/solr/collection1/conf/schema.xml
RUN cp /tmp/dv/solrconfig.xml /opt/solr-7.3.0/server/solr/collection1/conf/solrconfig.xml
RUN cp -r /opt/solr-7.3.0/server/solr/configsets/_default /opt/solr-7.3.0/server/solr/configsets/_default_dv
RUN cp /tmp/dv/schema.xml /opt/solr-7.3.0/server/solr/configsets/_default_dv/schema.xml
RUN cp /tmp/dv/solrconfig.xml /opt/solr-7.3.0/server/solr/configsets/_default_dv/solrconfig.xml

# skipping glassfish user and solr user (run both as root)

Expand Down
2 changes: 1 addition & 1 deletion conf/docker-aio/entrypoint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sudo -u postgres /usr/pgsql-9.6/bin/postgres -D /var/lib/pgsql/data &
cd /opt/solr-7.3.0/
# TODO: Run Solr as non-root and remove "-force".
bin/solr start -force
bin/solr create_core -c collection1 -d server/solr/collection1/conf -force
bin/solr create_core -c core1 -d server/solr/core1/conf -force

# start apache, in both foreground and background...
apachectl -DFOREGROUND &
Expand Down
8 changes: 4 additions & 4 deletions conf/docker/solr/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ SOLR_DIR=/tmp/solr-7.3.0
if [ "$1" = 'solr' ]; then
cd /tmp
tar xvfz solr-7.3.0.tgz
cp -r $SOLR_DIR/server/solr/configsets/_default $SOLR_DIR/server/solr/collection1
cp /tmp/schema.xml $SOLR_DIR/server/solr/collection1/conf
cp /tmp/solrconfig.xml $SOLR_DIR/server/solr/collection1/conf
cp -r $SOLR_DIR/server/solr/configsets/_default $SOLR_DIR/server/solr/core1
cp /tmp/schema.xml $SOLR_DIR/server/solr/core1/conf
cp /tmp/solrconfig.xml $SOLR_DIR/server/solr/core1/conf
cd $SOLR_DIR
bin/solr start
bin/solr create_core -c collection1 -d server/solr/collection1/conf
bin/solr create_core -c core1 -d server/solr/core1/conf
sleep infinity
elif [ "$1" = 'usage' ]; then
echo 'docker run -d iqss/dataverse-solr solr'
Expand Down
2 changes: 1 addition & 1 deletion conf/solr/7.3.0/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<field name="fileAccess" type="string" stored="true" indexed="true" multiValued="true"/>

<!-- Added for Dataverse 4.0 alpha 1: static "parent" fields not copied to "catchall" field https://redmine.hmdc.harvard.edu/issues/3603 -->
<!-- We index parentid and parentname as a debugging aid in case we want to match on it with an explict query like curl 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=parentId%3A42' or curl 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=parentName%3Abirds' -->
<!-- We index parentid and parentname as a debugging aid in case we want to match on it with an explict query like curl 'http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=parentId%3A42' or curl 'http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=parentName%3Abirds' -->
<!-- TODO: store parentid as a long instead of a string -->
<field name="parentId" type="string" stored="true" indexed="true" multiValued="false"/>
<field name="parentIdentifier" type="string" stored="true" indexed="true" multiValued="false"/>
Expand Down
8 changes: 4 additions & 4 deletions doc/sphinx-guides/source/developers/dev-environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,21 @@ To install Solr, execute the following commands:

``cd solr-7.3.0/server/solr``

``cp -r configsets/_default collection1``
``cp -r configsets/_default core1``

``curl -O https://raw.githubusercontent.com/IQSS/dataverse/develop/conf/solr/7.3.0/schema.xml``

``mv schema.xml collection1/conf``
``mv schema.xml core1/conf``

``curl -O https://raw.githubusercontent.com/IQSS/dataverse/develop/conf/solr/7.3.0/solrconfig.xml``

``mv solrconfig.xml collection1/conf/solrconfig.xml``
``mv solrconfig.xml core1/conf/solrconfig.xml``

``cd /usr/local/solr/solr-7.3.0``

``bin/solr start``

``bin/solr create_core -c collection1 -d server/solr/collection1/conf``
``bin/solr create_core -c core1 -d server/solr/core1/conf``

Run the Dataverse Installer Script
----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx-guides/source/developers/tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ By default, Glassfish reports analytics information. The administration guide su
Solr
----

Once some dataverses, datasets, and files have been created and indexed, you can experiment with searches directly from Solr at http://localhost:8983/solr/#/collection1/query and look at the JSON output of searches, such as this wildcard search: http://localhost:8983/solr/collection1/select?q=*%3A*&wt=json&indent=true . You can also get JSON output of static fields Solr knows about: http://localhost:8983/solr/schema/fields
Once some dataverses, datasets, and files have been created and indexed, you can experiment with searches directly from Solr at http://localhost:8983/solr/#/core1/query and look at the JSON output of searches, such as this wildcard search: http://localhost:8983/solr/core1/select?q=*%3A*&wt=json&indent=true . You can also get JSON output of static fields Solr knows about: http://localhost:8983/solr/schema/fields

You can simply double-click "start.jar" rather that running ``java -jar start.jar`` from the command line. Figuring out how to stop Solr after double-clicking it is an exercise for the reader.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Clear Solr

The database is fresh and new but Solr has stale data it in. Clear it out with this command:

``curl http://localhost:8983/solr/collection1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"``
``curl http://localhost:8983/solr/core1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"``


Deleting Uploaded Files
Expand Down
8 changes: 4 additions & 4 deletions doc/sphinx-guides/source/installation/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ Become the ``solr`` user and then download and configure Solr::
wget https://archive.apache.org/dist/lucene/solr/7.3.0/solr-7.3.0.tgz
tar xvzf solr-7.3.0.tgz
cd solr-7.3.0
cp -r server/solr/configsets/_default server/solr/collection1
cp -r server/solr/configsets/_default server/solr/core1

You should already have a "dvinstall.zip" file that you downloaded from https://github.com/IQSS/dataverse/releases . Unzip it into ``/tmp``. Then copy the files into place::

cp /tmp/dvinstall/schema.xml /usr/local/solr/solr-7.3.0/server/solr/collection1/conf
cp /tmp/dvinstall/solrconfig.xml /usr/local/solr/solr-7.3.0/server/solr/collection1/conf
cp /tmp/dvinstall/schema.xml /usr/local/solr/solr-7.3.0/server/solr/core1/conf
cp /tmp/dvinstall/solrconfig.xml /usr/local/solr/solr-7.3.0/server/solr/core1/conf

Note: Dataverse has customized Solr to boost results that come from certain indexed elements inside Dataverse, for example results matching on the name of a dataset. If you would like to remove this, edit your ``solrconfig.xml`` and remove the ``<str name="qf">`` element and its contents.

Expand All @@ -208,7 +208,7 @@ With the Dataverse-specific config in place, you can now start Solr and create t

cd /usr/local/solr/solr-7.3.0
bin/solr start
bin/solr create_core -c collection1 -d server/solr/collection1/conf/
bin/solr create_core -c core1 -d server/solr/core1/conf/
Please note: Solr will warn about needing to increase the number of file descriptors and max processes in a production environment but will still run with defaults. We have increased these values to the recommended levels by adding ulimit -n 65000 to the init script and adding solr soft nproc 65000 to /etc/security/limits.conf. On operating systems which use systemd such as RHEL or CentOS 7, you may add a line like LimitNOFILE=65000 to the systemd unit file, or adjust the limits on a running process using the prlimit tool:

Expand Down
2 changes: 1 addition & 1 deletion scripts/api/setup-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ done
command -v jq >/dev/null 2>&1 || { echo >&2 '`jq` ("sed for JSON") is required, but not installed. Download the binary for your platform from http://stedolan.github.io/jq/ and make sure it is in your $PATH (/usr/bin/jq is fine) and executable with `sudo chmod +x /usr/bin/jq`. On Mac, you can install it with `brew install jq` if you use homebrew: http://brew.sh . Aborting.'; exit 1; }

echo "deleting all data from Solr"
curl http://localhost:8983/solr/collection1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"
curl http://localhost:8983/solr/core1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"

SERVER=http://localhost:8080/api

Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/phoenix.dataverse.org/rebuild
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rm -rf /usr/local/glassfish4/glassfish/domains/domain1/files
#psql -U postgres -c "CREATE ROLE dvnapp UNENCRYPTED PASSWORD 'secret' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN" template1
psql -U dvnapp -c 'DROP DATABASE "dvndb"' template1
echo $?
curl http://localhost:8983/solr/collection1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"
curl http://localhost:8983/solr/core1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"
psql -U dvnapp -c 'CREATE DATABASE "dvndb" WITH OWNER = "dvnapp"' template1
echo $?
/usr/local/glassfish4/glassfish/bin/asadmin start-domain
Expand Down
6 changes: 3 additions & 3 deletions scripts/search/add
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/sh
# need the following in solr/collection1/conf/schema.xml
# need the following in solr/core1/conf/schema.xml
# <field name="entityid" type="long" indexed="true" stored="true" required="true" multiValued="false" />
# <field name="type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
mkdir -p data
#echo "adding to solr..."
curl -s http://localhost:8080/api/dataverses > data/dataverses.json
#curl http://localhost:8983/solr/collection1/update/json?commit=true -H 'Content-type:application/json' --data-binary @data/dataverses.json
#curl http://localhost:8983/solr/core1/update/json?commit=true -H 'Content-type:application/json' --data-binary @data/dataverses.json

curl -s http://localhost:8080/api/datasets > data/datasets.json
#curl http://localhost:8983/solr/collection1/update/json?commit=true -H 'Content-type:application/json' --data-binary @data/datasets.json
#curl http://localhost:8983/solr/core1/update/json?commit=true -H 'Content-type:application/json' --data-binary @data/datasets.json

echo "adding to elasticsearch..."
#curl -XPOST http://localhost:9200/dataverse/datasets/1 --data-binary @data/datasets/1.dump
Expand Down
2 changes: 1 addition & 1 deletion scripts/search/clear
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
echo "deleting all data from Solr"
curl http://localhost:8983/solr/collection1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"
curl http://localhost:8983/solr/core1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"
# this was for elasticsearch
#curl -XDELETE http://localhost:9200/dataverse/
4 changes: 2 additions & 2 deletions scripts/search/compare
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ curl -s "http://localhost:8080/api/search?q=*&key=$FINCHKEY" | jq '.data.fq_actu
echo "Database:"
scripts/search/dbperms $1 | grep '|'
echo "Solr per group docs (old):"
curl -s "http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=entityId%3A$1" | jq '.response.docs[] | {id, name_sort, perms_ss}'
curl -s "http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=entityId%3A$1" | jq '.response.docs[] | {id, name_sort, perms_ss}'
echo "Solr permission docs (new):"
curl -s "http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=definition_point_dvobject_id_s%3A$1" | jq '.response.docs[] | {definition_point_s,discoverable_by_ss}'
curl -s "http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=definition_point_dvobject_id_s%3A$1" | jq '.response.docs[] | {definition_point_s,discoverable_by_ss}'
echo "Java:"
curl -s "http://localhost:8080/api/search/perms?q=*&key=$FINCHKEY&id=$1" | jq '.data[]' 2>/dev/null
exit
Expand Down
2 changes: 1 addition & 1 deletion scripts/search/empty-entityid-check
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
# see also https://redmine.hmdc.harvard.edu/issues/3809
curl 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=-entityId:*'
curl 'http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=-entityId:*'
2 changes: 1 addition & 1 deletion scripts/search/files
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
curl http://localhost:8080/api/index
# below line is broken
curl -s 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=*&fq=dvtype:files' | jq '.response.docs[] | {name_sort, id, parentid}'
curl -s 'http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=*&fq=dvtype:files' | jq '.response.docs[] | {name_sort, id, parentid}'
6 changes: 3 additions & 3 deletions scripts/search/query
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
curl -s 'http://localhost:8983/solr/collection1/select?rows=1000000&wt=json&indent=true&q=*%3A*'
curl -s 'http://localhost:8983/solr/core1/select?rows=1000000&wt=json&indent=true&q=*%3A*'
# show combination of public stuff OR pete's private stuff
# curl -s --globoff 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=*&fq=({!join+from=groups_s+to=perms_ss}id:group_public+OR+{!join+from=groups_s+to=perms_ss}id:group_user2)' | jq '.response.docs[] | {name_sort}'
# curl -s --globoff 'http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=*&fq=({!join+from=groups_s+to=perms_ss}id:group_public+OR+{!join+from=groups_s+to=perms_ss}id:group_user2)' | jq '.response.docs[] | {name_sort}'
# https://github.com/IQSS/dataverse/issues/1262
# curl 'http://localhost:8983/solr/collection1/select?rows=1000000&wt=json&indent=true&hl=true&hl.fl=*&q=wright&hl.snippets=10'
# curl 'http://localhost:8983/solr/core1/select?rows=1000000&wt=json&indent=true&hl=true&hl.fl=*&q=wright&hl.snippets=10'
# remember elasticsearch? :)
#curl 'http://localhost:9200/_search?pretty=true&q=*'
2 changes: 1 addition & 1 deletion scripts/search/solr-delete-id
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [ -z "$1" ]; then
exit 1
else
echo "Deleting Solr id $1"
OUTPUT=`curl -s http://localhost:8983/solr/collection1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"id:$1\"}}"`
OUTPUT=`curl -s http://localhost:8983/solr/core1/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"id:$1\"}}"`
# exit code 7 is expected when Solr is down
EXIT_CODE=$?
#echo $EXIT_CODE
Expand Down
4 changes: 2 additions & 2 deletions scripts/search/tests/special-characters
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
# curl -H "Content-type:application/json" -X POST -d @scripts/search/tests/data/dv-colon.json "http://localhost:8080/api/dataverses/peteTop?key=pete"
# curl 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q="description:\:"'
# curl 'http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q="description:\:"'
diff <(curl -s 'http://localhost:8080/api/search?q=:') scripts/search/tests/expected/colon

# http://stackoverflow.com/questions/18277609/search-in-solr-with-special-characters
# curl -H "Content-type:application/json" -X POST -d @scripts/search/tests/data/dv-dash.json "http://localhost:8080/api/dataverses/peteTop?key=pete"
# curl 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=name:\-'
# curl 'http://localhost:8983/solr/core1/select?rows=100&wt=json&indent=true&q=name:\-'
# diff <(curl -s 'http://localhost:8080/api/search?q=name:"Titanic - 1999"') scripts/search/tests/expected/dash
8 changes: 4 additions & 4 deletions scripts/vagrant/setup-solr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ mkdir $SOLR_HOME
chown $SOLR_USER:$SOLR_USER $SOLR_HOME
su $SOLR_USER -s /bin/sh -c "cp /downloads/solr-7.3.0.tgz $SOLR_HOME"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME && tar xfz solr-7.3.0.tgz"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.3.0/server/solr && cp -r configsets/_default . && mv _default collection1"
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.3.0/schema.xml $SOLR_HOME/solr-7.3.0/server/solr/collection1/conf/schema.xml"
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.3.0/solrconfig.xml $SOLR_HOME/solr-7.3.0/server/solr/collection1/conf/solrconfig.xml"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.3.0 && bin/solr start && bin/solr create_core -c collection1 -d server/solr/collection1/conf/"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.3.0/server/solr && cp -r configsets/_default . && mv _default core1"
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.3.0/schema.xml $SOLR_HOME/solr-7.3.0/server/solr/core1/conf/schema.xml"
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.3.0/solrconfig.xml $SOLR_HOME/solr-7.3.0/server/solr/core1/conf/solrconfig.xml"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.3.0 && bin/solr start && bin/solr create_core -c core1 -d server/solr/core1/conf/"
cp /dataverse/doc/sphinx-guides/source/_static/installation/files/etc/init.d/solr /etc/init.d/solr
chmod 755 /etc/init.d/solr
/etc/init.d/solr stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public OAISet findById(Long id) {
private SolrClient getSolrServer () {
if (solrServer == null) {
}
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/collection1";
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/core1";
solrServer = new HttpSolrClient.Builder(urlString).build();

return solrServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public class IndexServiceBean {

@PostConstruct
public void init(){
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/collection1";
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/core1";
solrServer = new HttpSolrClient.Builder(urlString).build();

rootDataverseName = findRootDataverseCached().getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class SearchFields {
* @todo: consider making various dynamic fields (_s) static in schema.xml
* instead. Should they be stored in the database?
*/
// standard fields from example/solr/collection1/conf/schema.xml
// standard fields from example/solr/core1/conf/schema.xml
// (but we are getting away from these...)
public static final String ID = "id";
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class SearchServiceBean {

@PostConstruct
public void init() {
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/collection1";
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/core1";
solrServer = new HttpSolrClient.Builder(urlString).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class SolrIndexServiceBean {

@PostConstruct
public void init() {
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/collection1";
String urlString = "http://" + systemConfig.getSolrHostColonPort() + "/solr/core1";
solrServer = new HttpSolrClient.Builder(urlString).build();

}
Expand Down

0 comments on commit c7f56ea

Please sign in to comment.