creating table on a pre-existing cache in ignite

classic Classic list List threaded Threaded
6 messages Options
datta datta
Reply | Threaded
Open this post in threaded view
|

creating table on a pre-existing cache in ignite

hi ,

I am unable to create a table in a pre-created cache in ignite

my cache config in ignite xml

 <property name="cacheConfiguration">
      <bean class="org.apache.ignite.configuration.CacheConfiguration">
         
          <property name="name" value="dlkCache"/>
         
          <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
           <property name="backups" value="1"/>
            <property name="cacheMode" value="PARTITIONED"/>
            <property name="rebalanceMode" value="ASYNC"/>
            <property name="partitionLossPolicy" value="READ_ONLY_SAFE"/>
        </bean>
    </property>


create table statement

CREATE TABLE IF NOT EXISTS Person (
  id int,
  city_id int,
  name varchar,
  age int,
  company varchar,
  PRIMARY KEY (id, city_id)
) WITH
"template=partitioned,backups=1,affinity_key=city_id,cache_name=dlkCache";

I am using ignite 2.5.0 with 2 server nodes





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: creating table on a pre-existing cache in ignite

Hello!

It is not possible to create table on existing cache. You can only create a table when creating new cache.

Regards,
--
Ilya Kasnacheev


пт, 13 дек. 2019 г. в 19:30, datta <[hidden email]>:
hi ,

I am unable to create a table in a pre-created cache in ignite

my cache config in ignite xml

 <property name="cacheConfiguration">
      <bean class="org.apache.ignite.configuration.CacheConfiguration">

          <property name="name" value="dlkCache"/>

          <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
           <property name="backups" value="1"/>
            <property name="cacheMode" value="PARTITIONED"/>
            <property name="rebalanceMode" value="ASYNC"/>
            <property name="partitionLossPolicy" value="READ_ONLY_SAFE"/>
        </bean>
    </property>


create table statement

CREATE TABLE IF NOT EXISTS Person (
  id int,
  city_id int,
  name varchar,
  age int,
  company varchar,
  PRIMARY KEY (id, city_id)
) WITH
"template=partitioned,backups=1,affinity_key=city_id,cache_name=dlkCache";

I am using ignite 2.5.0 with 2 server nodes





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
datta datta
Reply | Threaded
Open this post in threaded view
|

Re: creating table on a pre-existing cache in ignite

Hi,

Ok

is there way to create table from config.xml under cache config.

i want to specify primary key and affinity key both in the xml file



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: creating table on a pre-existing cache in ignite

Hello!

Yes, you can do that by following this documentation:


Regards,
--
Ilya Kasnacheev


сб, 14 дек. 2019 г. в 09:53, datta <[hidden email]>:
Hi,

Ok

is there way to create table from config.xml under cache config.

i want to specify primary key and affinity key both in the xml file



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Surkov.Aleksandr Surkov.Aleksandr
Reply | Threaded
Open this post in threaded view
|

Re: creating table on a pre-existing cache in ignite

Hello datta!

To create a table on an existing cache, you can see my example
https://github.com/SurkovAleksandr/Ignite-table-for-cache



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Surkov.Aleksandr Surkov.Aleksandr
Reply | Threaded
Open this post in threaded view
|

Re: creating table on a pre-existing cache in ignite