EclipseLink JPA secondary server - mysql

hoping someone may tell me if there is a way to provide automatic redundancy using JPA. We're currently using EclipseLink but can change should another provider have a suitable solution) and we need to ensure that we switch to our backup database should our primary database become unavailable (since its not located in the same building as our application). thanks for your input.

The easiest way is to change the jdbc connection url as explained in the mysql documentation. As an example
jdbc:mysql://master.server.com:3306,backup.server.com:3306/dbname
In this scenario, if maser.server.com fails, the driver will redirect the commands to backup.server.com. I strongly suggest you to read the whole documentation, as there are a lot of properties which change the failover behaviour, in particular the section High Availability and Clustering.

Related

How to encrypt mysql database?

I want to encrypt mysql database so when someone open phpmyadmin data is encrypted.I want to do without changing code at application layer.
I already try key ring plugin but it's not work with table or column level
This is an absolutely impossible objective.
phpmyadmin accesses the data in the database using exactly the same mechanisms as your application code -- nothing more, nothing less. If the data were encrypted from phpmyadmin's perspective, it would also be encrypted from the application's perspective, and the application in its current state would be unable to use it.

Multiples readonly databases(backup connections) on sails.js

i have 2 databases with readonly status on amazon AWS RDS, as readonly databases cant be multi-az, i need to control them manually, my question is, its possible to sails control each connection to use by default my readonly1 database and when this one fail on connect, start using the readonly2 database?
Thanks.
What #Sangharsh said but also, Sails is great when your use case is fairly simple, when it is not then it's better to make use of elaborate methods of interfacing with the database (mysql#npm) and structure this into adapters/services/helpers.
On a more simple scope if you only wanted to read records and have it fall back to the alternative database for data if the connection fails then you could have like MySQLService with a read() method that does what you said if this is the only thing that you need to do.
That being said, you should do some research into load balancing the servers in AWS as you can do this in there without Sails related code :-)

mysql encryption at rest

I have a mysql database that connects with both a web based php application and a FoxPro application (yes, foxpro). Working on this after a previous "developer" was fired.
Anyway, I'm familiar with the AES_Encrypt functions, but using this would involve pretty much rewriting all queries in both applications, I'm looking to avoid this if possible. Just wondering if there are any reasonably priced/open source 3rd party methods/software that will encrypt an entire mysql database at rest on windows server.
I see this http://www.netlib.com/mysql-encryption.asp but it's a large price tag. (Yes, it needs to be HIPAA level, non-profit healthcare)
Any suggestions?
Consider upgrading to MySql 8 which already comes with Data-At-Rest Encryption. Alternatively, you can upgrade to MaridaDB 10.4.
Won't cost you a penny.
You can encrypt any InnoDB table, and once set up it's entirely transparent. All your queries will work exactly the same as before, except the data is encrypted before save and decrypted after retrieval.
I can not say if it's "HIPAA level" or what not, but it uses AES-256 encryption. We're looking at it now to get SOC2 certification.
https://dev.mysql.com/doc/refman/8.0/en/faqs-tablespace-encryption.html

Mysql connection pool with fail over

Question 1:
I am using MySQL Connector /J to connect to MySQL. I am creating connection for every request. I need to use connection pool. Whether i need to choose c3p0 or i could use MysqlConnectionPool class provided by the connector library.
Question 2:
I may need to load balace / failover between two MySQL database servers. I could use jdbc:mysql://host,host2/dbname to do the failover automatically. I want to use connection pool and failover in combination. How should i acheive it.
I'd recommend using C3PO or something else. It'll integrate into a Java EE app server better, and it's database agnostic.
Your second question is a good deal more complicated. Load balancing is usually done with an appliance of some kind, like an F5 or ACE, that stands between the client and the load balanced instances. Is that how you're doing it? How do you plan to keep the data in synch if you load balance between the two? If the connections aren't "sticky", you'll expect to find INSERTed data in both instances.
Maybe this reference can help you get started:
http://www.howtoforge.com/loadbalanced_mysql_cluster_debian

Configuration data in database or in file

I found information about this already, but of more general kind and focused on "if the data shuld change a lot...". I will try to be one step more specific here.
I am developing a web application. It's possible to configure what should be presented or not. E.g. In a form, there can be a number of different drop-down lists, but it should be configured which drop-down lists should be presented.
Hence, it's going to be a lot of reading of the config info. Updating the configuration will be done very seldom. Also, the configuration itself should be performed with using a web application as well.
What's the best strategy, using files or database for the config data?
I guess this depends on if you are already using a database for the rest of the web application. If you are then it makes sense to just add another table. Otherwise the overhead of setting up a database server and managing connections just for configuration is too much. In which case a flat file using structured text is probably your best bet.
If you are already using a database, you could cache the results so that the overhead of looking up the results is lower, then clear the cache when the config is updated.
The best strategy is encapsulation.
If you encapsulate access to your configuration data properly, you'll be able to start off with whichever implementation meets your short term requirements, safe in the knowledge that you can change it later.
Up until I read the requirement of
the configuration itself should be performed with using a web application,
I'd have said a flat file or PHP include would have sufficed, but given that requirement (and the availability of MySQL), I'd say use a database.
Plus, you never know when the config's update frequency will increase.