Re: continuous query - changes from local server only

2018-02-08 Thread Vinokurov Pavel
Som,

You could create the continuous query on each client node with the filter
described above.

2018-02-08 19:55 GMT+03:00 Som Som <2av10...@gmail.com>:

> i've got both client and server nodes on each of 3 physical servers, that
> is my cluster. there is a partitioned cache, each server node stores only a
> part of keys. i start the application on my dev machine that app is also
> client of the cluster further i put new key into the cluster. i would like
> to see this change only in client which is located with server node which
> stores this new key.
>
> 8 февр. 2018 г. 11:41 ДП пользователь "dkarachentsev" <
> dkarachent...@gridgain.com> написал:
>
> Hi,
>
> You may fuse filter for that, for example:
>
> ContinuousQuery qry = new ContinuousQuery<>();
>
> fine al Set nodes = new
> HashSet<>(client.cluster().forDataNodes("cache")
> .forHost(client.cluster().localNode()).nodes());
>
> qry.setRemoteFilterFactory(new
> Factory>() {
> @Override public CacheEntryEventFilter
> create() {
> return new CacheEntryEventFilter() {
> @IgniteInstanceResource
> private Ignite ignite;
>
> @Override public boolean evaluate(
> CacheEntryEvent Integer> event) throws CacheEntryListenerException {
> // Server nodes on current host
> return nodes.contains(ignite.cluster(
> ).localNode());
> }
> };
> }
> });
>
> Thanks!
> -Dmitry
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
>
>


-- 

Regards

Pavel Vinokurov


Re: Connecting Amazon cluster with client from local

2018-02-08 Thread rag1998
Reviving an old thread, since I am faced with a similar issue and am having
trouble getting my head wrapped around it..

We recently started experimenting with Ignite and have a 2 server cluster
setup on AWS with s3 based discovery, config for one of those servers looks
like below: (The addressResolver has the server's own private and public
address-55.55.555.1)
 








 
 
 
 
 
 
 
   
 



Config on the other server looks very similar, except for that servers own
private and public ip's-55.55.555.2

Both can talk to each other and the cluster comes up just fine, able to
Visor to connect to the cluster etc

