Instalação do SOLR no CentOS 6.7
Dica publicada em Linux / Software
Instalação do SOLR no CentOS 6.7
Solr é um projeto Open Source de um servidor de buscas de alta performance do projeto Apache Lucene. É desenvolvido em Java e utiliza o Lucene Core como base para indexação e busca, além de fornecer APIs baseadas em REST, o que lhe permite ser integrado a praticamente qualquer linguagem de programação.
1. Instalar dependência, baixar solr e começar a configurar.
# yum -y install java-1.7.0-openjdk.x86_64
# cd /opt
# wget http://mirror.nbtelecom.com.br/apache/lucene/solr/5.4.1/solr-5.4.1.tgz
# tar -xzvf solr-5.4.1.tgz
# mv solr-5.4.1/ solr
# mv -v /opt/solr/example /opt/solr/core
2. Criar o script abaixo.
# nano /etc/init.d/solr
3. Após criar o script, torná-lo executável e habilitar como serviço.
# chmod +x /etc/init.d/solr
# chkconfig solr on
4. Criar usuário dedicado ao solr.
# useradd -r -d /opt/solr -M -c "Apache Solr" solr
5. Alterar permissão do diretório do solr para que o usuário criado.
# chown -R solr:solr /opt/solr/
6. Iniciar o solr.
# service solr start
7. Acessar a url que dá acesso ao serviço.
http://"ip do servidor":8983/solr/#/
FIM
1. Instalar dependência, baixar solr e começar a configurar.
# yum -y install java-1.7.0-openjdk.x86_64
# cd /opt
# wget http://mirror.nbtelecom.com.br/apache/lucene/solr/5.4.1/solr-5.4.1.tgz
# tar -xzvf solr-5.4.1.tgz
# mv solr-5.4.1/ solr
# mv -v /opt/solr/example /opt/solr/core
2. Criar o script abaixo.
# nano /etc/init.d/solr
#!/bin/sh
# Provides: solr
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls Apache Solr as a Service
# Where you extracted the Solr distribution bundle
SOLR_INSTALL_DIR="/opt/solr"
if [ ! -d "$SOLR_INSTALL_DIR" ]; then
echo "$SOLR_INSTALL_DIR not found! Please check the SOLR_INSTALL_DIR setting in your $0 script."
exit 1
fi
SOLR_ENV="/opt/solr/bin/solr.in.sh"
if [ ! -f "$SOLR_ENV" ]; then
echo "$SOLR_ENV not found! Please check the SOLR_ENV setting in your $0 script."
exit 1
fi
# Specify the user to run Solr as; if not set, then Solr will run as root.
# Running Solr as root is not recommended for production environments
RUNAS="solr"
# verify the specified run as user exists
runas_uid="`id -u "$RUNAS"`"
if [ $? -ne 0 ]; then
echo "User $RUNAS not found! Please create the $RUNAS user before running this script."
exit 1
fi
case "$1" in
start|stop|restart|status)
SOLR_CMD="$1"
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit
esac
if [ -n "$RUNAS" ]; then
su -c "SOLR_INCLUDE=\"$SOLR_ENV\" \"$SOLR_INSTALL_DIR/bin/solr\" $SOLR_CMD" - "$RUNAS"
else
SOLR_INCLUDE="$SOLR_ENV" "$SOLR_INSTALL_DIR/bin/solr" "$SOLR_CMD"
fi
# Provides: solr
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls Apache Solr as a Service
# Where you extracted the Solr distribution bundle
SOLR_INSTALL_DIR="/opt/solr"
if [ ! -d "$SOLR_INSTALL_DIR" ]; then
echo "$SOLR_INSTALL_DIR not found! Please check the SOLR_INSTALL_DIR setting in your $0 script."
exit 1
fi
SOLR_ENV="/opt/solr/bin/solr.in.sh"
if [ ! -f "$SOLR_ENV" ]; then
echo "$SOLR_ENV not found! Please check the SOLR_ENV setting in your $0 script."
exit 1
fi
# Specify the user to run Solr as; if not set, then Solr will run as root.
# Running Solr as root is not recommended for production environments
RUNAS="solr"
# verify the specified run as user exists
runas_uid="`id -u "$RUNAS"`"
if [ $? -ne 0 ]; then
echo "User $RUNAS not found! Please create the $RUNAS user before running this script."
exit 1
fi
case "$1" in
start|stop|restart|status)
SOLR_CMD="$1"
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit
esac
if [ -n "$RUNAS" ]; then
su -c "SOLR_INCLUDE=\"$SOLR_ENV\" \"$SOLR_INSTALL_DIR/bin/solr\" $SOLR_CMD" - "$RUNAS"
else
SOLR_INCLUDE="$SOLR_ENV" "$SOLR_INSTALL_DIR/bin/solr" "$SOLR_CMD"
fi
3. Após criar o script, torná-lo executável e habilitar como serviço.
# chmod +x /etc/init.d/solr
# chkconfig solr on
4. Criar usuário dedicado ao solr.
# useradd -r -d /opt/solr -M -c "Apache Solr" solr
5. Alterar permissão do diretório do solr para que o usuário criado.
# chown -R solr:solr /opt/solr/
6. Iniciar o solr.
# service solr start
7. Acessar a url que dá acesso ao serviço.
http://"ip do servidor":8983/solr/#/
FIM
segui seu tutorial e estou com alguns problemas, primeiro, quando starto o solr pelo script de inicialização tenho a mensagem "Error: Unable to access jarfile start.jar", segundo, ao tentar criar uma colletions, tenho o erro "Path must not end with / character", se puder me dar um norte agradeceria demais.
abraço Leandro