Upgrade Apache Solr from 4.10.4 to 6.6.0 on Cent o

2019-07-05 20:15发布

问题:

How to upgrade Apache solr from existing version 4.10.4 to 6.6.0 (A latest one) On linux centos 7 operating system.

回答1:

stop existing running solr

sudo service solr stop

confirm its stopped or not

sudo service solr status

You can take backup of existing solr data from /var/solr/data/< core_name >, But reindexing solr data after upgrading solr version will give best performance without any unknown issues.

now remove existing solr from centos

sudo rm -r /var/solr

remove solr from following location if its there

sudo rm -r /opt/solr
sudo rm /etc/init.d/solr

In my case following path was not exist to delete, Delete if exists in your case

sudo rm -r /opt/solr/solr-4.10.4

remove existing solr user with home directory

sudo userdel -r solr

for ubuntu

sudo deluser --remove-home solr

remove existing group

sudo groupdel solr

for ubuntu

sudo deluser --group solr

restart your system

sudo reboot

Check supporting application and download solr 6.6

Check which version Java version is installed on your machine

java -version

Check available java versions, and update to latest version

yum list available java*

Install latest java version

sudo yum install <jdk version>

download and extract installation folder

mkdir /home/user/temp
cd temp
wget http://apache.org/dist/lucene/solr/6.6.0/solr-6.6.0.tgz
tar -zxvf solr-6.6.0.tgz

install solr

cd solr-6.6.0/
sudo bin/install_solr_service.sh /home/user/temp/solr-6.6.0.tgz

after successful installation you can see following output

id: solr: no such user Creating new user: solr

Extracting /home/user/temp/solr-6.6.0.tgz to /opt

Installing symlink /opt/solr -> /opt/solr-6.6.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 Waiting up to 180 seconds to see Solr running on port 8983 [] Started Solr server on port 8983 (pid=4802). Happy searching!

 Found 1 Solr nodes: 

Solr process 4802 running on port 8983 {
"solr_home":"/var/solr/data", "version":"6.6.0 5c7a7b65d2aa7ce5ec96458315c661a18b320241 - ishan - 2017-05-30 07:32:53", "startTime":"2017-06-26T07:02:51.523Z", "uptime":"0 days, 0 hours, 0 minutes, 13 seconds", "memory":"34.4 MB (%7) of 490.7 MB"}

Now check if you can access solr admin panel

http://localhost:8983/solr/

Check if solr is running, start solr if not running and then try

sudo service solr status

If you are still not able to access solr admin panel, then may you OS firewall is blocking to port 8983

use following commands to allow port 8983 in firewall

sudo firewall-cmd --zone = public --add-port = 8983 / tcp --permanent
sudo firewall-cmd --reload

For further data migration please see Migration of solr cores after solr version upgradation from 4.10.4 to 6.6.0 on Cent os 7