You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by joseheitor <jo...@heitorprojects.com> on 2018/02/27 05:34:53 UTC

How to configure a cluster as a persistent, replicated SQL database

How do I configure a cluster as a persistent, replicated SQL datastore?And
can it perform as an active-active, high-availability solution that can be
scaled horizontally? 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: How to configure a cluster as a persistent, replicated SQLdatabase

Posted by "ilya.kasnacheev" <il...@gmail.com>.
Hello  Naveen!

I guess you have to use CREATE TABLE for caches to be in PUBLIC schema. I'm
afraid it doesn't work that way for if they're created using Ignite API.

Regards,



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: How to configure a cluster as a persistent, replicated SQLdatabase

Posted by Naveen <na...@gmail.com>.
Hi Stan

I was able to setup ignite with Oracle as persistent layer. 
However I still have one concern, the existing Oracle DMLs are not working
with ignite

For e.g

In Oracle below is the insert statement I use

    insert into map_dummy (ENTITY_ID, MAPPING_ID_LIST, RELATIONSHIP,
UPDATEDDATETIME, UPDATEDBY, SEQUENCE_NO, TUPLE_COUNT) values
    ('8','maplist8','rel2',sysdate,'upd2','2','2')

In ignite, I had to prefix with schema

INSERT INTO *"MapDummyCache".*MAP_DUMMY (ENTITY_ID, MAPPING_ID_LIST,
RELATIONSHIP, UPDATEDDATETIME, UPDATEDBY, SEQUENCE_NO, TUPLE_COUNT) values
    ('6','maplist6','rel5',sysdate,'upd5','5','5');

Because of this, I had to change my existing Oracle DMLs to make it work
with Ignite. 
I believe I tried to change the schema to PUBLIC by explicitly setting the
schema while creating the cache, but still no luck,

Any suggestions for this,

Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: How to configure a cluster as a persistent, replicated SQLdatabase

Posted by Stanislav Lukyanov <st...@gmail.com>.
Hi Naveen,

Please refer to this page https://apacheignite.readme.io/docs/3rd-party-store.
In short, you need to implement a CacheStore or use one of the standard implementations (CacheJdbcBlobStore, CacheJdbcPojoStore)
and add it to your cache configuration.
Also, you can set DataRegionConfiguration.persistenceEnabled=false to disable native persistence.

Thanks,
Stan

From: Naveen
Sent: 9 марта 2018 г. 17:09
To: user@ignite.apache.org
Subject: Re: How to configure a cluster as a persistent, replicated SQLdatabase

Hi Jose

I was asking how can I configure Oracle DB as persistent layer.
At the moment I am using the Ignite native persistence as persistent layer,
but I would like to use Oracle DB as persistent layer. 
How can I do this, what changes I should do to the config file.
My config file looks like this for native ignite persistence, what do I need
to add for using Oracle as persistent layer

	  <property name="dataStorageConfiguration">
	    <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
	      <property name="defaultDataRegionConfiguration">
	        <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
	          <property name="persistenceEnabled" value="true"/>
	        </bean>
	      </property>
	    </bean>
	  </property>

Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: How to configure a cluster as a persistent, replicated SQL database

Posted by Naveen <na...@gmail.com>.
Hi Jose

I was asking how can I configure Oracle DB as persistent layer.
At the moment I am using the Ignite native persistence as persistent layer,
but I would like to use Oracle DB as persistent layer. 
How can I do this, what changes I should do to the config file.
My config file looks like this for native ignite persistence, what do I need
to add for using Oracle as persistent layer

	  <property name="dataStorageConfiguration">
	    <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
	      <property name="defaultDataRegionConfiguration">
	        <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
	          <property name="persistenceEnabled" value="true"/>
	        </bean>
	      </property>
	    </bean>
	  </property>

Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by joseheitor <jo...@heitorprojects.com>.
Hi Naveen,

I managed to get everything up a and running...but for my testing, I have
not been connecting from code.

I have been using DBeaver to connect using SQL via the JDBC driver(s).

Jose



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by Naveen <na...@gmail.com>.
Hi Jose

Did it work for you ?
I had the same question.
I wanted to use JDBC client driver to connect to Ignite cluster. 
I am trying to use Java
Would you be able ot share the code snippet if you are using java to connect
to the ignite cluster thru JDBC client driver

Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by joseheitor <jo...@heitorprojects.com>.
Okay - figured it out...

Had to prefix the 'PUBLIC' schema to the table name during the CREATE TABLE
query:

