【问题标题】:Access Denied trying to create Solr Config访问被拒绝尝试创建 Solr 配置
【发布时间】:2016-09-17 15:46:27
【问题描述】:

我正在关注以下示例:

https://github.com/watson-developer-cloud/node-sdk/blob/master/examples/retrieve_and_rank_solr.v1.js

但每次我尝试上传配置时,我都会得到 “错误:未经授权:由于凭据无效,访问被拒绝。”

我已经为 Retrieve 和 Rank 创建了一个 API 密钥,还有其他事情要做来管理 R&R 的凭据吗?

这是我的代码:

return retrieveInstance.uploadConfigAsync({
  cluster_id: clusterId,
  config_name: watsonConfig.config_name,
  config_zip_path: (__dirname + "/../../" + watsonConfig.config_path)
});

我正在使用此 API 密钥成功创建集群。 Schema.zip 有这个 schema.xml

<schema name="simple" version="1.5">
<fields>
   <!-- required -->
   <field name="_version_" type="long" indexed="true" stored="true"/>

   <field name="id" type="string" indexed="true" stored="true" required="true" />
   <field name="question" type="string" indexed="true" stored="true" required="true" />
   <field name="answer" type="string" indexed="true" stored="true" required="true" />

   <dynamicField name="*_s"  type="string"  indexed="true"  stored="true" />
   <dynamicField name="*_ms"  type="string"  indexed="true"  stored="true" multiValued="true" />
   <dynamicField name="*_t"  type="string"  indexed="true"  stored="true" />
   <dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
   <dynamicField name="*_mi"  type="int"    indexed="true"  stored="true"  multiValued="true"/>
   <dynamicField name="*_l"  type="long"   indexed="true"  stored="true"/>
   <dynamicField name="*_b"  type="boolean" indexed="true" stored="true"/>
   <dynamicField name="*_f"  type="float"  indexed="true"  stored="true"/>
   <dynamicField name="*_d"  type="double" indexed="true"  stored="true"/>
 </fields>

 <uniqueKey>id</uniqueKey>

  <types>
    <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
    <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="uuid" class="solr.UUIDField" indexed="true" />
  </types>
</schema>

【问题讨论】:

  • 确保您拥有该服务的凭据(它们不是您的 bluemix 电子邮件和密码)并且它们是 node-sdk 正在使用的凭据。您可以通过NODE_DEBUG=request app.js 来检查您的应用正在进行的 HTTP 调用。

标签: solr ibm-cloud ibm-watson


【解决方案1】:

有关如何访问凭据的详细信息可以在这里找到:https://www.ibm.com/watson/developercloud/doc/retrieve-rank/tutorial.shtml#credentials

总而言之,在 Bluemix Web 仪表板中,如果您单击 R&R 服务实例,“Service Credentials”选项卡将显示用户名和密码。这些不是您的 IBM ID 用户名或密码。

也就是说,如果您能够创建集群,则表明您已获得有效凭据。你确定集群创建成功了吗?您能否通过使用https://www.ibm.com/watson/developercloud/retrieve-and-rank/api/v1/?curl#list_solr_clusters 中描述的 curl 命令获取集群详细信息来确认这一点?

【讨论】:

    【解决方案2】:

    老兄,我遇到了同样的问题。使用教程中的 cranfield-solr-config.zip 并将其原始配置文件 (schema.xml...) 替换为您的配置文件。但是不要解压zip文件再压缩!!!我不知道为什么会发生这种情况,但确实如此......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多