Solr报告:运行导入时“连接被拒绝”

时间:2012-01-28 00:05:53

标签: java apache solr

我正在运行一个数据库,该数据库充当要导入Solr的数据源。当我运行命令时:curl" http:// localhost:8983 / solr / dataimport?command = full-import& commit = true",提交失败,实例进行回滚。你能帮我搞清楚吗?

以下是异常堆栈:

    Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.DataImporter doFullImport
    INFO: Starting Full Import
    Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrCore execute
    INFO: [] webapp=/solr path=/dataimport params={command=full-import&commit=true} status=0 QTime=0 
    Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
    INFO: Read dataimport.properties
    Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 deleteAll
    INFO: [] REMOVING ALL DOCUMENTS FROM INDEX
    Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrDeletionPolicy onInit
    INFO: SolrDeletionPolicy.onInit: commits:num=1
      commit{dir=/private/var/www/html/internsolr/solr/example/solr/data/index,segFN=segments_21,version=1320251100987,generation=73,filenames=[segments_21]
    Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrDeletionPolicy updateCommits
    INFO: newest commit = 1320251100987
    Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.JdbcDataSource$1 call
    INFO: Creating a connection for entity id with URL: jdbc:mysql://localhost:3306/internshipsearch
    Jan 27, 2012 4:02:32 PM org.apache.solr.common.SolrException log
    SEVERE: Exception while processing: id document : SolrInputDocument[{}]:org.apache.solr.handler.dataimport.DataImportHandlerException:
     

无法执行查询:选择respondentid,
  first_name,last_name,
  cmc_email_address,gradu_year,
  first_major,additional_major,
  序列,other_major,
  organization_name,organization_website,
  organization_desc,industry,
  job_title,department,
  城市,州,
  国家,地区,
  internship_paid,hourly_salary,
  year_undertaken,recommended_again,
  employer_supervisor,employer_phone,
  employer_email,not_recommended_desc,
  full_time_offer,full_time_accept,
  attend_summer_classes,
  summer_classes_institution,
  summer_classes_desc,summer_travel,
  summer_travel_city,summer_travel_state,
  summer_travel_country,
  summer_other_activity,
  summer_other_activity_desc,how_discovered,   doe_start_month,doe_start_day,
  来自doe_end_month,doe_end_day   interndata处理文件#1             at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)             at org.apache.solr.handler.dataimport.JdbcDataSource $ ResultSetIterator。(JdbcDataSource.java:253)             at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)             at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)             在org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)             在org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)             在org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)             在org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)             在org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)             在org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)             在org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)             at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)             在org.apache.solr.handler.dataimport.DataImporter $ 1.run(DataImporter.java:408)           引起:com.mysql.jdbc.CommunicationsException:由于底层异常导致通信链接失败:

    ** BEGIN NESTED EXCEPTION ** 

    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused

    STACKTRACE:

    java.net.SocketException: java.net.ConnectException: Connection refused
      at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
      at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
      at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
      at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)
      at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
      at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
      at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
      at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
      at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)


    ** END NESTED EXCEPTION **



    Last packet sent to the server was 0 ms ago.
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2741)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      ... 11 more

    Jan 27, 2012 4:02:32 PM org.apache.solr.common.SolrException log
    SEVERE: Full Import failed:org.apache.solr.handler.dataimport.DataImportHandlerException:
     

无法执行查询:选择respondentid,
  first_name,last_name,
  cmc_email_address,gradu_year,
  first_major,additional_major,
  序列,other_major,
  organization_name,organization_website,
  organization_desc,industry,
  job_title,department,
  城市,州,
  国家,地区,
  internship_paid,hourly_salary,
  year_undertaken,recommended_again,
  employer_supervisor,employer_phone,
  employer_email,not_recommended_desc,
  full_time_offer,full_time_accept,
  attend_summer_classes,
  summer_classes_institution,
  summer_classes_desc,summer_travel,
  summer_travel_city,summer_travel_state,
  summer_travel_country,
  summer_other_activity,
  summer_other_activity_desc,how_discovered,   doe_start_month,doe_start_day,
  来自doe_end_month,doe_end_day   interndata处理文件#1             at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)             at org.apache.solr.handler.dataimport.JdbcDataSource $ ResultSetIterator。(JdbcDataSource.java:253)             at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)             at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)             在org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)             在org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)             在org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)             在org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)             在org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)             在org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)             在org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)             at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)             在org.apache.solr.handler.dataimport.DataImporter $ 1.run(DataImporter.java:408)           引起:com.mysql.jdbc.CommunicationsException:由于底层异常导致通信链接失败:

    ** BEGIN NESTED EXCEPTION ** 

    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused

    STACKTRACE:

    java.net.SocketException: java.net.ConnectException: Connection refused
      at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
      at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
      at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
      at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)
      at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
      at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
      at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
      at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
      at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)


    ** END NESTED EXCEPTION **



    Last packet sent to the server was 0 ms ago.
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2741)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      ... 11 more

    Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 rollback
    INFO: start rollback
    Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 rollback
    INFO: end_rollback

1 个答案:

答案 0 :(得分:2)

这只是一个连接错误,因此请检查Solr中data-config.xml文件开头的数据源。它可能只是简单的URL,错误的凭据,忘记将数据库名称放在URL中等等。确保您可以从Solr服务器ping数据库服务器。

数据源标记应该是这样的:

<dataSource type="JdbcDataSource" 
  driver="com.mysql.jdbc.Driver"
  url="jdbc:mysql://database.server.com/database-name" 
  user="user" 
  password="pass"
  name="datasource-name" />

data-config.xml中的实体应该没有指定数据源(如果文件中只有一个),或者如果有多个数据源,则应指定要使用的数据源的名称。

祝你好运!