Your ZK connection string ( hosts) is different from the dynamic ensemble config ( hosts)
警告信息:
Your ZK connection string ( hosts) is different from the dynamic ensemble config ( hosts). Solr does not currently support dynamic reconfiguration and will only be able to connect to the zk hosts in your connection string.
原因:
ZooKeeper的v3.5及以上版本,新增了支持动态修改配置的特性,而新版Solr也实现了支持该特性。
当Solr配置的ZooKeeper相关属性或所挂载运行的Tomcat中ZooKeeper的相关配置与ZooKeeper本身的配置不一致时,会提示该警告。
例如:ZooKeeper配置主机用的是主机名c1、c2、c3,而Solr或Tomcat用的是IP,就会出发动态修改配置(就是在线动态修改配置)
解决方法:
使用项目的配置属性要跟ZooKeeper的zoo.cfg的属性一致。
如果是Solr项目,一般是修改Solr的solr.in.sh和zoo.cfg、Tomcat的catalina.sh和server.xml中跟ZooKeeper相关的属性
例子:
假设有4台机,IP及主机名如下:
192.168.100.105 c1 192.168.100.110 c2 192.168.100.115 c3 192.168.100.120 c4
部署了ZooKeeper+Tomcat+Solr(SolrCloud模式)
其中ZooKeeper的zoo.cfg的节点配置是:
server.1=c1:2888:3888 server.2=c2:2888:3888 server.3=c3:2888:3888 server.4=c4:2888:3888
而Tomcat的catalina.sh中关于ZooKeeper的配置是:
#JAVA_OPTS="$JAVA_OPTS -DzkHost=192.168.100.105:2181,192.168.100.110:2181,192.168.100.115:2181,192.168.100.120:2181"
由于一个用的是主机名,一个用的是IP,所以会触发标题的警告提示
需要把Tomcat的catalina.sh的配置改为:
JAVA_OPTS="$JAVA_OPTS -DzkHost=c1:2181,c2:2181,c3:2181,c4:2181"
* 也可以是ZooKeeper和Tomcat的节点配置都使用IP
参考资料:
https://issues.apache.org/jira/browse/SOLR-14371
https://issues.apache.org/jira/browse/SOLR-14389