How do I support multiple database pools to different databases in actix-web? I am currently using this:
// database pool for postgres db1
cfg.add_data(web::Data::new(pool.clone));
and I am able to connect to database db1. How do I add another database pool to a different database (db2 - postgres)?
I am using actix-web 4.x and deadpool-postgres.
Related
As you can see in the screenshot below, a server needs to be selected or created in order to create an azure sql serverless database.
Can I reuse that server and create other azure sql serverless databases on it? If so, how many databases can be created using the same server?
I found the answer in the documentation:
Azure SQL Logical Server Limits
It's 5000 databases per logical server.
We have a java application running in a Fargate container and this application needs to connect and have limited access to the Aurora Postgesql DB.
How can this java application connect to Aurora Postgres DB?
I thought of creating a user account within the db and assigning policies but I need this to be done using Terraform.
Is my approach right? if yes how do we create a user account in Aurora Postgresql db using Terraform.
I was following this article to setup cross database query in Azure SQL Database. The only difference is that, My origin DB and master DB is same, i.e., I want to setup cross query from master database.
Now according to step 5, we need to create database scoped credential in master DB. But when I run this query in SSMS, I get Database credentials are not supported in master database., How to resolve this?
I'm trying to sync two databases in azure paas having different location and different server.
When I try to create a sync group I'm not able to see the database in other regions.
Sync two databases in different location using azure portal.
For your question, please see FAQ about SQL Data Sync:
What regions support Data Sync
SQL Data Sync is available in all regions.
Data Sync support you sync two databases in azure paas having different location and different server.
Did you followed this document: Tutorial: Set up SQL Data Sync between Azure SQL Database and SQL Server on-premises ?
For example I have two SQL database in different Azure SQL Server and region.
Server 1:
Server 2:
Set 'Mydatabase' database in Server 1 as Hub database, add the 'dbleon' database in Server 2 as member database:
Every thing works ok.
Hope this helps.
Currently we have an Azure SQL Server and each time we create new web app, we use EF Core Code First to generate the database. However after the database is created we manually go to Azure portal and add the newly created database to the Elastic Pool inside the Azure SQL Server. Is it possible to somehow automate the process so that each newly created database either via portal or generated using EF or whatever, it will be automatically added to the Pool?
You can use Transact-SQL to programmatically move an existing Azure SQL Database into an elastic pool.
ALTER DATABASE db1
MODIFY ( SERVICE_OBJECTIVE = ELASTIC_POOL ( name = pool1 ) ) ;
You have to use the Elastic database client library to manage the creation of the DB so that the ShardMapManager can register the database. Note that I said database (or shard in Elastic DB terminology) NOT Tenant (or Shardlet in Elastic DB terminology).
The entire Elastic DB components are as follows for SQL server, sharding was added via the Elastic Database SDK which involves the following components (some of which are available only in Azure):
• Elastic Database Client Library
Manage the data distributions and map Tenants to databases.
• Elastic Database Pools (Azure only)
Allocation of a pool of resources that can be shared across a number of databases. Allows for database to consumer resources at their own rate, rather than each database having a specific amount of resources that are available.
• Elastic Database Query
The ability to query across all Tenants within a Multi-Tenant database.
• Elastic Database Jobs
Package and reliably deploy database maintenance operations or database schema changes to multiple databases.
• Elastic Transactions
Process changes to several databases in an atomic and isolated way.
• Elastic Database Split-Merge Tools
Allows for the movement of shards between databases that are participating in the sharding framework
Important concepts using this library is that a Shard can have one or mapping to hold Shardlets (or mappings from the ShardMapManager). In fact the ShardMapManager maintains two collections: Shards (getShards), and Mapping (GetMappings). Mappings are ShardKeys are MAPPED to the Shard...
You have can two types of Shard Key definitions: RangeMapShard, and ListMapShard - both which inherit ShardMap (which contains a property ShardMapType to define the subtype that instantiated the ShardMap).
RangeMapShard - hold a RANGE of keys for ONE mapping.. e.g. customer 100-200 (200 is one higher in value than what is allowed in the range (crappy way of defining it in my opinion... but that is MS documentation) so what they mean is 100-199, 200-299 is defined using ranges of 100-200, and 200-300.
ListMapShard - hold one Shard Key for each Shardlet. So 1 value of a ShardKey is equal to 1 ShardMap ( a Shard can hold one or more Shardlets - so a Shard can hold mappings... )...
So you have to map your shard key(s) to a shard map, and then associated the shard map to a shard, and the shard has to be associated with a Database .... remember, you can create a database that does not have a shard (or schema) defined within it.
I found that I wanted to think of this the other way around, starting from the DB, and sticking in the data into that DB. IMO, the Elastic DB SDK works the other way, you define the Shardlet (tenant), map that to shard(schema), and then stick the Shard(schema) into a database.
HTH.