I have some application written in JAVA.
We are using MySQL DB.
It is possible to integrate that MySQL DB with Apache Ignite as In Memory cache and use that configuration without any updates in JAVA application (of course some DB connection details should be changed)?
So my application do the same staff but only difference will be connection with Apache Ignite instead of MySQL?
It is possible this kind of configuration?
I suppose you are looking for the write-through feature. I'm not sure what is your use case, but you should be aware of some limitations like your data have to be preloaded into Ignite before running SELECT queries. From a very abstract perspective, you need to define POJOs and implement a custom CacheStore interface. Though GridGain Control Center can do the latter for you automatically, check this demo as a reference.
Related
I have a java REST API application using Quarkus as the framework. The application uses a PostgreSQL database, which is configured via the application.properties config file for hibernate entities (using "quarkus-hibernate-orm" module) etc. However, there are cases where i will have to dynamically connect to a remote database (connection info will be supplied by parameters) to read and write data from during runtime as well. How do i go about this the best way with Quarkus? For simplicity reasons we can assume that the remote databases are of the same type (PostgreSQL) so we don't have to worry about whether the correct driver is locally available or not.
Is there something provided by Quarkus or the environment to establish these connections and read/write? i dont need an ORM layer here necessarily, as i may not know the structure beforehand either. Simple queries are also sufficient. When i try to research this subject i can only get information about static hibernate or datasource configurations in Quarkus, but i won't know what they look like beforehand. Basically, is there some kind of "db connection provider" etc. i should use or do i simply have to manually create new plain JDBC connections in my own code for it?
I currently use MySQL as a persistent data store and I'd like to introduce data grid layer between my application and MySQL to handle database outages. I'd like to do it as non-invasively to the current application structure as possible.
Apache Ignite is shipped with two features related to my problem: write-behind caching strategy with 3rd party persistence and custom JDBC driver.
I would like to combine these two features as follows:
the application will use Ignite JDBC driver to persist data.
Ignite will query/update data in memory and will asynchronously flush data to the MySQL database (write-behind caching strategy).
when MySQL becomes unavailable Ignite will batch the updates until MySQL restores and will still serve queries/updates without affecting the client app.
Is this setup possible with only configuration changes like replacing the DataSource implementation and configuring the Ignite cache?
I don't think that 3-rd point is available from out of the box.The CacheStore implementation (for example, CacheJdbcPojoStore) assumes that connection to the underlying database is reliable and can be established at any time. The write-behind mechanism works in the same way, i.e. it can establish a connection when the internal buffer is overflowed, a timeout occurs, the back-pressure mechanism is triggered.
Thus, you have to implement your own CacheStore, which takes care of the accumulation of data, while the MySQL database is disabled for some reason.
Perhaps, the following links will be helpful:
https://apacheignite.readme.io/docs/3rd-party-store#section-cachestore
https://apacheignite.readme.io/docs/3rd-party-store#section-cachestoresession
Is it possible to use Apache Ignite as transparent cache for several tables in PostgreSQL RDBMS and to query that cache using Ignite SQL?
For example like this:
Application (via SQL) ---> Apache Ignite (if data is not loaded) ---> Postgresql
I'm new to Ignite and cannot figure out how to do that or is it even possible.
Ignite's SQL works over in-memory data only so you need to load data into caches beforehand. In other words, read-through doesn't work for SQL queries.
Starting with version 2.1 Ignite provides its custom persistent store that allows running SQL queries against the data both in memory and on disk.
It will work, if you preload data to cache before querying.
You can do it by configuring a CacheStore and calling IgniteCache#loadCache(). Here is documentation: https://apacheignite.readme.io/v2.3/docs/3rd-party-store#cachestore
Another option is to enable readThrough parameter and use cache API. Unfortunately, this option has no effect on Ignite SQL and works for cache API only.
I am using Postgres 9.3 on my production servers. I would like to achieve high availability of Postgres DB using Master-Master configuration where each master would run in an Active-Active mode with bidirectional replication.
I have 2 Java Spring REST web-services pointed to 2 separate database engines each having their own storage. Both web services point to its own database plus the other one in HA configuration.
Now if any one of the Databases fails, I want the active database server to work and when the failed one recover, the data should be synced back to the recovered one.
I tried doing bidirectional replication using Bucardo 5.3.1 but the recovered database does not get updated with the new data and Bucardo syncs need to be kicked again. (see bug: https://github.com/bucardo/bucardo/issues/88)
Is there any way I can achieve this with some other bi-directional replication tool?
Or is there any other way where I can have with 2 Postgres engines pointing to a shared storage running in Active-Active configuration?
2nd Quadrant released Postgres BDR which is a patched version of PostgreSQL that can do multimaster replication using logical WAL decoding. You will find more informations here : https://www.2ndquadrant.com/fr/resources/bdr/
I have finally decided to move to Enterprise DB of Postgres (a paid licence) that provides replication tools via GUI which are easy to use and configure.
So, I have a Java EE application using Spring framework and JDBCtemplate. And, my application has to do several JDBC database read requests (no/very little writes) on the same database (which is a Postgres DB but is not normalized for a bunch of reasons) but with different sql statements (different where clauses). So, given this situation, I would like to be able to cache the database and be able to run queries on the cache, thereby saving me expensive JDBC calls. So, please suggest appropriate tools or frameworks or any other solutions.
You can start with using simple maps depending the query parameter you are using. A more viable solution is using ehcache.
If you use Spring 3.1 or later, you can use #Cacheable on methods. You need to include <cache:annotation-driven /> in your application context configuration. For simple cases you may use spring's ConcurrentCacheFactoryBean as cache manager. For more complex cases you can use ehcache via spring's ehcache adapter. Use #CacheEvict to reset cache.