I am using jboss-4.0.5.GA. I have a primary and secondary database configured in the -*ds.xml. When the primary fails the secondary takes over. What happens in our case is the secondary also fails and I would like to connect to the primary database now? But what I see is if the secondary fails it is not trying to connect to priamary.
Any thoughts?
Tried this and it worked. To connect back to to the primary again we would need to configure the URL as below.
Primary|Secondary|Primary
Related
I have a Node1\INST1 SQL Server instance which is the Primary and a Node2\Inst2 which is the Secondary in the High Availability Group. Both shows 'Synchronized' as the status, and both show 'No Data Loss'. I have also configured the Failover correctly.
Both are up and I have my SSMS open with a connection to the Listener,1496. I fire a query against this one test table and it returns the correct results.
Next, I stop the SQL Service on the Primary (to test the Failover). The 'Automatic Failover' happens correctly and I can see now the Node2\Inst2 is Primary.
But my query on the listener connection window gives that typical:
A transport level occurred
error if I fire that query again. Shouldn't that query work seamlessly? Like tomorrow, If I have a .NET app with the connection string pointing to the listener, what kind of issues will I face when the Primary goes down?
Please let me know If I am testing it wrong or if I need to do something else.
Thanks
I am using docker containers bitnami/postgresql-repmgr:13.3.0-debian-10-r22 in order to enable automatic failover for PostgreSql (I have 2 containers on 2 servers, one is the primary, the other a standby).
Our application (using springboot) is using this connection string for the Postgres replication:
postgres.host=xx.xx.x.140
postgres.port=1054
postgres.cluster=[xx.xx.x.140:5433 (http://xx.xx.x.140:5433)],[xx.xx.x.97:5433(http://xx.xx.x.97:5433)]
In case the Primary (140) fails, and repmgr will make 97 the primary, the application will try to connect to 140, will fail, and so will try the next string in the connection string, and will connect successfully to the new primary 97.
However, when I start the failed primary as standby, the application can connect to it, and does so, but returns errors on "read only".
I was thinking of using pgbouncer to overcome this problem, but I am not sure how and if it can be integrated into the repmgr container.
Anyone tried this combination?
Thanks
Background:
I have a Always On Availability Group Setup with 4 Nodes(DB1,DB2,DB3,DB4). I am using File Share witness hosted on some other server. All the nodes on AG are set to failover automatically. And as readable secondary option set to 'yes'.
Issue:
For instance, lets consider DB1 as primary node on both AG and WSFC. Now,whenever I stop the MSSQL service on DB1, DB2 or the other 2 becomes primary on AG. However, DB1 stays as primary host on the WSFC. The main problem here is whenever my application tries to connect to the DB, I get an error as "Failed to update 'Dbname' database is read only". But when I manually change the node of WSFC to the now Primary AG DB my application starts working. Can someone please help me out here.
whenever my application tries to connect to the DB, I get an error as "Failed to update 'Dbname' database is read only"
Your app needs to connect to the AG through the AG Listener, which will only be active on the node hosting the primary database replica.
If your app is connecting to the listener you need to troubleshoot the connection. Verify that DNS resolution is returning all the IP addresses, and that only the IP address hosting the primary replica has the requested SQL Server port open.
I am looking for an alternative to symmetric key encryption to savely store sensitive data in a Microsoft SQL database. The reason for this is a few days ago I had an error during the night (at 3 am) where the database responded my status call, which is used for health checks of the backend, with an error
A severe error occurred on the current command. The results, if any, should be discarded.
(The call I am using for health check is only calling my rest api - going through the web service to the database, does a select count(*) from Member and returns the count.)
After that error every api call which used sensitive data from the database returned
Please create a master key in the database or open the master key in the session before performing this operation.
My monitor service said that the backend was up again after 2 minutes automatically but the master key was not working anymore. I fixed it with the following command
open master key decryption by password = 'password'
alter master key add encryption by service master key
the morning after but in the meantime the backend was not working correctly. So the failover didn't really did its job (because I had to do something manually to get everything working again).
So I am trying to achieve to store sensitive data easily in the database (must be able to decrypt it again) and to have a working failover without doing anything manually too.
Thanks for your input!
What i think I'm reading is that you have some sort of HA technology in play (e.g. availability groups). If that's the case, care needs to be taken to ensure that both sides of the topology can open the database master key.
Fortunately, it's fairly easy to do that. You can backup and restore service master keys (SMK). So, you'll backup the SMK from the secondary node and restore it to the primary node. SQL Server will decrypt anything currently encrypted with the old key and re-encrypt with the new.
We implemented database mirroring for WCF and set up failover partner in connectionstring as following
....Data Source=10.0.13.21,1433;Failover Partner=10.0.13.31,1433; ...
10.0.13.21 - primary server
10.0.13.31 - secondary server
but somehow we get error:
the underlying provider failed
when the primary server is in failover state and the application is supposed to connect to secondary server. Everything works again after resetting IIS.
Another strange thing is that the switch from secondary back to primary server is working but not from primary to secondary.
Anybody knows possible reason for this?
thanks in advance
I think you have to completely close your connection in the application and maybe do some retry code. Clearing connection pools may also be necessary.
And also bear in mind that depending upon the size of the redo queues for the mirroring there may be a delay before the failover partner database is available again.
Here's a couple of links which I would read http://www.sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-(1130)-database-mirroring-failover-is-instantaneous.aspx
and http://technet.microsoft.com/en-us/library/cc917713.aspx