Solr setup
Adding new port
e.g., for viewing Solrtm - 8983
yum install policycoreutils-python
semanage port -l
semanage port -a -t http_port_t -p tcp 8983
netstat -tnlp
netstat -anp | grep 8983
semanage port -l | grep solr
nano /usr/lib/firewalld/services/solr-server.xml
nano /etc/services
ss -tnlp|grep solr
Configuring sudo access
- Log in to the system as theroot user.
- Create a normal user account using theuseradd command. Replace USERNAME with the user name that you wish to create.
useradd <USERNAME>
- Set a password for the new user using thepasswd command.
passwd <USERNAME>
Changing password for user USERNAME. New password: Retype new password: passwd: all authentication tokens updated successfully. - Run thevisudo to edit the /etc/sudoers file. This file defines the policies applied by thesudo command.
visudo
- Find the lines in the file that grantsudo access to users in the group wheel when enabled.
## Allows people in group wheel to run all commands # %wheel ALL=(ALL) ALL
- Remove the comment character (#) at the start of the second line. This enables the configuration option.
- Save your changes and exit the editor.
- Add the user you created to thewheel group using the usermod command.
usermod -aG wheel <USERNAME>
- Test that the updated configuration allows the user you created to run commands using sudo.
- Use the su to switch to the new user account that you created.
su USERNAME -
- Use the groups to verify that the user is in the wheelgroup.
$ groups USERNAME wheel
- Use the sudocommand to run the whoami command. As this is the first time you have run a command using sudofrom this user account the banner message will be displayed. You will be also be prompted to enter the password for the user account.We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for USERNAME: root
$sudo whoami
The last line of the output is the user name returned by thewhoami command. If sudo is configured correctly this value will be root.
Building Solr Search {Apache Lucene}
Apache Solr™
/etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
yum install java-1.8.0-openjdk
/etc/security/limits.conf
master soft nproc 65535
master hard nproc 65535
master soft nofile 65535
master hard nofile 65535
solr soft nproc 65535
solr hard nproc 65535
solr soft nofile 65535
solr hard nofile 65535
# vim /etc/pam.d/login
session required pam_limits.so
chown -R apache:apache /root/solr-7.7.0
mkdir /opt/solr-search
cd /opt
wget http://archive.apache.org/dist/lucene/solr/7.7.0/solr-7.7.0.tgz
wget http://mirror.linux-ia64.org/apache/lucene/solr/8.0.0/solr-8.0.0.tgz
tar xzvf solr*
mv solr-8.0.0/* /opt/solr-search
bin/solr start
bin/solr start -force
NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.
Started Solr server on port 8983 (pid=15613). Happy searching!
Check if Solr is Running
yum install lsof
If you’re not sure if Solr is running locally, you can use the status command:
bin/solr status
This will search for running Solr instances on your computer and then gather basic information about them, such as the version and memory usage.
Found 1 Solr nodes:
Solr process 16054 running on port 8983
INFO - 2019-03-17 00:58:19.294; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
{
"solr_home":"/opt/solr-search/server/solr",
"version":"8.0.0 2ae4746365c1ee72a0047ced7610b2096e438979 - jimczi - 2019-03-08 12:06:06",
"startTime":"2019-03-17T00:48:03.557Z",
"uptime":"0 days, 0 hours, 10 minutes, 16 seconds",
"memory":"70.8 MB (%14.4) of 490.7 MB"}
That’s it! Solr is running. If you need convincing, use a Web browser to see the Admin Console.
http://94.237.77.201:8983/solr/
in case, smth will not operate properly - https://lucene.apache.org/solr/guide/7_0/taking-solr-to-production.html#...
Running as SERVICE
cd /opt
wget http://archive.apache.org/dist/lucene/solr/7.7.0/solr-7.7.0.tgz
tar xzf solr-7.7.0.tgz solr-7.7.0/bin/install_solr_service.sh --strip-components=2
tar xzf solr-8.0.0.tgz solr-8.0.0/bin/install_solr_service.sh --strip-components=2
bash ./install_solr_service.sh solr-8.0.0.tgz
sudo bash ./install_solr_service.sh solr-7.7.0.tgz
id: solr: no such user
Creating new user: solr
Extracting solr-8.0.0.tgz to /opt
Installing symlink /opt/solr -> /opt/solr-8.0.0 ...
Installing /etc/init.d/solr script ...
Installing /etc/default/solr.in.sh ...
Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh
*** [WARN] *** Your Max Processes Limit is currently 4096.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Waiting up to 180 seconds to see Solr running on port 8983 [-]
Started Solr server on port 8983 (pid=18090). Happy searching!
Found 1 Solr nodes:
Solr process 18090 running on port 8983
INFO - 2019-03-17 01:37:30.748; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
{
"solr_home":"/var/solr/data",
"version":"8.0.0 2ae4746365c1ee72a0047ced7610b2096e438979 - jimczi - 2019-03-08 12:06:06",
"startTime":"2019-03-17T01:37:00.031Z",
"uptime":"0 days, 0 hours, 0 minutes, 31 seconds",
"memory":"42.7 MB (%8.7) of 490.7 MB"}
/etc/default/solr.in.sh
SOLR_PID_DIR="/var/solr"
SOLR_HOME="/var/solr/data"
LOG4J_PROPS="/var/solr/log4j2.xml"
SOLR_LOGS_DIR="/var/solr/logs"
SOLR_PORT="8983"
Once the script completes, Solr will be installed as a service and running in the background on your server (on port 8983). To verify, you can do:
sudo service solr status
nano /opt/solr-8.0.0/server/solr/configsets/_default/conf/solrconfig.xml
nano /opt/solr-7.7.0/server/solr/configsets/_default/conf/solrconfig.xml
<autoSoftCommit>
<maxTime>${solr.autoSoftCommit.maxTime:10000}</maxTime>
</autoSoftCommit>
nano /etc/default/solr.in.sh
SOLR_HOST=solr1.example.com
SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=10000"
service php-7.3.3-fpm restart
service php-7.2.16-fpm restart
/etc/init.d/php-5.6.40-fpm restart
service httpd restart
Start and Restart
The start
command starts Solr. The restart
command allows you to restart Solr while it is already running or if it has been stopped already.
The start
and restart
commands have several options to allow you to run in SolrCloud mode, use an example configuration set, start with a hostname or port that is not the default and point to a local ZooKeeper ensemble.
bin/solr start [options]
bin/solr start -help
bin/solr restart [options]
bin/solr restart -help
Solr Extension
chown -R apache:apache /root/solr-7.7.0
chmod 755 -R /root/solr-7.7.0
You need to edit /etc/sysctl.conf file and put following line so that after reboot the setting will remain as it is:# vi /etc/sysctl.conf
Append a config directive as follows:fs.file-max = 100000
Save and close the file. Users need to log out and log back in again to changes take effect or just type the following command:# sysctl -p
Verify your settings with command:# cat /proc/sys/fs/file-max
- pecl install solr
extension=json.so
extension=solr.so
- /opt/php-5.6.40/bin/pecl -C ./pear.conf update-channels
/opt/php-5.6.40/bin/pecl install solr
->EITHER<-
cd /usr/local/src/
cd php5-build
wget -O solr.tar.gz http://pecl.php.net/get/solr
tar xzvf solr.tar.gz
cd solr-2.4.0
/opt/php-5.6.40/bin/phpize
./configure --with-php-config=/opt/php-5.6.40/bin/php-config && make
make test
cp /usr/local/src/php5-build/solr-2.4.0/modules/solr.so /opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/
cd /usr/local/src/php7-build
wget -O solr.tar.gz http://pecl.php.net/get/solr
tar xzvf solr.tar.gz
cd solr-2.4.0
/opt/php-7.2.16/bin/phpize
-> source: /usr/local/src/php7-build/solr-2.4.0/src/php7
./configure --with-php-config=/opt/php-7.2.16/bin/php-config
make
make test
cp /usr/local/src/php7-build/solr-2.4.0/modules/solr.so /opt/php-7.2.16/lib/php/extensions/no-debug-non-zts-20170718/
extension=solr.so
Removing SOLR (uninstall solr)
- cd /opt
- sudo service solr stop -alls
solr stop -p 8983
- lsof -i :8983
- kill -9 PID#
- service solr stop
- sudo rm -rf /etc/init.d/solr
- sudo rm -rf solr-#.#.#
- sudo rm -rf /var/solr/data/solr.xml
- sudo rm -rf /etc/default/solr.in.sh
- sudo rm -rf /var/solr