Azure SQL DB高级版只读缩放:能否指定连接特定只读副本?
Great question! Let me break down how this works with Azure SQL Database's read scale-out feature for you:
First, you’re right that Premium/Business Critical tier databases with Read Scale-out enabled come with read-only replicas, and adding
ApplicationIntent=ReadOnly;to your connection string routes traffic to these replicas. However, there’s no built-in way to directly specify connecting to "Replica1" or "Replica2" specifically.The read-only replicas in Read Scale-out are managed as a shared pool, and Azure uses an internal load balancer to distribute incoming read requests across them automatically. This means you can’t target a single replica via connection string parameters—your requests will be balanced across all available replicas in the pool.
If you need to isolate different workloads (like running analytics on one dedicated replica and Power BI reports on another), a better alternative is to use geo-replicated read-only replicas. Each geo-replicated replica has its own unique endpoint, so you can create separate connection strings for each workload:
- Use the first geo-replica’s endpoint for your analytics tasks
- Use the second geo-replica’s endpoint for Power BI reports
Here’s a quick reminder of the standard connection string for load-balanced access to the Read Scale-out replica pool:
Server=tcp:<your-server-name>.database.windows.net;Database=<your-db-name>;ApplicationIntent=ReadOnly;User ID=<your-username>;Password=<your-password>;Trusted_Connection=False; Encrypt=True;
To sum up: Read Scale-out’s built-in replicas are shared and load-balanced, so targeting individual ones isn’t possible. For workload-specific dedicated replicas, geo-replicated instances are the recommended solution.
内容的提问来源于stack exchange,提问作者Oleh

