アップグレードをテストするために古いバージョンをインストール
wget http://public-repo-1.hortonworks.com/HDP-SOLR/hdp-solr-ambari-mp/solr-service-mpack-2.2.8.tar.gzambari-server install-mpack --mpack=./solr-service-mpack-2.2.8.tar.gz
ambari-server restart
# Install Solr from Ambari Web UI normally
ブラウザーから、現在のコンフィグを取っておく(後で比較する)
アップグレード
wget http://public-repo-1.hortonworks.com/HDP-SOLR/hdp-solr-ambari-mp/solr-service-mpack-3.0.0.tar.gz
ambari-server upgrade-mpack --mpack=./solr-service-mpack-3.0.0.tar.gz
ambari-server restart
新しいrepoファイルをダウンロード(追記:repoinfo.xmlが正しい場合は必要ないかも?)
curl -o /etc/yum.repos.d/hdp-solr.repo http://public-repo-1.hortonworks.com/HDP-SOLR-3.0.0-100/repos/centos6/hdp-solr.repo
ちなみに、下記ファイルは同じではないが、シムリンクでsolr-ambari-mpack-3.0.0以下にある
[root@sandbox-hdp HDP]# pwd
/var/lib/ambari-server/resources/stacks/HDP
[root@sandbox-hdp HDP]# grep -IRs 'HDP-SOLR' -l *
2.4/services/SOLR/repos/repoinfo.xml
2.5/repos/repoinfo.xml
2.6/services/SOLR/repos/repoinfo.xml
[root@sandbox-hdp HDP]# grep -IRs 'public-repo-1.hortonworks.com/HDP-SOLR-3.0.0-100' -l *
2.6/services/SOLR/repos/repoinfo.xml
ちなみに、下記ファイルは同じではないが、シムリンクでsolr-ambari-mpack-3.0.0以下にある
[root@sandbox-hdp HDP]# pwd
/var/lib/ambari-server/resources/stacks/HDP
[root@sandbox-hdp HDP]# grep -IRs 'HDP-SOLR' -l *
2.4/services/SOLR/repos/repoinfo.xml
2.5/repos/repoinfo.xml
2.6/services/SOLR/repos/repoinfo.xml
[root@sandbox-hdp HDP]# grep -IRs 'public-repo-1.hortonworks.com/HDP-SOLR-3.0.0-100' -l *
2.6/services/SOLR/repos/repoinfo.xml
mv /var/run/solr/solr-8983.pid /var/run/solr/solr-8983.pid.backup
# Delete Solr Service from Ambari web UI
mv /var/run/solr/solr-8983.pid.backup /var/run/solr/solr-8983.pid
/opt/lucidworks-hdpsearch/solr/bin/solr stop -all
# Metrics didn't exist (from 2.2.9)
#/opt/lucidworks-hdpsearch/metrics/bin/solr.metrics.sh stop
#bash: /opt/lucidworks-hdpsearch/metrics/bin/solr.metrics.sh: No such file or directory
mkdir /opt/lucidworks-hdpsearch-backup
cp -vR /opt/lucidworks-hdpsearch/* /opt/lucidworks-hdpsearch-backup/
yum upgrade lucidworks-hdpsearch -y
# Didn't work, ”Unrecognized or misplaced argument: cp!”
#/opt/lucidworks-hdpsearch/solr/bin/solr zk cp -z `hostname -f`:2181 -r zk:/solr/configs /tmp/solr/configs
/opt/lucidworks-hdpsearch/solr/bin/solr zk -z `hostname -f`:2181/solr -downconfig -n collection1 -d /tmp/solr/configs
[root@sandbox-hdp ~]# cd /tmp/solr/configs/conf/
[root@sandbox-hdp conf]# ls -ltr
total 148
-rw-r--r-- 1 root root 873 Mar 6 05:56 protwords.txt
-rw-r--r-- 1 root root 3974 Mar 6 05:56 currency.xml
-rw-r--r-- 1 root root 61978 Mar 6 05:56 solrconfig.xml
-rw-r--r-- 1 root root 55543 Mar 6 05:56 managed-schema
-rw-r--r-- 1 root root 1119 Mar 6 05:56 synonyms.txt
-rw-r--r-- 1 root root 1348 Mar 6 05:56 elevate.xml
-rw-r--r-- 1 root root 781 Mar 6 05:56 stopwords.txt
-rw-r--r-- 1 root root 308 Mar 6 05:56 params.json
drwxr-xr-x 2 root root 4096 Mar 6 05:56 lang
# Edit solrconfig.xml and upload
<luceneMatchVersion>6.6.2</luceneMatchVersion>
/opt/lucidworks-hdpsearch/solr/bin/solr zk -z `hostname -f`:2181/solr -upconfig -n collection1 -d /tmp/solr/configs
# Add Solr form Ambari web ui
# In the service selection screen, be sure the version displayed is 6.6.2
# After installing, review the config
# healthcheck
sudo -iu solr /opt/lucidworks-hdpsearch/solr/bin/solr healthcheck -c collection1 -z `hostname -f`:2181/solr
{
"collection":"collection1",
"status":"healthy",
"numDocs":0,
"numShards":2,
"shards":[
{
"shard":"shard1",
"status":"healthy",
"replicas":[{
"name":"core_node1",
"url":"http://sandbox-hdp.hortonworks.com:8983/solr/collection1_shard1_replica1/",
"numDocs":0,
"status":"active",
"uptime":"0 days, 0 hours, 12 minutes, 10 seconds",
"memory":"142.6 MB (%29) of 492 MB",
"leader":true}]},
{
"shard":"shard2",
"status":"healthy",
"replicas":[{
"name":"core_node2",
"url":"http://sandbox-hdp.hortonworks.com:8983/solr/collection1_shard2_replica1/",
"numDocs":0,
"status":"active",
"uptime":"0 days, 0 hours, 12 minutes, 10 seconds",
"memory":"142.6 MB (%29) of 492 MB",
"leader":true}]}]}
grep -vw 'href' /tmp/repo_ver_1.json > /tmp/repo_ver_1.1.json
sed -i.bak 's/HDP-SOLR-2.6-100/HDP-SOLR-3.0.0-100/g' /tmp/repo_ver_1.1.json
curl -si -u admin:admin "http://`hostname -f`:8080/api/v1/stacks/HDP/versions/2.6/repository_versions/1" -X PUT -H 'X-Requested-By: ambari' -d @/tmp/repo_ver_1.1.json
多分必要ない?
#mv /etc/yum.repos.d/ambari-hdp-1.repo ./
#ambari-server restart --skip-database-check; ambari-agent restart
補足:
curl -s -u admin:admin "http://`hostname -f`:8080/api/v1/stacks/HDP/versions/2.6/repository_versions/1?fields=operating_systems/repositories/Repositories/*" -o /tmp/repo_ver_1.jsongrep -vw 'href' /tmp/repo_ver_1.json > /tmp/repo_ver_1.1.json
sed -i.bak 's/HDP-SOLR-2.6-100/HDP-SOLR-3.0.0-100/g' /tmp/repo_ver_1.1.json
curl -si -u admin:admin "http://`hostname -f`:8080/api/v1/stacks/HDP/versions/2.6/repository_versions/1" -X PUT -H 'X-Requested-By: ambari' -d @/tmp/repo_ver_1.1.json
多分必要ない?
#mv /etc/yum.repos.d/ambari-hdp-1.repo ./
#ambari-server restart --skip-database-check; ambari-agent restart