使用Azure Analysis Services的只读路由连接到SQL AG

时间:2019-03-29 00:31:35

标签: azure-analysis-services

我们正在使用Azure Analysis Services表格模型。它通过网关连接到本地SQL Server可用性组。

我们最近将只读路由添加到了可用性组,并且拥有一个Web应用程序,该应用程序的连接字符串为我们的读取查询添加了“ ApplicationIntent = ReadOnly”。

我们能够验证查询是否达到了Web应用程序中的只读节点,但在刷新AAS表格模型时运气不佳。查询继续从ReadWrite节点而不是ReadOnly(已在db上用sp_whoisactive验证)刷新。

这是我们的连接xmla(已重命名敏感信息)

"dataSources": [
  {
    "type": "structured",
    "name": "someconnectionname",
    "connectionDetails": {
      "protocol": "tds",
      "address": {
        "server": "servername,portnum",
        "database": "mydbname", 
    "applicationIntent": "ReadOnly"
      },
      "authentication": null,
      "query": null
    },
    "options": {
      "commandTimeout": "P5D"
    },
    "credential": {
      "AuthenticationKind": "UsernamePassword",
      "kind": "SQL",
      "path": "servername,portnum;mydbname",
      "Username": "myUserName",
      "EncryptConnection": false,
      "PrivacySetting": "Private"
    }
  }

我尝试过编辑应用程序意图:只读

“应用程序意图”:“只读”

“ ApplicationIntent”:“只读”

“ applicationIntent”:“只读”

“ applicationIntent”:“只读”

然后尝试将应用程序意图也移到“ connectionDetails”的正下方,并尝试相同的变化。

更重要的是,当我执行查询时,它可以接受参数,但是当我使用“ sp_whoisactive”进行检查时,查询仍然显示在可写节点上。

(如果我将意图放入“选项”,则查询失败)

如果您有答案,请告诉我。谢谢!

1 个答案:

答案 0 :(得分:1)

然后我们像这样将multiSubnetFailover = true添加到json中。有趣的是,我们实际上并未在AG上设置MultiSubnetFailover,但这使结构化连接类型起作用。

Refer to the guidance here on Github

"dataSources": [
{
"type": "structured",
"name": "someconnectionname",
"connectionDetails": {
  "protocol": "tds",
  "address": {
    "server": "servername,portnum",
    "database": "mydbname", 
    "applicationIntent": "ReadOnly"
  },
  "authentication": null,
  "query": null
},
"options": {
  "commandTimeout": "P5D",
  "multiSubnetFailover": "true"
},
"credential": {
  "AuthenticationKind": "UsernamePassword",
  "kind": "SQL",
  "path": "servername,portnum;mydbname",
  "Username": "myUserName",
  "EncryptConnection": false,
  "PrivacySetting": "Private"
}

}