Repository: metron Updated Branches: refs/heads/feature/METRON-1416-upgrade-solr 23113a633 -> c5b6a6f27
METRON-1436: Manually Install Solr Cloud in Full Dev (mmiklavc via mmiklavc) closes apache/metron#918 Project: http://git-wip-us.apache.org/repos/asf/metron/repo Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/c5b6a6f2 Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/c5b6a6f2 Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/c5b6a6f2 Branch: refs/heads/feature/METRON-1416-upgrade-solr Commit: c5b6a6f27c36856a07597f512115baa975b5ad74 Parents: 23113a6 Author: mmiklavc <michael.miklav...@gmail.com> Authored: Fri Feb 2 08:47:08 2018 -0700 Committer: Michael Miklavcic <michael.miklav...@gmail.com> Committed: Fri Feb 2 08:47:08 2018 -0700 ---------------------------------------------------------------------- .../docker/rpm-docker/SPECS/metron.spec | 3 + metron-platform/metron-solr/README.md | 53 +++++++++++++++++ .../src/main/scripts/install_solr.sh | 62 ++++++++++++++++++++ 3 files changed, 118 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/metron/blob/c5b6a6f2/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec ---------------------------------------------------------------------- diff --git a/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec b/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec index 0c2fff9..3d25478 100644 --- a/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec +++ b/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec @@ -225,6 +225,7 @@ This package installs the Metron Solr files %dir %{metron_home}/bin %dir %{metron_home}/config %dir %{metron_home}/lib +%{metron_home}/bin/install_solr.sh %{metron_home}/bin/start_solr_topology.sh %{metron_home}/config/solr.properties %attr(0644,root,root) %{metron_home}/lib/metron-solr-%{full_version}-uber.jar @@ -504,6 +505,8 @@ chkconfig --del metron-management-ui chkconfig --del metron-alerts-ui %changelog +* Thu Feb 1 2018 Apache Metron <d...@metron.apache.org> - 0.4.3 +- Add Solr install script to Solr RPM * Tue Sep 25 2017 Apache Metron <d...@metron.apache.org> - 0.4.2 - Add Alerts UI * Tue Sep 19 2017 Apache Metron <d...@metron.apache.org> - 0.4.2 http://git-wip-us.apache.org/repos/asf/metron/blob/c5b6a6f2/metron-platform/metron-solr/README.md ---------------------------------------------------------------------- diff --git a/metron-platform/metron-solr/README.md b/metron-platform/metron-solr/README.md new file mode 100644 index 0000000..ab05425 --- /dev/null +++ b/metron-platform/metron-solr/README.md @@ -0,0 +1,53 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +# Solr in Metron + +## Table of Contents + +* [Introduction](#introduction) +* [Installing](#installing) + +## Introduction + +Metron ships with Solr 6.6.2 support. Solr Cloud can be used as the real-time portion of the datastore resulting from [metron-indexing](../metron-indexing/README.md). + +## Installing + +A script is provided in the installation for installing Solr Cloud in quick-start mode in the [full dev environment for CentOS](../../metron-deployment/development/centos6). +The script is installed as part of the Solr RPM. Metron's Ambari MPack does not currently manage Solr installation in any way, so +you must first install the RPM in order to run the Solr setup script. + +The script performs the following tasks + +* Stops ES and Kibana +* Downloads Solr +* Installs Solr +* Starts Solr Cloud + +_Note: for details on setting up Solr Cloud in production mode, see https://lucene.apache.org/solr/guide/6_6/taking-solr-to-production.html_ + +Login to the full dev environment as root and execute the following to install the Solr RPM. + +``` +rpm -ivh /localrepo/metron-solr-*.rpm +``` + +This will lay down the necessary files to setup Solr Cloud. Navigate to `$METRON_HOME/bin` and spin up Solr Cloud by running `install_solr.sh`. + +After running this script, Elasticsearch and Kibana will have been stopped and you should now have an instance of Solr Cloud up and running at http://localhost:8983/solr/#/~cloud. This manner +of starting Solr will also spin up an embedded Zookeeper instance at port 9983. More information can be found [here](https://lucene.apache.org/solr/guide/6_6/getting-started-with-solrcloud.html) http://git-wip-us.apache.org/repos/asf/metron/blob/c5b6a6f2/metron-platform/metron-solr/src/main/scripts/install_solr.sh ---------------------------------------------------------------------- diff --git a/metron-platform/metron-solr/src/main/scripts/install_solr.sh b/metron-platform/metron-solr/src/main/scripts/install_solr.sh new file mode 100755 index 0000000..73415c8 --- /dev/null +++ b/metron-platform/metron-solr/src/main/scripts/install_solr.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This is provided for development purposes + +# Full dev env setup script for Solr Cloud 6.6.2 +# - Stops ES and Kibana +# - Downloads Solr +# - Installs Solr +# - Starts Solr Cloud + +# Note: for production mode, see https://lucene.apache.org/solr/guide/6_6/taking-solr-to-production.html + +service kibana stop +service elasticsearch stop + +SOLR_VERSION=6.6.2 +SOLR_USER=solr +SOLR_SERVICE=$SOLR_USER +SOLR_VAR_DIR="/var/$SOLR_SERVICE" + +# create user if not exists +solr_uid="`id -u "$SOLR_USER"`" +if [ $? -ne 0 ]; then + echo "Creating new user: $SOLR_USER" + adduser --system -U -m --home-dir "$SOLR_VAR_DIR" "$SOLR_USER" +fi +cd $SOLR_VAR_DIR +wget http://archive.apache.org/dist/lucene/solr/${SOLR_VERSION}/solr-${SOLR_VERSION}.tgz +tar zxvf solr-${SOLR_VERSION}.tgz +chown -R $SOLR_USER:$SOLR_USER solr-${SOLR_VERSION} +cd solr-${SOLR_VERSION} +su $SOLR_USER -c "bin/solr -e cloud -noprompt" +sleep 5 +bin/solr status +bin/solr healthcheck -c gettingstarted + +# These commands can be used for running multiple Solr services on a single node for cloud mode +# This approach extracts the install script from the tarball and will setup the solr user along +# with init.d service scripts and then startup the services. + +# tar xzf solr-${SOLR_VERSION}.tgz solr-${SOLR_VERSION}/bin/install_solr_service.sh --strip-components=2 +# sudo bash ./install_solr_service.sh solr-${SOLR_VERSION}.tgz -n +# sudo bash ./install_solr_service.sh solr-${SOLR_VERSION}.tgz -s solr2 -p 8984 -n +# echo "export ZK_HOST=node1:2181" >> /etc/default/solr.in.sh +