带有外部动物园管理员的 Solr 云
Solr cloud with external zookeeper
我正在学习本教程:https://gist.github.com/kalharbi/fd29661b9926eb087c45
正在使用 2 个节点配置 solr 云。
1.Configured machine:192.168.1.56:2181(localadmin4), 192.168.1.55:2182(localadmin8) 上的动物园管理员
检查状态时,两者都在工作:
localadmin8@localadmin8:/opt/solr$ ../zookeeper/bin/zkServer.sh status /data/zookeeper/z2/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/z2/zoo.cfg
Mode: leader
localadmin4@localadmin4:/opt/solr$ ../zookeeper/bin/zkServer.sh status /data/zookeeper/z1/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/z1/zoo.cfg
Mode: follower
2.started solr
localadmin4@localadmin4:/opt/solr$ ./bin/solr start -c -p 8983 -z 192.168.1.56:2181,192.168.1.55:2182
localadmin8@localadmin8:/opt/solr$ ./bin/solr start -c -p 8984 -z 192.168.1.56:2181,192.168.1.55:2182
3.checked 浏览器中的 solr 管理:http://192.168.1.56:8983, http://192.168.1.55:8984 。两个 solr 都工作正常。
4.uploaded zookeeper 的配置:
localadmin4@localadmin4:/opt/solr$ ./server/scripts/cloud-scripts/zkcli.sh -cmd upconfig -zkhost 192.168.1.56:2181 -confdir ./server/solr/configsets/data_driven_schema_configs/conf/ -confname l-config
它给了我以下响应:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">33011</int>
</lst>
<lst name="failure">
<str name="127.0.1.1:8984_solr">org.apache.solr.client.solrj.SolrServerException:Server refused connection at: http://127.0.1.1:8984/solr</str>
</lst>
<lst name="success">
<lst name="127.0.1.1:8983_solr">
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1957</int>
</lst>
<str name="core">onix_shard2_replica1</str>
</lst>
</lst>
</response>
而不是命中 192.168.1.55:8984_solr ,而是命中 127.0.1.1:8984_solr.
如何解决这个问题?
这可能是由于 Solr 在启动时检测到自己的错误 IP,因此在 Solr 集群中注册节点时使用了错误的 IP。
你可以tell Solr which IP to use by giving the embedded Jetty container the IP to use(或者仅用于节点内通信,使用SOLR_HOST
应该足够了)。
Someone asked me how to ensure that Solr is exposed exclusively on a server’s internal IP address so I thought this bit of information would be useful more generally.
On Linux, edit the solr.in.sh file, find the property called SOLR_HOST (it is commented out by default) and set its value to the IP address or the host name that you want Solr to listen for requests.
SOLR_HOST="192.168.1.55"
The procedure is similar on Windows, except that the file to be edited is solr.in.cmd.
It was pointed out to me later that setting SOLR_HOST is not enough because the host/IP set by that property is only used by SolrCloud for making inter-shard requests. We also need to set a property used by Jetty in solr.in.sh or solr.in.cmd:
SOLR_OPTS="$SOLR_OPTS -Djetty.host=192.168.1.55"
你有没有像这样添加IP 127.0.1.1 应该是127.0.0.1
crosscheck.
还要确保您使用正确的服务器节点和服务器 ID 映射文件正确修改了 zoo.cfg 文件。
例如:
server.1=127.0.0.1:2222:2223
server.2=127.0.0.1:3333:3334
我在 External Zookeeper with Solr Cloud 上的博客可能会对您有所帮助。
我正在学习本教程:https://gist.github.com/kalharbi/fd29661b9926eb087c45
正在使用 2 个节点配置 solr 云。
1.Configured machine:192.168.1.56:2181(localadmin4), 192.168.1.55:2182(localadmin8) 上的动物园管理员 检查状态时,两者都在工作:
localadmin8@localadmin8:/opt/solr$ ../zookeeper/bin/zkServer.sh status /data/zookeeper/z2/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/z2/zoo.cfg
Mode: leader
localadmin4@localadmin4:/opt/solr$ ../zookeeper/bin/zkServer.sh status /data/zookeeper/z1/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/z1/zoo.cfg
Mode: follower
2.started solr
localadmin4@localadmin4:/opt/solr$ ./bin/solr start -c -p 8983 -z 192.168.1.56:2181,192.168.1.55:2182
localadmin8@localadmin8:/opt/solr$ ./bin/solr start -c -p 8984 -z 192.168.1.56:2181,192.168.1.55:2182
3.checked 浏览器中的 solr 管理:http://192.168.1.56:8983, http://192.168.1.55:8984 。两个 solr 都工作正常。
4.uploaded zookeeper 的配置: localadmin4@localadmin4:/opt/solr$ ./server/scripts/cloud-scripts/zkcli.sh -cmd upconfig -zkhost 192.168.1.56:2181 -confdir ./server/solr/configsets/data_driven_schema_configs/conf/ -confname l-config
它给了我以下响应:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">33011</int>
</lst>
<lst name="failure">
<str name="127.0.1.1:8984_solr">org.apache.solr.client.solrj.SolrServerException:Server refused connection at: http://127.0.1.1:8984/solr</str>
</lst>
<lst name="success">
<lst name="127.0.1.1:8983_solr">
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1957</int>
</lst>
<str name="core">onix_shard2_replica1</str>
</lst>
</lst>
</response>
而不是命中 192.168.1.55:8984_solr ,而是命中 127.0.1.1:8984_solr.
如何解决这个问题?
这可能是由于 Solr 在启动时检测到自己的错误 IP,因此在 Solr 集群中注册节点时使用了错误的 IP。
你可以tell Solr which IP to use by giving the embedded Jetty container the IP to use(或者仅用于节点内通信,使用SOLR_HOST
应该足够了)。
Someone asked me how to ensure that Solr is exposed exclusively on a server’s internal IP address so I thought this bit of information would be useful more generally. On Linux, edit the solr.in.sh file, find the property called SOLR_HOST (it is commented out by default) and set its value to the IP address or the host name that you want Solr to listen for requests.
SOLR_HOST="192.168.1.55"
The procedure is similar on Windows, except that the file to be edited is solr.in.cmd.
It was pointed out to me later that setting SOLR_HOST is not enough because the host/IP set by that property is only used by SolrCloud for making inter-shard requests. We also need to set a property used by Jetty in solr.in.sh or solr.in.cmd:
SOLR_OPTS="$SOLR_OPTS -Djetty.host=192.168.1.55"
你有没有像这样添加IP 127.0.1.1 应该是127.0.0.1
crosscheck.
还要确保您使用正确的服务器节点和服务器 ID 映射文件正确修改了 zoo.cfg 文件。
例如:
server.1=127.0.0.1:2222:2223
server.2=127.0.0.1:3333:3334
我在 External Zookeeper with Solr Cloud 上的博客可能会对您有所帮助。