Last active
March 27, 2022 21:48
-
-
Save DorkNstein/5c5654d54613726143dbfd7ec90eb2e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum update -y | |
sudo yum install java-1.8.0-openjdk-devel -y | |
sudo vi ~/.bashrc | |
## ADD export command under: # User specific aliases and functions: 'export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk' without quotes(') | |
env | grep JAVA_HOME ## Will show JAVA_HOME env | |
cd /opt | |
sudo wget http://www-us.apache.org/dist/lucene/solr/8.5.1/solr-8.5.1.tgz | |
sudo tar zxvf solr-8.5.1.tgz | |
sudo cp /opt/solr-8.5.1/bin/init.d/solr /etc/init.d/solr | |
sudo mv /opt/solr-8.5.1 /opt/solr | |
sudo rm -Rf /opt/solr-8.5.1.tgz | |
sudo chmod +x /etc/init.d/solr | |
sudo chkconfig --add solr | |
sudo vi /etc/init.d/solr ## Change SOLR_ENV="/etc/default/solr.in.sh" to SOLR_ENV="/opt/solr/bin/solr.in.sh" | |
sudo useradd solr | |
sudo passwd solr # Set password as solr | |
sudo chown -R solr:solr /opt/solr/ | |
sudo yum install -y lsof | |
sudo service solr start # Open (instance ip) xx.xx.xx.xx:8983 in browser and it should display solr portal | |
# Edit bin/solr.in.sh to match the added file | |
# Edit server/resources/log4j.properties file to match the added file | |
sudo mkdir /var/log/solr ## Create logging dir for solr | |
sudo chown -R solr:solr /var/log/solr # Provide permissions for solr user | |
sudo service solr restart # Restart the solr | |
# Create cores in /opt/solr/server/solr | |
### if dataimport is failing in solr, check if db dialect jar file is present | |
# Else download the jar file and put the .jar file in '/opt/solr/dist' folder | |
# Add '<lib dir="${solr.install.dir:../../../..}/dist/" regex="<name of the jar dialect>-.*\.jar" />' in solrconfig.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
# Settings here will override settings in existing env vars or in bin/solr. The default shipped state | |
# of this file is completely commented. | |
# By default the script will use JAVA_HOME to determine which java | |
# to use, but you can set a specific path for Solr to use without | |
# affecting other Java applications on your server/workstation. | |
#SOLR_JAVA_HOME="" | |
# This controls the number of seconds that the solr script will wait for | |
# Solr to stop gracefully or Solr to start. If the graceful stop fails, | |
# the script will forcibly stop Solr. If the start fails, the script will | |
# give up waiting and display the last few lines of the logfile. | |
#SOLR_STOP_WAIT="180" | |
# Increase Java Heap as needed to support your indexing / query needs | |
SOLR_HEAP="4096m" | |
# Expert: If you want finer control over memory options, specify them directly | |
# Comment out SOLR_HEAP if you are using this though, that takes precedence | |
#SOLR_JAVA_MEM="-Xms512m -Xmx512m" | |
# Enable verbose GC logging | |
GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \ | |
-XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime" | |
# These GC settings have shown to work well for a number of common Solr workloads | |
GC_TUNE="-XX:NewRatio=3 \ | |
-XX:SurvivorRatio=4 \ | |
-XX:TargetSurvivorRatio=90 \ | |
-XX:MaxTenuringThreshold=8 \ | |
-XX:+UseConcMarkSweepGC \ | |
-XX:+UseParNewGC \ | |
-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 \ | |
-XX:+CMSScavengeBeforeRemark \ | |
-XX:PretenureSizeThreshold=64m \ | |
-XX:+UseCMSInitiatingOccupancyOnly \ | |
-XX:CMSInitiatingOccupancyFraction=50 \ | |
-XX:CMSMaxAbortablePrecleanTime=6000 \ | |
-XX:+CMSParallelRemarkEnabled \ | |
-XX:+ParallelRefProcEnabled" | |
# Set the ZooKeeper connection string if using an external ZooKeeper ensemble | |
# e.g. host1:2181,host2:2181/chroot | |
# Leave empty if not using SolrCloud | |
#ZK_HOST="" | |
# Set the ZooKeeper client timeout (for SolrCloud mode) | |
#ZK_CLIENT_TIMEOUT="15000" | |
# By default the start script uses "localhost"; override the hostname here | |
# for production SolrCloud environments to control the hostname exposed to cluster state | |
#SOLR_HOST="192.168.1.1" | |
# By default the start script uses UTC; override the timezone if needed | |
#SOLR_TIMEZONE="UTC" | |
# Set to true to activate the JMX RMI connector to allow remote JMX client applications | |
# to monitor the JVM hosting Solr; set to "false" to disable that behavior | |
# (false is recommended in production environments) | |
ENABLE_REMOTE_JMX_OPTS="false" | |
# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here | |
# RMI_PORT=18983 | |
# Set the thread stack size | |
SOLR_OPTS="$SOLR_OPTS -Xss256k" | |
# Anything you add to the SOLR_OPTS variable will be included in the java | |
# start command line as-is, in ADDITION to other options. If you specify the | |
# -a option on start script, those options will be appended as well. Examples: | |
#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=3000" | |
#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoCommit.maxTime=60000" | |
#SOLR_OPTS="$SOLR_OPTS -Dsolr.clustering.enabled=true" | |
# Location where the bin/solr script will save PID files for running instances | |
# If not set, the script will create PID files in $SOLR_TIP/bin | |
#SOLR_PID_DIR= | |
# Path to a directory for Solr to store cores and their data. By default, Solr will use server/solr | |
# If solr.xml is not stored in ZooKeeper, this directory needs to contain solr.xml | |
#SOLR_HOME= | |
# Solr provides a default Log4J configuration properties file in server/resources | |
# however, you may want to customize the log settings and file appender location | |
# so you can point the script to use a different log4j.properties file | |
#LOG4J_PROPS=/var/solr/log4j.properties | |
# Changes the logging level. Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Default is INFO | |
# This is an alternative to changing the rootLogger in log4j.properties | |
#SOLR_LOG_LEVEL=INFO | |
# Location where Solr should write logs to. Absolute or relative to solr start dir | |
# settings in server/resources/log4j.properties | |
SOLR_LOGS_DIR=/var/log/solr | |
# Sets the port Solr binds to, default is 8983 | |
#SOLR_PORT=8983 | |
# Uncomment to set SSL-related system properties | |
# Be sure to update the paths to the correct keystore for your environment | |
#SOLR_SSL_KEY_STORE=/home/shalin/work/oss/shalin-lusolr/solr/server/etc/solr-ssl.keystore.jks | |
#SOLR_SSL_KEY_STORE_PASSWORD=secret | |
#SOLR_SSL_TRUST_STORE=/home/shalin/work/oss/shalin-lusolr/solr/server/etc/solr-ssl.keystore.jks | |
#SOLR_SSL_TRUST_STORE_PASSWORD=secret | |
#SOLR_SSL_NEED_CLIENT_AUTH=false | |
#SOLR_SSL_WANT_CLIENT_AUTH=false | |
# Uncomment if you want to override previously defined SSL values for HTTP client | |
# otherwise keep them commented and the above values will automatically be set for HTTP clients | |
#SOLR_SSL_CLIENT_KEY_STORE= | |
#SOLR_SSL_CLIENT_KEY_STORE_PASSWORD= | |
#SOLR_SSL_CLIENT_TRUST_STORE= | |
#SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD= | |
# Settings for authentication | |
#SOLR_AUTHENTICATION_CLIENT_CONFIGURER= | |
#SOLR_AUTHENTICATION_OPTS= | |
# Settings for ZK ACL | |
#SOLR_ZK_CREDS_AND_ACLS="-DzkACLProvider=org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider \ | |
# -DzkCredentialsProvider=org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider \ | |
# -DzkDigestUsername=admin-user -DzkDigestPassword=CHANGEME-ADMIN-PASSWORD \ | |
# -DzkDigestReadonlyUsername=readonly-user -DzkDigestReadonlyPassword=CHANGEME-READONLY-PASSWORD" | |
#SOLR_OPTS="$SOLR_OPTS $SOLR_ZK_CREDS_AND_ACLS" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default Solr log4j config | |
# rootLogger log level may be programmatically overridden by -Dsolr.log.level | |
# solr.log=${solr.log.dir} | |
solr.log=logs | |
log4j.rootLogger=INFO, file, CONSOLE | |
# Console appender will be programmatically disabled when Solr is started with option -Dsolr.log.muteconsole | |
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender | |
log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout | |
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n | |
#- size rotation with log cleanup. | |
log4j.appender.file=org.apache.log4j.RollingFileAppender | |
log4j.appender.file.MaxFileSize=4MB | |
log4j.appender.file.MaxBackupIndex=9 | |
#- File to log to and log format | |
log4j.appender.file.File=${solr.log}/solr.log | |
log4j.appender.file.layout=org.apache.log4j.EnhancedPatternLayout | |
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n | |
# Adjust logging levels that should differ from root logger | |
log4j.logger.org.apache.zookeeper=WARN | |
log4j.logger.org.apache.hadoop=WARN | |
log4j.logger.org.eclipse.jetty=WARN | |
log4j.logger.org.eclipse.jetty.server.Server=INFO | |
log4j.logger.org.eclipse.jetty.server.ServerConnector=INFO | |
# set to INFO to enable infostream log messages | |
log4j.logger.org.apache.solr.update.LoggingInfoStream=OFF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment