In a 2 node Availability Group with tcp and named pipe protocols enabled, how can you get named pipes to work ?
Say for example I have a Windows cluster called DEVL with 2 nodes DEVLA and DEVLB with an availability group listener called DEVLS.
All 4 have IP addresses(DEVL, DEVLA, DEVLB, DEVLS).
In a traditional cluster(before Availability Groups) we would specify the virtual node name when configuring the named pipe. The windows cluster would then determine which node was the active node(active/passive configuration).
Now, in a non-shared storage availability group we have 2 separate sql server instances and we connect to the listener name. The listener is configured with 2 tcp endpoints(default port 5022). It appears to not know anything about named pipe protocol as the listener is configured to use tcp.
If we setup a named pipe alias to use the windows cluster name, it will point to which ever node is the active node in the cluster. This might not be the primary replica pointed to by the listener. i.e. The cluster could be active on the DEVLB node and the listener points to the primary replica which is on the DEVLA node.
If we setup a named pipe alias to use the DEVLA or DEVLB node names, it of course points to just those physical nodes whether they are the primary replica or not.
If we setup the named pipe alias to utilize the availability group listener name(DEVLS), it just hangs and never connects. Both nodes have named pipe endpoints configured with public access and hadr_endpoint endpoints using tcp for the sql server service login.
The error we receive when we try to connect to the listener through named pipes is:
error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, error: 2)
Is there something we missed ? Do we need to setup named pipe endpoints somehow to 5022 ?