CREATE TABLE PUBLIC.City(...



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by joseheitor <jo...@heitorprojects.com>.
Hi Denis,

I inserted a cache definition in the config of all the nodes, as
recommended. Then activated the cluster and connected using the client JDBC
driver, specifying the cache name in the connection string... it connected
successfully.

But when I submit a CREATE TABLE query, I receive the error: [1][50000]
"CREATE TABLE can only be executed on PUBLIC schema" (see below).

Must I also specify the schema name in the JDBC driver's connection string?
...or in the XML configs?

<http://apache-ignite-users.70518.x6.nabble.com/file/t1652/Screenshot_20180305_084754.png> 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by Denis Mekhanikov <dm...@gmail.com>.
Jose,

Currently you have to specify a cache name in the connection URL, that will
be used to run SQL queries on.
I'm not sure where it's a bug or a feature, but here is the ticket for
fixing this: https://issues.apache.org/jira/browse/IGNITE-6481
For now you have to specify a cache name, that you want to run your queries
on. Like this:
*jdbc:ignite:cfg://cache=<cache_name>@<config_url>*

It can be any cache, started in advance. You can put configuration of this
cache to your XML configuration and use its name in the connection string.

Denis

ср, 28 февр. 2018 г. в 20:26, joseheitor <jo...@heitorprojects.com>:

> Hey Denis,
>
> I think that we are making progress...
>
> I am now connecting to the database successfully, but when I submit a
> query,
> I get the following error:
>
> <
> http://apache-ignite-users.70518.x6.nabble.com/file/t1652/Screenshot_20180228_190729.png
> >
>
> My config contains the following:
>
> /...
>     <bean class="org.apache.ignite.configuration.IgniteConfiguration">
>
>
>     <property name="clientMode" value="true"/>
>
>     <property name="discoverySpi">
>         <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>         <property name="ipFinder">
>             <bean
>
> class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
>             <property name="addresses">
>                 <list>
>                 <value>192.168.1.220:47500..47600</value>
>                 <value>192.168.1.230:47500..47600</value>
>                 <value>192.168.1.221:47500..47600</value>
>                 <value>192.168.1.231:47500..47600</value>
>                 </list>
>             </property>
>             </bean>
>         </property>
>         </bean>
>     </property>
>     </bean>
> ...
> /
> What am I doing wrong...?
>
> Jose
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by joseheitor <jo...@heitorprojects.com>.
Hey Denis,

I think that we are making progress...

I am now connecting to the database successfully, but when I submit a query,
I get the following error:

<http://apache-ignite-users.70518.x6.nabble.com/file/t1652/Screenshot_20180228_190729.png> 

My config contains the following:

/...
    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
        
    
    <property name="clientMode" value="true"/>
    
    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
        <property name="ipFinder">
            <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
            <property name="addresses">
                <list>
                <value>192.168.1.220:47500..47600</value>
                <value>192.168.1.230:47500..47600</value>
                <value>192.168.1.221:47500..47600</value>
                <value>192.168.1.231:47500..47600</value>
                </list>
            </property>
            </bean>
        </property>
        </bean>
    </property>
    </bean>
...
/
What am I doing wrong...?

Jose




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by Denis Mekhanikov <dm...@gmail.com>.
Jose,

You can use an XML file, that you use to start server nodes, as
ignite-jdbc.xml in the connection string.
The client node will be started automatically by the JDBC driver.

Denis

ср, 28 февр. 2018 г. в 19:32, joseheitor <jo...@heitorprojects.com>:

> Thanks, Denis - this makes a lot of sense...
>
> Can you provide a sample ignite-jdbc.xml config file for reference? And any
> details about the config parameters for such a config file...?
>
> Also, must a 'Client' mode node be explicitly started prior to making a
> connection? Or does this happen in the background (by the driver) once a
> connection is attempted?
>
> Jose
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by joseheitor <jo...@heitorprojects.com>.
Thanks, Denis - this makes a lot of sense...

Can you provide a sample ignite-jdbc.xml config file for reference? And any
details about the config parameters for such a config file...?

Also, must a 'Client' mode node be explicitly started prior to making a
connection? Or does this happen in the background (by the driver) once a
connection is attempted?

Jose



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by Denis Mekhanikov <dm...@gmail.com>.
Jose,

>As usual, my JDBC connection points to the local node (where I am
activating
>the cluster on), but does not connect to the cluster port (11211) only to
>the default 10800 port.

11211 is a connector port, which serves a different purpose. By default
JDBC connections are accepted on port 10800.

>should I not be pointing to a general 'cluster' endpoint, rather than a
specific node
>address and port?

If you use a thin JDBC driver, then you should specify one of the cluster
nodes. So, all queries will be executed through the node you connect to.
And connection won't break until you bring down this node.

If you want a JDBC client to connect to a cluster without binding to some
specific server node,  you can use a client driver, which will start a
client node locally and will execute all queries through it.
Here is documentation on the client driver:
https://apacheignite-sql.readme.io/docs/jdbc-client-driver

Denis

ср, 28 февр. 2018 г. в 18:12, joseheitor <jo...@heitorprojects.com>:

> Hi Denis,
>
> I have now launched the 3 nodes on different boxes, and listed their
> addresses in each config.
>
> The nodes seem to be aware of each other, as I notice the topology updating
> when I bring additional nodes online/offline.
>
> As usual, my JDBC connection points to the local node (where I am
> activating
> the cluster on), but does not connect to the cluster port (11211) only to
> the default 10800 port.
>
> If I lose any or all of the (2) remote nodes, my JDBC connection continues
> to work. But if I lose the local node - my database connection fails.
>
> I wonder if the problem lies in my JDBC connection... should I not be
> pointing to a general 'cluster' endpoint, rather than a specific node
> address and port? (It seems somewhat logical that my database connection
> fails when the node that it is pointing to goes down...?)
>
> Jose
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by joseheitor <jo...@heitorprojects.com>.
Hi Denis,

I have now launched the 3 nodes on different boxes, and listed their
addresses in each config.

The nodes seem to be aware of each other, as I notice the topology updating
when I bring additional nodes online/offline.

As usual, my JDBC connection points to the local node (where I am activating
the cluster on), but does not connect to the cluster port (11211) only to
the default 10800 port.

If I lose any or all of the (2) remote nodes, my JDBC connection continues
to work. But if I lose the local node - my database connection fails.

I wonder if the problem lies in my JDBC connection... should I not be
pointing to a general 'cluster' endpoint, rather than a specific node
address and port? (It seems somewhat logical that my database connection
fails when the node that it is pointing to goes down...?)

Jose



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by Denis Mekhanikov <dm...@gmail.com>.
Jose,

Actually, there is no such node, that is responsible for all data, stored
in the cluster.
The data is distributed across all nodes instead, so each node is
responsible for some particular piece.
Cache data is split into partitions (1024 for a partitioned cache and 512
for replicated by default), and every node stores some primary and some
backup partitions, if any.
And backup partitions are synchronized with primary ones, when they are
modified.

There are partitioned and replicated caches. The difference between them is
that data of replicated caches is stored on every node entirely.
But there are still some backup and some primary partitions on every node.
You can think of replicated caches as of partitioned, but with backup
factor equal to infinity.

When a node leaves topology, data rebalancing happens, and some backup
partitions become primary.
To be able to survive failure of *n *nodes, you need to have backup factor
to be at least *n*.

Here is documentation on data sharding:
https://apacheignite.readme.io/docs/primary-and-backup-copies

Denis

вт, 27 февр. 2018 г. в 21:58, joseheitor <jo...@heitorprojects.com>:

> Thanks, Denis.
>
> I read the docs and also followed this short video demo/tutorial:
>
> https://www.youtube.com/watch?v=FKS8A86h-VY
>
> It worked as described, so I then extended the exercise by adding and
> additional (3rd) node, using the persistent-store configuration on all
> nodes and activating the cluster before transacting...as per the docs.
>
> Again it all worked as per the original demo, but the persistence now also
> worked.
>
> My concern and confusion is the following:
>
> Assuming we start 3 nodes...
>
> - if we bring down the first node (Primary?) - availability of the data is
> lost ... even though there are another two active nodes in the cluster.
> Doesn't the system automatically elect a new Primary if there are enough
> active terminals to maintain a replicated backup? How then do we achieve
> 'fault-tolerance' and 'high-availability'?
>
> - if we bring down all but the first node (Primary?) data access continues
> to be available for review and manipulation. But surely this should now
> fail because there is no active 'Secondary' node to backup or replicate any
> changes to? Doesn't this expose a risk to data 'consistency', as there is
> now no backup of the data changes?
>
> Or is there a way to configure things so that the system will behave as
> expected (above)?
>
> Jose
> ------------------------------
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.
>

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by joseheitor <jo...@heitorprojects.com>.
Thanks, Denis.

I read the docs and also followed this short video demo/tutorial:

https://www.youtube.com/watch?v=FKS8A86h-VY
<https://www.youtube.com/watch?v=FKS8A86h-VY>  

It worked as described, so I then extended the exercise by adding and
additional (3rd) node, using the persistent-store configuration on all nodes
and activating the cluster before transacting...as per the docs.

Again it all worked as per the original demo, but the persistence now also
worked.

My concern and confusion is the following:

Assuming we start 3 nodes...

 - if we bring down the first node (Primary?) - availability of the data is
lost ... even though there are another two active nodes in the cluster.
Doesn't the system automatically elect a new Primary if there are enough
active terminals to maintain a replicated backup? How then do we achieve
'fault-tolerance' and 'high-availability'?

- if we bring down all but the first node (Primary?) data access continues
to be available for review and manipulation. But surely this should now fail
because there is no active 'Secondary' node to backup or replicate any
changes to? Doesn't this expose a risk to data 'consistency', as there is
now no backup of the data changes?

Or is there a way to configure things so that the system will behave as
expected (above)?

Jose



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to configure a cluster as a persistent, replicated SQL database

Posted by Denis Mekhanikov <dm...@gmail.com>.
Hi Jose!

Apache Ignite is indeed a scalable in-memory persistent SQL-enabled data
store.
Here is documentation, that can help you to start using it:
*Data grid*: https://apacheignite.readme.io/docs/data-grid
*Persistent storage*:
https://apacheignite.readme.io/docs/distributed-persistent-store
*SQL support:* https://apacheignite-sql.readme.io/docs

What do you mean by replicated SQL datastore?

Denis

вт, 27 февр. 2018 г. в 8:34, joseheitor <jo...@heitorprojects.com>:

> How do I configure a cluster as a persistent, replicated SQL datastore?
> And can it perform as an active-active, high-availability solution that can
> be scaled horizontally?
> ------------------------------
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.
>