Elastic tools - How to create shards for different servers

220 views Asked by At

I have created a shard mapping in a database called 'ShardTesting' on my local sql server. I have also created two more databases: shard1 and shard2 in the same server.

Now I am able to create shards and mappings for these two (shard1 and shard2) databases in the main ShardTesting database, but I cannot create shard for any database which is on another server somewhere on Azure. I get the login error that the code was not able to login to this new database.

This is how I create a shard.

var shardLocation = new ShardLocation(server, database);
 ShardCreationInfo shardInfo = new ShardCreationInfo(shardLocation);
 Shard newShard = _listShardMap.CreateShard(shardInfo);

what is happening is that it is trying to login to this new server database with ShardTesting database credentials which are obviously wrong because ShardTesting is the main database on my local machine to store all shards and mappings.

I do not see any way to supply userId and Password along with this new server and database so that the library use them to connect to this new db and create its shard.

1

There are 1 answers

1
Inayat On BEST ANSWER

As no one has answered so far. So let me answer it by myself in case someone is facing the same problem.

All servers should have one same user with same password. In other words create a user in all servers with same name and password and then ShardMapManager will be able to login to them all and can create mappings.

I believe there is no way to supply separate credentials for each server.