Now to the problem, I am trying to connect a client from my local to the
cluster using Visor, this is the config on the local:





 


 
 
 

   
  
 (local client's private and public IP)
 
 
   


Port forwarding is also established on the client side, and telnet to server
ip's and ignite port, telnet to client's public ip and ignite port works
fine. 

Visor comes up and connects to the cluster fine, but when trying to do Top,
this is the error I am faced with:

class org.apache.ignite.IgniteCheckedException: Failed to send message (node
may have left the grid or TCP connection cannot be established due to
firewall issues) [node=TcpDiscoveryNode
[id=bcb110e3-55ff-4a5b-8d1b-d180485e1373, addrs=[0:0:0:0:0:0:0:1%lo,
10.0.0.11, 127.0.0.1], sockAddrs=[/0:0:0:0:0:0:0:1%lo:47500,
/127.0.0.1:47500, /10.0.0.11:47500], discPort=47500, order=1, 

Which tells me that it is trying to talk to the Servers on their private
IP's and not their public IP's, which should have been resolved by
AddressResolver, what am I missing here?



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


ignite support for multii data center replication

2018-02-08 Thread Rajesh Kishore
Hi,

Does Ignite replication works on Multi Data Center /WAN ?


Regards,
-Rajesh


Re: slow query performance against berkley db

2018-02-08 Thread Rajesh Kishore
Igniters any pointers pls.

Regards,
Rajesh

On Wed, Feb 7, 2018 at 9:15 AM, Rajesh Kishore 
wrote:

> Hi Dmitry,
>
> Thanks a ton.
>
> What is not convincing to me is with just *.1 M  in main table and* *2 M
> records in other table * , sql query is taking around 24 sec, that is
> worrisome.
> In local cache mode , I tried both using partitioned and non partitioned
> mode , the result is same.
> All I wanted to know , is my approach is wrong  somewhere? I am sure
> igniters would correct me with my approach used.
>
> Regards,
> -Rajesh
>
> On Wed, Feb 7, 2018 at 8:23 AM, Dmitriy Setrakyan 
> wrote:
>
>> Hi Rajesh,
>>
>> Please allow the community some time to test your code.
>>
>> As far as testing single node vs. distributed, when you have more than
>> one node, Ignite will split your data set evenly across multiple nodes.
>> This means that when running the query, it will be executed on each node on
>> smaller data sets in parallel, which should provide better performance. If
>> your query does some level of scanning, then the more nodes you add, the
>> faster it will get.
>>
>> D.
>>
>> On Tue, Feb 6, 2018 at 5:02 PM, Rajesh Kishore 
>> wrote:
>>
>>> Hi All
>>> Please help me in getting the pointers, this is deciding factor for us
>>> to further evaluate ignite. Somehow we are not convinced with just  . 1 m
>>> records it's not responsive as that of Berkley db.
>>> Let me know the strategy to be adopted, pointers where I am doing wrong.
>>>
>>> Thanks
>>> Rajesh
>>>
>>> On 6 Feb 2018 6:11 p.m., "Rajesh Kishore" 
>>> wrote:
>>>
 Further to this,

 I am re-framing what I have , pls correct me if my approach is correct
 or not.

 As of now, using only node as local cache and using native persistence
 file system. The system has less number of records around *.1 M *in
 main table and 2 M in supporting table.

 Using sql to retrieve the records using join , the sql used is
 ---
  final String query1 = "SELECT "
 + "f.entryID,f.attrName,f.attrValue, "
 + "f.attrsType "
 + "FROM "
 +"( select st.entryID,st.attrName,st.attrValue,
 st.attrsType from "
 +"(SELECT at1.entryID FROM \"objectclass\".Ignite_ObjectC
 lass"
 + " at1 WHERE "
 + " at1.attrValue= ? )  t"
 +" INNER JOIN 
 \"Ignite_DSAttributeStore\".IGNITE_DSATTRIBUTESTORE
 st ON st.entryID = t.entryID "
 + " WHERE st.attrKind IN ('u','o') "
 +" ) f "
 + " INNER JOIN "
 + " ( "
 +" SELECT entryID from \"dn\".Ignite_DN where parentDN like
 ? "
  +")  "
 +" dnt"
 + " ON f.entryID = dnt.entryID"
 + " order by f.entryID";

 String queryWithType = query1;
 QueryCursor> cursor = cache.query(new SqlFieldsQuery(
 queryWithType).setEnforceJoinOrder(true).setArgs("person",
 "dc=ignite,%"));
 System.out.println("SUBTREE "+cursor.getAll() );


 ---

 The corresponding EXPLAIN plan is
 

 [[SELECT
 F.ENTRYID,
 F.ATTRNAME,
 F.ATTRVALUE,
 F.ATTRSTYPE
 FROM (
 SELECT
 ST.ENTRYID,
 ST.ATTRNAME,
 ST.ATTRVALUE,
 ST.ATTRSTYPE
 FROM (
 SELECT
 AT1.ENTRYID
 FROM "objectclass".IGNITE_OBJECTCLASS AT1
 WHERE AT1.ATTRVALUE = ?1
 ) T
 INNER JOIN "Ignite_DSAttributeStore".IGNITE_DSATTRIBUTESTORE ST
 ON 1=1
 WHERE (ST.ATTRKIND IN('u', 'o'))
 AND (ST.ENTRYID = T.ENTRYID)
 ) F
 /* SELECT
 ST.ENTRYID,
 ST.ATTRNAME,
 ST.ATTRVALUE,
 ST.ATTRSTYPE
 FROM (
 SELECT
 AT1.ENTRYID
 FROM "objectclass".IGNITE_OBJECTCLASS AT1
 WHERE AT1.ATTRVALUE = ?1
 ) T
 /++ SELECT
 AT1.ENTRYID
 FROM "objectclass".IGNITE_OBJECTCLASS AT1
 /++ "objectclass".OBJECTCLASSNDEXED_ATTRVAL_IDX: ATTRVALUE
 = ?1 ++/
 WHERE AT1.ATTRVALUE = ?1
  ++/
 INNER JOIN "Ignite_DSAttributeStore".IGNITE_DSATTRIBUTESTORE ST
 /++ "Ignite_DSAttributeStore".IGNI
 TE_DSATTRIBUTESTORE_ENTRYID_IDX: ENTRYID = T.ENTRYID ++/
 ON 1=1
 WHERE (ST.ATTRKIND IN('u', 'o'))
 AND (ST.ENTRYID = T.ENTRYID)
  */
 INNER JOIN (
 SELECT
 ENTRYID
 FROM "dn".IGNITE_DN
 WHERE PARENTDN LIKE ?2
 ) DNT
 /* SELECT
 ENTRYI

Re: Cat Example

2018-02-08 Thread Denis Magda
Hi Mike,

If SQL indexes/configuration is set with the annotation and setIndexedTypes 
method then you have to use the type name (Cat in your case) as the SQL table 
name. It’s explained here:
https://apacheignite-sql.readme.io/docs/schema-and-indexes#section-annotation-based-configuration
 


The cache name is used for IgniteCache APIs and other related methods.

—
Denis

> On Feb 8, 2018, at 3:48 PM, Williams, Michael 
>  wrote:
> 
> Hi,
>  
> Quick question, submitted a ticket earlier. How would I modify the below code 
> such that, when viewed through Sql (dbeaver, eg) it behaves as if it had been 
> created through a CREATE TABLE statement, where the name of the table was 
> catCache? I’m trying to directly populate a series of tables that will be 
> used downstream primarily through SQL. I’d like to be able to go into 
> dBeaver, browse the tables, and see 10 cats named Fluffy, if this is working 
> correctly.
> import org.apache.ignite.cache.query.annotations.*;
> import java.io .*;
>  
> public class Cat implements Serializable  {
> @QuerySqlField
> int legs;
> @QuerySqlField
> String name;
>  
> Cat(int l, String n)
> {
> legs = l;
> name = n;
> }
> }
>  
>  
> import org.apache.ignite.Ignition;
> import org.apache.ignite.Ignite;
> import org.apache.ignite.IgniteCache;
> import org.apache.ignite.cache.CacheMode;
> import org.apache.ignite.configuration.CacheConfiguration;
> import org.apache.ignite.cache.query.SqlFieldsQuery;
> import org.apache.ignite.cache.query.QueryCursor;
> import java.util.List;
> public class Test {
> public static void main(String[] args)
> {
> 
> Ignite ignite = Ignition.start();
> CacheConfiguration cfg= new 
> CacheConfiguration("catCache");
>  
> cfg.setCacheMode(CacheMode.REPLICATED);
> cfg.setSqlEscapeAll(true);
> cfg.setSqlSchema("PUBLIC");
> cfg.setIndexedTypes(Integer.class,Cat.class);
> try(IgniteCache cache = 
> ignite.getOrCreateCache(cfg))
> {
> for (int i = 0; i < 10; ++i) {
> cache.put(i, new Cat(i + 1,"Fluffy"));
> }/*
> SqlFieldsQuery sql = new SqlFieldsQuery("select * from 
> catCache");
> try (QueryCursor> cursor = cache.query(sql)) {
> for (List row : cursor)
> System.out.println("cat=" + row.get(0));
> }*/
> }
> System.out.print("Got It!");
> 
> }}
> Thanks, 
> Mike Williams



Cat Example

2018-02-08 Thread Williams, Michael
Hi,

Quick question, submitted a ticket earlier. How would I modify the below code 
such that, when viewed through Sql (dbeaver, eg) it behaves as if it had been 
created through a CREATE TABLE statement, where the name of the table was 
catCache? I'm trying to directly populate a series of tables that will be used 
downstream primarily through SQL. I'd like to be able to go into dBeaver, 
browse the tables, and see 10 cats named Fluffy, if this is working correctly.
import org.apache.ignite.cache.query.annotations.*;
import java.io.*;

public class Cat implements Serializable  {
@QuerySqlField
int legs;
@QuerySqlField
String name;

Cat(int l, String n)
{
legs = l;
name = n;
}
}


import org.apache.ignite.Ignition;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.QueryCursor;
import java.util.List;
public class Test {
public static void main(String[] args)
{

Ignite ignite = Ignition.start();
CacheConfiguration cfg= new 
CacheConfiguration("catCache");

cfg.setCacheMode(CacheMode.REPLICATED);
cfg.setSqlEscapeAll(true);
cfg.setSqlSchema("PUBLIC");
cfg.setIndexedTypes(Integer.class,Cat.class);
try(IgniteCache cache = ignite.getOrCreateCache(cfg))
{
for (int i = 0; i < 10; ++i) {
cache.put(i, new Cat(i + 1,"Fluffy"));
}/*
SqlFieldsQuery sql = new SqlFieldsQuery("select * from 
catCache");
try (QueryCursor> cursor = cache.query(sql)) {
for (List row : cursor)
System.out.println("cat=" + row.get(0));
}*/
}
System.out.print("Got It!");

}}
Thanks,
Mike Williams



Re: @SpringApplicationContextResource / ApplicationContext / getBeansOfType()

2018-02-08 Thread Michael Cherkasov
Hi Navnet,

Could you please share a reproducer for this issue? Some small mvn based
project on github or as zip archive that will show the issue.

Thanks,
Mike.


2018-02-08 15:00 GMT-08:00 NK :

> Hi,
>
> I have a Spring Boot app using Ignite 2.3.0.
>
> I am invoking Ignite in a class called IgniteStarter using
> "IgniteSpring.start(springAppCtx)" where springAppCtx is my app's Spring
> Application Context.
>
> When I look for beans of a specific type in the main IgniteStarter class, I
> get the expected result. My code:
> Collection jdbcRepositories =
> springAppCtx.getBeansOfType(Repository.class).values();
>
> I have an IgniteService (bootstrapped by Ignite) where I need to use app
> context. When I use the same code as above (getBeansOfType(...)) in the
> IgniteService class, I don't get any beans.
>
> In the Ignite service, I am using ApplicationContext using annotation
> @SpringApplicationContextResource.
>
> I am able to get a correct bean count using
> springAppCtx.getBeanDefinitionCount() (so the context is set correctly),
> but
> getBeansOfType(...) doesn't work.
>
> Any pointers to why getBeansOfType(...) does not return anything on the
> spring app context managed / set by Ignite?
>
> Thanks,
> NK
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


@SpringApplicationContextResource / ApplicationContext / getBeansOfType()

2018-02-08 Thread NK
Hi, 

I have a Spring Boot app using Ignite 2.3.0. 

I am invoking Ignite in a class called IgniteStarter using
"IgniteSpring.start(springAppCtx)" where springAppCtx is my app's Spring
Application Context. 

When I look for beans of a specific type in the main IgniteStarter class, I
get the expected result. My code: 
Collection jdbcRepositories =
springAppCtx.getBeansOfType(Repository.class).values();
 
I have an IgniteService (bootstrapped by Ignite) where I need to use app
context. When I use the same code as above (getBeansOfType(...)) in the
IgniteService class, I don't get any beans. 

In the Ignite service, I am using ApplicationContext using annotation
@SpringApplicationContextResource. 

I am able to get a correct bean count using
springAppCtx.getBeanDefinitionCount() (so the context is set correctly), but
getBeansOfType(...) doesn't work. 

Any pointers to why getBeansOfType(...) does not return anything on the
spring app context managed / set by Ignite?

Thanks,
NK



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


Re: continuous query - changes from local server only

2018-02-08 Thread Som Som
i've got both client and server nodes on each of 3 physical servers, that
is my cluster. there is a partitioned cache, each server node stores only a
part of keys. i start the application on my dev machine that app is also
client of the cluster further i put new key into the cluster. i would like
to see this change only in client which is located with server node which
stores this new key.

8 февр. 2018 г. 11:41 ДП пользователь "dkarachentsev" <
dkarachent...@gridgain.com> написал:

Hi,

You may fuse filter for that, for example:

ContinuousQuery qry = new ContinuousQuery<>();

fine al Set nodes = new
HashSet<>(client.cluster().forDataNodes("cache")
.forHost(client.cluster().localNode()).nodes());

qry.setRemoteFilterFactory(new
Factory>() {
@Override public CacheEntryEventFilter
create() {
return new CacheEntryEventFilter() {
@IgniteInstanceResource
private Ignite ignite;

@Override public boolean evaluate(
CacheEntryEvent event) throws CacheEntryListenerException {
// Server nodes on current host
return nodes.contains(ignite.cluster().localNode());
}
};
}
});

Thanks!
-Dmitry



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


Re: Distributed transaction support in Ingnite

2018-02-08 Thread Ilya Lantukh
Hi Phasad,

Your approach is incorrect, and function that you passed into
ignite.compute().affinityRun(...) will be executed outside of transaction
scope. If you want to execute your code on the affinity node to modify
value in cache, you should use IgniteCache.invoke(...) method - it will be
a part of transaction.

Hope this helps.

On Thu, Feb 8, 2018 at 5:14 PM, Prasad Bhalerao <
prasadbhalerao1...@gmail.com> wrote:

> Hi,
>
> Does ignite support distributed transaction in case of collocate
> computation?
>
> I started two ignite nodes and then pushed the data to cache using
> following code. Please check code as given below.  In this code I am
> rolling back the transaction at the end of compute affinity run. But after
> doing rollback the values in the map are not getting restored to previous
> version.
>
> Can anyone please help? Am I doing something wrong?
>
>
> *public static void *main(String[] args) *throws *Exception {
> Ignition.*setClientMode*(*true*);
>
> *try*( Ignite ignite = Ignition.*start*(*"ignite-configuration.xml"*)){
> IgniteCache cache = 
> ignite.getOrCreateCache(*"ipcache1"*);
>
> *for *(*int *i = 0; i < 10; i++)
> cache.put(i, Integer.*toString*(i));
>
> *for *(*int *i = 0; i < 10; i++)
> System.*out*.println(*"Got [key=" *+ i + *", val=" *+ 
> cache.get(i) + *']'*);
>
> System.*out*.println(*"Node Started"*);
>
> *final *IgniteCache cache1 = 
> ignite.cache(*"ipcache1"*);
> IgniteTransactions transactions = ignite.transactions();
> *Transaction tx = transactions.txStart(TransactionConcurrency.*
> *OPTIMISTIC,
> TransactionIsolation.SERIALIZABLE**);*
>
> *for *(*int *i = 0; i < 10; i++) {
> *int *key = i;
>
>
>ignite.compute().affinityRun(*"ipcache1"*, key,
> () -> {
> System.*out*.println(*"Co-located using 
> affinityRun [key= " *+ key + *", value=" *+ cache1.localPeek(key) + *']'*);
>
> String s = cache1.get(key);
> s = s+*"#Modified"*;
> cache1.put(key,s);
> }
> );
> }
> *tx.rollback();*
> System.*out*.println(*"RolledBack..."*);
> *for *(*int *i = 0; i < 10; i++)
> System.*out*.println(*"Got [key=" *+ i + *", val=" *+ 
> cache.get(i) + *']'*);
> }
>
> }
>
>
>
> Thanks,
> Prasad
>



-- 
Best regards,
Ilya


Distributed transaction support in Ingnite

2018-02-08 Thread Prasad Bhalerao
Hi,

Does ignite support distributed transaction in case of collocate
computation?

I started two ignite nodes and then pushed the data to cache using
following code. Please check code as given below.  In this code I am
rolling back the transaction at the end of compute affinity run. But after
doing rollback the values in the map are not getting restored to previous
version.

Can anyone please help? Am I doing something wrong?


*public static void *main(String[] args) *throws *Exception {
Ignition.*setClientMode*(*true*);

*try*( Ignite ignite = Ignition.*start*(*"ignite-configuration.xml"*)){
IgniteCache cache =
ignite.getOrCreateCache(*"ipcache1"*);

*for *(*int *i = 0; i < 10; i++)
cache.put(i, Integer.*toString*(i));

*for *(*int *i = 0; i < 10; i++)
System.*out*.println(*"Got [key=" *+ i + *", val=" *+
cache.get(i) + *']'*);

System.*out*.println(*"Node Started"*);

*final *IgniteCache cache1 =
ignite.cache(*"ipcache1"*);
IgniteTransactions transactions = ignite.transactions();
*Transaction tx = transactions.txStart(TransactionConcurrency.*
*OPTIMISTIC,
TransactionIsolation.SERIALIZABLE**);*

*for *(*int *i = 0; i < 10; i++) {
*int *key = i;


   ignite.compute().affinityRun(*"ipcache1"*, key,
() -> {
System.*out*.println(*"Co-located using
affinityRun [key= " *+ key + *", value=" *+ cache1.localPeek(key) +
*']'*);

String s = cache1.get(key);
s = s+*"#Modified"*;
cache1.put(key,s);
}
);
}
*tx.rollback();*
System.*out*.println(*"RolledBack..."*);
*for *(*int *i = 0; i < 10; i++)
System.*out*.println(*"Got [key=" *+ i + *", val=" *+
cache.get(i) + *']'*);
}

}



Thanks,
Prasad


Re: continuous query - changes from local server only

2018-02-08 Thread dkarachentsev
Hi,

You may fuse filter for that, for example:

ContinuousQuery qry = new ContinuousQuery<>();

final Set nodes = new
HashSet<>(client.cluster().forDataNodes("cache")
.forHost(client.cluster().localNode()).nodes());

qry.setRemoteFilterFactory(new
Factory>() {
@Override public CacheEntryEventFilter
create() {
return new CacheEntryEventFilter() {
@IgniteInstanceResource
private Ignite ignite;

@Override public boolean evaluate(
CacheEntryEvent event) throws CacheEntryListenerException {
// Server nodes on current host
return nodes.contains(ignite.cluster().localNode());
}
};
}
});

Thanks!
-Dmitry



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