4

我想用 solr 4.3.0 运行一个 solr 云。

(我正在使用 aws ubuntu-12.04-lts 微型实例)

所以我遵循了这个教程

这基本上是说,启动 zookeeper 并将 solr 实例连接到它。

下面是我如何启动 zookeeper。

  • 首先,我复制了教程中描述的配置

    sudo cp zookeeper-3.4.5/conf/zoo_sample.cfg zookeeper-3.4.5/conf/zoo.cfg
    
  • 然后我启动了动物园管理员

    ubuntu@ip-10-48-159-36:/opt$ sudo zookeeper-3.4.5/bin/zkServer.sh start
    JMX enabled by default
    Using config: /opt/zookeeper-3.4.5/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED
    

    到目前为止看起来还不错。

  • 我检查了状态:

    ubuntu@ip-10-48-159-36:/opt$ sudo zookeeper-3.4.5/bin/zkServer.sh status
    JMX enabled by default
    Using config: /opt/zookeeper-3.4.5/bin/../conf/zoo.cfg
    Error contacting service. It is probably not running.
    

    这似乎已经有点奇怪了。

  • 如果我尝试与客户端(远程和本地)连接,它似乎工作

    ubuntu@ip-10-234-223-69:/opt$ zookeeper-3.4.5/bin/zkCli.sh -server ec2-54-247-144-120.eu-west-1.compute.amazonaws.com:2181
    Connecting to ec2-54-247-144-120.eu-west-1.compute.amazonaws.com:2181
    2013-06-07 11:07:01,996 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT
    2013-06-07 11:07:02,000 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=ip-10-234-223-69.eu-west-1.compute.internal
    2013-06-07 11:07:02,000 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.6.0_27
    2013-06-07 11:07:02,002 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Sun Microsystems Inc.
    2013-06-07 11:07:02,003 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-6-openjdk-amd64/jre
    2013-06-07 11:07:02,003 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/opt/zookeeper-3.4.5/bin/../build/classes:/opt/zookeeper-3.4.5/bin/../build/lib/*.jar:/opt/zookeeper-3.4.5/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/zookeeper-3.4.5/bin/../lib/slf4j-api-1.6.1.jar:/opt/zookeeper-3.4.5/bin/../lib/netty-3.2.2.Final.jar:/opt/zookeeper-3.4.5/bin/../lib/log4j-1.2.15.jar:/opt/zookeeper-3.4.5/bin/../lib/jline-0.9.94.jar:/opt/zookeeper-3.4.5/bin/../zookeeper-3.4.5.jar:/opt/zookeeper-3.4.5/bin/../src/java/lib/*.jar:/opt/zookeeper-3.4.5/bin/../conf:
    2013-06-07 11:07:02,004 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
    2013-06-07 11:07:02,008 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
    2013-06-07 11:07:02,009 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
    2013-06-07 11:07:02,018 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
    2013-06-07 11:07:02,019 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
    2013-06-07 11:07:02,019 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=3.2.0-40-virtual
    2013-06-07 11:07:02,020 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=ubuntu
    2013-06-07 11:07:02,020 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/home/ubuntu
    2013-06-07 11:07:02,021 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/opt
    2013-06-07 11:07:02,029 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=ec2-54-247-144-120.eu-west-1.compute.amazonaws.com:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@182d9c06
    Welcome to ZooKeeper!
    2013-06-07 11:07:02,074 [myid:] - INFO  [main-SendThread(ip-10-48-159-36.eu-west-1.compute.internal:2181):ClientCnxn$SendThread@966] - Opening socket connection to server ip-10-48-159-36.eu-west-1.compute.internal/10.48.159.36:2181. Will not attempt to authenticate using SASL (unknown error)
    JLine support is enabled
    [zk: ec2-54-247-144-120.eu-west-1.compute.amazonaws.com:2181(CONNECTING) 0] 2013-06-07 11:07:32,100 [myid:] - INFO  [main-SendThread(ip-10-48-159-36.eu-west-1.compute.internal:2181):ClientCnxn$SendThread@1083] - Client session timed out, have not heard from server in 30038ms for sessionid 0x0, closing socket connection and attempting reconnect
    2013-06-07 11:07:33,204 [myid:] - INFO  [main-SendThread(ip-10-48-159-36.eu-west-1.compute.internal:2181):ClientCnxn$SendThread@966] - Opening socket connection to server ip-10-48-159-36.eu-west-1.compute.internal/10.48.159.36:2181. Will not attempt to authenticate using SASL (unknown error)
    
  • 现在我尝试将一个 solr 实例连接到它。在 tomcat7 的 Web 界面中它只告诉我“503 - 服务器正在关闭”,所以我检查了 solr 日志

    2013-06-07 11:16:36,065 [pool-2-thread-1] INFO  org.apache.solr.servlet.SolrDispatchFilter . SolrDispatchFilter.init()
    2013-06-07 11:16:36,100 [pool-2-thread-1] INFO  org.apache.solr.core.SolrResourceLoader . Using JNDI solr.home: /opt/solr-4.3.0/example/solr
    2013-06-07 11:16:36,132 [pool-2-thread-1] INFO  org.apache.solr.core.CoreContainer . looking for solr config file: /opt/solr-4.3.0/example/solr/solr.xml
    2013-06-07 11:16:36,138 [pool-2-thread-1] INFO  org.apache.solr.core.CoreContainer . New CoreContainer 1285984216
    2013-06-07 11:16:36,146 [pool-2-thread-1] INFO  org.apache.solr.core.CoreContainer . Loading CoreContainer using Solr Home: '/opt/solr-4.3.0/example/solr/'
    2013-06-07 11:16:36,152 [pool-2-thread-1] INFO  org.apache.solr.core.SolrResourceLoader . new SolrResourceLoader for directory: '/opt/solr-4.3.0/example/solr/'
    2013-06-07 11:16:36,567 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting socketTimeout to: 0
    2013-06-07 11:16:36,568 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting urlScheme to: http://
    2013-06-07 11:16:36,568 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting connTimeout to: 0
    2013-06-07 11:16:36,568 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting maxConnectionsPerHost to: 20
    2013-06-07 11:16:36,568 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting corePoolSize to: 0
    2013-06-07 11:16:36,568 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting maximumPoolSize to: 2147483647
    2013-06-07 11:16:36,568 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting maxThreadIdleTime to: 5
    2013-06-07 11:16:36,569 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting sizeOfQueue to: -1
    2013-06-07 11:16:36,569 [pool-2-thread-1] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory . Setting fairnessPolicy to: false
    2013-06-07 11:16:36,578 [pool-2-thread-1] INFO  org.apache.solr.client.solrj.impl.HttpClientUtil . Creating new http client, config:maxConnectionsPerHost=20&maxConnections=10000&socketTimeout=0&connTimeout=0&retry=false
    2013-06-07 11:16:36,879 [pool-2-thread-1] INFO  org.apache.solr.core.CoreContainer . Registering Log Listener
    2013-06-07 11:16:36,881 [pool-2-thread-1] INFO  org.apache.solr.core.CoreContainer . Zookeeper client=ec2-54-247-144-120.eu-west-1.compute.amazonaws.com:2181
    2013-06-07 11:16:36,888 [pool-2-thread-1] INFO  org.apache.solr.client.solrj.impl.HttpClientUtil . Creating new http client, config:maxConnections=500&maxConnectionsPerHost=16&socketTimeout=0&connTimeout=0
    2013-06-07 11:16:37,040 [pool-2-thread-1] INFO  org.apache.solr.common.cloud.ConnectionManager . Waiting for client to connect to ZooKeeper
    2013-06-07 11:16:52,046 [pool-2-thread-1] ERROR org.apache.solr.servlet.SolrDispatchFilter . Could not start Solr. Check solr/home property and the logs
    2013-06-07 11:16:52,103 [pool-2-thread-1] ERROR org.apache.solr.core.SolrCore . null:java.lang.RuntimeException: java.util.concurrent.TimeoutException: Could not connect to ZooKeeper ec2-54-247-144-120.eu-west-1.compute.amazonaws.com:2181 within 15000 ms
        at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:130)
        at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:88)
        at org.apache.solr.cloud.ZkController.<init>(ZkController.java:170)
        at org.apache.solr.core.CoreContainer.initZooKeeper(CoreContainer.java:242)
        at org.apache.solr.core.CoreContainer.load(CoreContainer.java:495)
        at org.apache.solr.core.CoreContainer.load(CoreContainer.java:358)
        at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:326)
        at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:124)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
        at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:679)
    Caused by: java.util.concurrent.TimeoutException: Could not connect to ZooKeeper ec2-54-247-144-120.eu-west-1.compute.amazonaws.com:2181 within 15000 ms
        at org.apache.solr.common.cloud.ConnectionManager.waitForConnected(ConnectionManager.java:173)
        at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:127)
        ... 25 more
    
    2013-06-07 11:16:52,104 [pool-2-thread-1] INFO  org.apache.solr.servlet.SolrDispatchFilter . SolrDispatchFilter.init() done
    

它告诉我什么?在同一个实例上,我刚刚成功连接到客户端...... :(

那么问题出在哪里?

[编辑:] 我没有使用 amazons ec* * .amazon.* 地址,而是使用网络地址 10.XXX 来告诉 solr zookeeper 在哪里。它似乎工作。

4

4 回答 4

1

一定有某种连接问题。我看你现在已经解决了。下次遇到这种情况时,您应该登录到连接有问题的盒子并使用 telnet 来查看是否可以连接。

例如:从您的 solr 框中:

telnet ec2-54-247-144-120.eu-west-1.compute.amazonaws.com 2181

然后也从 zk 盒子尝试。它应该开始阐明您的问题所在。

这消除了任何应用层问题,并且会非常可靠地告诉您是否可以连接。如果您无法连接,那么它几乎总是某种安全问题 - 防火墙在某处运行(尝试 - $service iptables stop)或者这将是亚马逊安全组配置的问题。

最后一个潜在问题是网络可用性。不管人们怎么想,网络是不可靠的,不应该被认为是可靠的。任何在 SOA/分布式系统中工作的人都知道这一点 :) http://aphyr.com/posts/288-the-network-is-reliable

“多伦多大学和微软研究院的一个团队研究了微软几个数据中心的网络故障行为。他们发现平均故障率为每天 5.2 台设备和每天 40.8 条链路,平均修复时间约为 5 分钟(最多一周)。”

于 2013-06-18T20:20:33.350 回答
1

你有你的答案 - 你的 ZooKeeper 无法访问!检查您的防火墙配置。

你也可以检查它

zkCli.sh -server localhost:2181
于 2013-06-09T14:44:21.677 回答
0

在设置 SolrCloud 和 ZooKeeper 时,我还遇到了“错误联系服务。它可能没有运行。” 问题。原因是 ZooKeeper 需要的文件名中的拼写错误。正确的文件名是“myid”。我错误地写了“myip”。重命名文件并重新启动 ZooKeeper(./zkServer.sh restart)后,我的问题得到了解决。

于 2015-06-11T12:19:28.747 回答
0

尝试停止您的 solr 实例solr.shutdown(),以便您可以为每个线程创建新的 CloudSolrServer 实例

于 2017-03-29T21:12:25.550 回答