我正在按照教程使用 Windows 7、Java 版本 1.8 和 Solr 版本 4.10.2 设置 Solr ( http://lucene.apache.org/solr/quickstart.html)。
Java安装在C:\root\java,Solr安装在c:\root\solr-4.10.2。
我添加了 2 个环境变量作为用户变量:
CLASSPATH = C:\ROOT\solr-4.10.2\dist\solr-core-4.10.2.jar
JAVA_HOME = c:\root\java
然后我在命令提示符下运行以下代码:
cd c:\root\solr-4.10.2\bin & solr start -e cloud -noprompt
输出粘贴在下面。 collection1 的 Solr 服务器似乎工作正常,尽管未添加 gettingstarted 核心。但是,为什么 ZkCLI 和 SolrCLI 会出现错误?我做错了什么吗?
Welcome to the SolrCloud example
Starting up Solr nodes for your example SolrCloud cluster.
Starting node1 on port 8983 using command:
solr -cloud -p 8983 -d node1
Waiting for 0 seconds, press a key to continue ...
Starting node2 on port 7574 using command:
solr -cloud -p 7574 -d node2 -z localhost:9983
Waiting for 0 seconds, press a key to continue ...
Now let's create a new collection for indexing documents in your 2-node cluster.
Deploying default Solr configuration files to embedded ZooKeeper
Error: Could not find or load main class org.apache.solr.cloud.ZkCLI
Creating new collection gettingstarted with 2 shards and replication factor 2 us
ing Collections API command:
"http://localhost:8983/solr/admin/collections?action=CREATE&name=gettingstarted&
replicationFactor=2&numShards=2&collection.configName=default&maxShardsPerNode=3
&wt=json&indent=2"
For more information about the Collections API, please see: https://cwiki.apache
.org/confluence/display/solr/Collections+API
Error: Could not find or load main class org.apache.solr.util.SolrCLI
SolrCloud example is running, please visit http://localhost:8983/solr"
c:\ROOT\solr-4.10.2\bin>java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
c:\ROOT\solr-4.10.2\bin>
最佳答案
在不同的 site 上找到这个它对我有用。
如果您在没有云选项的情况下运行 solr,它会执行一些云选项工作所需的额外操作。
因此,只需运行 solr.cmd start
,然后运行 solr.cmd stop -p 8983
即可做好准备。
最后运行solr.cmd start -e cloud -noprompt
。
应该在教程中注明,但 Solr 似乎对 Windows 不友好。我认为环境变量也很重要,因此感谢您提供该信息。
关于java - Solr 设置 - 错误 : Could not find or load main class org. apache.solr.cloud.ZkCLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26973899/