dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
359 stars 224 forks source link

SqlAGListener: 15 character name limit #513

Open Zuldan opened 7 years ago

Zuldan commented 7 years ago

Details of the scenario you try and problem that is occurring:

I don't think the resource should decide what naming convention you can use. The 15 character limit should be removed from the resource. As good practice, when you create a SQL Server you also create a DNS hostname (EG BusinessApplication-DB-Prod.contoso.corp) so that when you migrate the database to another server, all you need to do is modify the hostname and not all the applications. Usually these hostnames are longer than 15 characters because you're adding other descriptors such as 'db' and 'prod' in the name. As per Microsoft (https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/create-or-configure-an-availability-group-listener-sql-server - see image below) the maximum length for a DNS name is 63 characters. Only SQL Management Studio limits you to 15 because of the warning mentioned in the screenshot. By manually removing the limit in Set/Get/Test I can create 20 character listener names and they work perfectly providing the first 15 characters are unique. @johlju what are your thoughts?

dns

Edit: typo should -> shouldn't

The DSC configuration that is using the resource (as detailed as possible):

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:

Server: Windows 2012 R2 (Update) SQL Server: 2016 SP1 CU2 Powershell: 5.1

Version of the DSC module you're using, or 'dev' if you're using current dev branch:

dev as of today

johlju commented 7 years ago

The limit is there because of the potential conflict of duplicate NetBIOS name. In the screenshot you can read about it in the yellow banner. The use case you mention will still work. The limit doesn't stop you from creating another DNS record point to the same listener IP-address (A-record). You can also use a CNAME-record, but with a A-record Kerberos double-hop will also work.

The limit is there to safe guard. But if it consensus is that we should not block anyone fram adding a longer name (and potentially making a mistake) then we can surly remove the limit. In that case we could warn about it in the README.md, and (maybe) write a warning if a name longer than 15 chars is used that it might generate conflicting names.

Zuldan commented 7 years ago

The limit doesn't stop you from creating another DNS record point to the same listener IP-address (A-record).

That's an interesting idea. I thought in order for a listener to work correctly (when using MultiSubnetFailover in your connection string) you have to point to an actual AD Object so that the failover works almost instantaneous else you're replying on a HostRecordTTL setting on an A record. If the production database was down for 5 minutes while performing a failover, the business would freak out ;-). Maybe my understanding is incorrect though. Do you see it working another way?

johlju commented 7 years ago

When using multi subnet doesn't it just register both (or all) IP-addresses and then do round-robin on those IP-addressed? When using MultiSubnetFailover in the connection string it tries to connect to both (or all) IP's at the same time, and take the connection that is the fastest. In that case you just need to register both (all) IP-addresses on that new host name, several A-records with the same name but each pointing to each nodes IP-address. Or just one CNAME pointing to the VCO (Virtual Computer Object) which holds all IP-addresses already. This is just a theory, I have not done this practically. So please test this! 😄

But if this limitation is an issue for multi-subnet then for sure we should remove it.

More information here: https://docs.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/sql-server-multi-subnet-clustering-sql-server

johlju commented 6 years ago

I need opinions on this. This 15 character limit in SqlAGListener, is this a limitation in some scenarios, and should be removed?

Zuldan commented 6 years ago

@johlju, I have another argument. In Windows Server 2016 you can create now a Windows cluster without any Active Directory domain and yet the resource will enforce the 15 character limit which is only for AD objects.

johlju commented 6 years ago

You are referencing to Domain Independent Availability Groups? I can see that blocking this can cause problems in the future, and I can't see why we should block longer names when SQL Server it self does not do that.

If nobody objects, let's remove the limitation and reference this article in the documentation instead. https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/create-or-configure-an-availability-group-listener-sql-server#DNSnameReqs

Labeling this as enhancement and help wanted so someone can run with it.

steffenengelhamburg commented 5 months ago

Hi, i think too, this check should be changed to 16 (netbios Maximum on non Windows Systems) chars or removed. In #2005 i suggested a possible solution, but i‘m not sure if there is another place need to change.

Some hints: the 15 Char limit is a NetBIOS limit on windows: windows netbios use the 16th char for the typ of netbios object - U or G and if the object has one or multiple IP adresses.

kind regards Steffen

johlju commented 5 months ago

@steffenengelhamburg if you have time, please send in a PR that removes the limitation and updates the documentation according to https://github.com/dsccommunity/SqlServerDsc/issues/2005#issuecomment-2066673353.