搭建SolrCloud集群、上传solrhome的配置文件到ZooKeeper时报错:Could not find or load main class org.apache.solr.cloud.ZkCLI。
./zkcli.sh -zkhost 39.105.195.XX:2181,114.115.171.XX:2181,39.105.81.XX:2181 -cmd upconfig -confdir /usr/local/solr-cloud/solr-home/home8983/collection1/conf/ -confname myconf
./zkcli.sh: line 13: unzip: command not found
Error: Could not find or load main class org.apache.solr.cloud.ZkCLI
错误提示是说:找不到命令、找不到org.apache.solr.cloud.ZkCLI这个类。
解决方案:
在你solr解压完成后的example目录下找到start.jar这个包,然后解压它。
我的是在/usr/local/solr-4.10.3/example这个目录、根据你自己解压的目录找到它。
#执行解压命令
java -jar start.jar0 [main] INFO org.eclipse.jetty.server.Server – jetty-8.1.10.v20130312
50 [main] INFO org.eclipse.jetty.deploy.providers.ScanningAppProvider – Deployment monitor /usr/local/solr-4.10.3/example/contexts at interval 0
54 [main] INFO org.eclipse.jetty.deploy.DeploymentManager – Deployable added: /usr/local/solr-4.10.3/example/contexts/solr-jetty-context.xml
1490 [main] INFO org.eclipse.jetty.webapp.StandardDescriptorProcessor – NO JSP Support for /solr, did not find org.apache.jasper.servlet.JspServlet
1555 [main] INFO org.apache.solr.servlet.SolrDispatchFilter – SolrDispatchFilter.init()
1577 [main] INFO org.apache.solr.core.SolrResourceLoader – JNDI not configured for solr (NoInitialContextEx)
1577 [main] INFO org.apache.solr.core.SolrResourceLoader – solr home defaulted to 'solr/' (could not find system property or JNDI)
1583 [main] INFO org.apache.solr.core.SolrResourceLoader – new SolrResourceLoader for directory: 'solr/'
1780 [main] INFO org.apache.solr.core.ConfigSolr – Loading container configuration from /usr/local/solr-4.10.3/example/solr/solr.xml
1881 [main] INFO org.apache.solr.core.CoresLocator – Config-defined core root directory: /usr/local/solr-4.10.3/example/solr
1887 [main] INFO org.apache.solr.core.CoreContainer – New CoreContainer 1325144078
。。。。。。。
4583 [searcherExecutor-6-thread-1] INFO org.apache.solr.core.SolrCore – [collection1] webapp=null path=null params={q=static+firstSearcher+warming+in+solrconfig.xml&distrib=false&event=firstSearcher} hits=0 status=0 QTime=100
4583 [searcherExecutor-6-thread-1] INFO org.apache.solr.core.SolrCore – QuerySenderListener done.
4590 [main] INFO org.eclipse.jetty.server.AbstractConnector – Started SocketConnector@0.0.0.0:8983
4583 [searcherExecutor-6-thread-1] INFO org.apache.solr.handler.component.SpellCheckComponent – Loading spell index for spellchecker: default
4591 [searcherExecutor-6-thread-1] INFO org.apache.solr.handler.component.SpellCheckComponent – Loading spell index for spellchecker: wordbreak
4591 [searcherExecutor-6-thread-1] INFO org.apache.solr.core.SolrCore – [collection1] Registered new searcher Searcher@28c019ee[collection1] main{StandardDirectoryReader(segments_1:1:nrt)}
上面的命令执行完成后、按Ctrl+c结束、或者打开一个新的xshell窗口。
然后在/usr/local/solr-4.10.3/example/scripts/cloud-scripts(按自己solr解压的目录)重新执行上传命令即可。
#重新执行上传命令
./zkcli.sh -zkhost 39.105.195.XX:2181,114.115.171.XX:2181,39.105.81.XX:2181 -cmd upconfig -confdir /usr/local/solr-cloud/solr-home/home8983/collection1/conf/ -confname myconfINFO - 2019-01-30 17:01:22.834; org.apache.zookeeper.Environment; Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
INFO - 2019-01-30 17:01:22.836; org.apache.zookeeper.Environment; Client environment:host.name=hadoop03
INFO - 2019-01-30 17:01:22.838; org.apache.zookeeper.Environment; Client environment:java.version=1.8.0_171
INFO - 2019-01-30 17:01:22.839; org.apache.zookeeper.Environment; Client environment:java.vendor=Oracle Corporation
INFO - 2019-01-30 17:01:22.839; org.apache.zookeeper.Environment; Client environment:java.home=/usr/local/java/jdk1.8.0_171/jre
。。。。。。。
INFO - 2019-01-30 17:01:25.808; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/velocity/query_spatial.vm
INFO - 2019-01-30 17:01:25.834; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/protwords.txt
INFO - 2019-01-30 17:01:25.854; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/_schema_analysis_synonyms_english.json
INFO - 2019-01-30 17:01:25.875; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/_rest_managed.json
INFO - 2019-01-30 17:01:25.895; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/elevate.xml
INFO - 2019-01-30 17:01:25.915; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/update-script.js
INFO - 2019-01-30 17:01:25.937; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/currency.xml
INFO - 2019-01-30 17:01:25.965; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/admin-extra.menu-top.html
INFO - 2019-01-30 17:01:25.985; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/admin-extra.menu-bottom.html
INFO - 2019-01-30 17:01:26.005; org.apache.solr.common.cloud.SolrZkClient; makePath: /configs/myconf/stopwords.txt
INFO - 2019-01-30 17:01:26.034; org.apache.zookeeper.ZooKeeper; Session: 0x1689950ca720019 closed
INFO - 2019-01-30 17:01:26.036; org.apache.zookeeper.ClientCnxn$EventThread; EventThread shut down