I'm trying to configure availability groups in a VM environment so I can run some tests.
I think I've got the group created correctly, I can see the Always on group on both servers. However when I look at the dashboard for the group it has the following error
"Availability replica disconnected This secondary replica is not connected to the primary replica. The connected state is DISCONNECTED."
I've checked the endpoints on both servers and they look correct. There are no firewalls running and both servers can see each other. What's the best way to debug this sort of error?
Below is the TSQL I used to set all this up
Primary Server
CREATE ENDPOINT dbm_endpoint
STATE=STARTED
AS TCP (LISTENER_PORT=7022)
FOR DATABASE_MIRRORING (ROLE=ALL)
GO
Secondary Server
CREATE ENDPOINT dbm_endpoint
STATE=STARTED
AS TCP (LISTENER_PORT=5022)
FOR DATABASE_MIRRORING (ROLE=ALL)
GO
Primary Server
CREATE AVAILABILITY GROUP AG1
FOR
DATABASE TestDb
REPLICA ON
'SQL1' WITH
(
ENDPOINT_URL = 'TCP://sql1.sql.sandbox.net:7022',
PRIMARY_ROLE ( ALLOW_CONNECTIONS = READ_WRITE),
SECONDARY_ROLE (ALLOW_CONNECTIONS=READ_ONLY),
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT,
FAILOVER_MODE = MANUAL
),
'SQL2' WITH
(
ENDPOINT_URL = 'TCP://sql2.sql.sandbox.net:5022',
PRIMARY_ROLE ( ALLOW_CONNECTIONS = READ_WRITE),
SECONDARY_ROLE (ALLOW_CONNECTIONS=READ_ONLY),
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT,
FAILOVER_MODE = MANUAL
);
Secondary Server
ALTER AVAILABILITY GROUP AG1 JOIN;
Obviously I also restored the primary database to the secondary server as well.
One thought, I didn't install the SQL Agent on either server, I'm guessing this is not needed for always on availability groups?