You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by 罗 辉 <lu...@zetyun.com> on 2017/08/18 03:48:08 UTC

答复: problems in test ignite PersistentStore

thank you dkarachentsev, i realized the type undefined mistake


     I correct my codes like below :

object SingleNodePersist {
  def main(args: Array[String]) {
    Ignition.setClientMode(true)
    val config = "/data/disk01/huzongxing/ignite/config/test.xml"
    val ig = Ignition.start(config)
    ig.active(true)
    val cache = ig.getOrCreateCache[Long, Int]("organization")
    val psc = new PersistentStoreConfiguration
    psc.setPersistentStorePath("/ssd")

    val streamer = ig.dataStreamer[Long, Int]("organization")
    streamer.allowOverwrite(true)
    for (i <- 1 to 10000) {
      streamer.addData(i, i)
      if (i > 0 && i % 10000 == 0)
        println("Done: " + i)
    }

    cache.close()
  }
}


and my test.xml as well:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <!-- Enabling Apache Ignite Persistent Store. -->
        <property name="persistentStoreConfiguration">
            <bean class="org.apache.ignite.configuration.PersistentStoreConfiguration"/>
        </property>
        <!-- Setting up caches. -->
        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="organization"/>
                    <property name="backups" value="1"/>
                    <property name="atomicityMode" value="TRANSACTIONAL"/>
                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
<!--
                    <property name="indexedTypes">
                        <list>
                            <value>java.lang.Long</value>
                            <value>java.lang.Int</value>
                        </list>
                    </property>
-->
                </bean>
            </list>
        </property>
        <property name="binaryConfiguration">
            <bean class="org.apache.ignite.configuration.BinaryConfiguration">
                <property name="compactFooter" value="false"/>
            </bean>
        </property>
        <!-- Explicitly configure TCP discovery SPI to provide a list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with actual host IP address. -->
                                <value>127.0.0.1:47500..47502</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

after I changed my code and xml file,the test program can run normally.
I am expecting something to be written into /ssd directory , however I found nothing.
It seems the cache default behaviour is to store the cache data into memory only , not memory and disk simultaneously.
I will continue to look up the docs which you mentioned .

thanks again.


________________________________
发件人: dkarachentsev <dk...@gridgain.com>
发送时间: 2017年8月18日 0:08:17
收件人: user@ignite.apache.org
主题: Re: problems in test ignite PersistentStore

Hi,

1. You need to set types for datastreamer just like for cache you did:
var streamer = ig.dataStreamer[Int, String]("organization")

2. Check that classes from ignite/examples are in classpath. It's a maven
module which has scala examples that you may play with.

3. [1, 2, 3]

[1]
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/PersistentStoreConfiguration.html#setPersistentStorePath(java.lang.String)
[2]
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/PersistentStoreConfiguration.html#setWalStorePath(java.lang.String)
[3]
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/PersistentStoreConfiguration.html#setWalArchivePath(java.lang.String)

Thanks!
-Dmitry.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problems-in-test-ignite-PersistentStore-tp16244p16256.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

答复: 答复: problems in test ignite PersistentStore

Posted by 罗 辉 <lu...@zetyun.com>.
got it ,thank you Val, I got to have another try.

________________________________
发件人: vkulichenko <va...@gmail.com>
发送时间: 2017年8月19日 1:54:11
收件人: user@ignite.apache.org
主题: Re: 答复: problems in test ignite PersistentStore

You don't see anything in /ssd folder, because you provided it in
PersistenceStoreConfiguration object which is not even set anywhere. This
code has no effect:

val psc = new PersistentStoreConfiguration
psc.setPersistentStorePath("/ssd")

Actually, Ignite configuration can't be changed in runtime anyway, so it
should be done in XML as part of PersistentStoreConfiguration bean:

<property name="persistentStoreConfiguration">
    <bean
class="org.apache.ignite.configuration.PersistentStoreConfiguration">
        <property name="persistentStorePath" value="/ssd"/>
    </bean
</property>

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problems-in-test-ignite-PersistentStore-tp16244p16297.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: 答复: problems in test ignite PersistentStore

Posted by vkulichenko <va...@gmail.com>.
You don't see anything in /ssd folder, because you provided it in
PersistenceStoreConfiguration object which is not even set anywhere. This
code has no effect:

val psc = new PersistentStoreConfiguration
psc.setPersistentStorePath("/ssd")

Actually, Ignite configuration can't be changed in runtime anyway, so it
should be done in XML as part of PersistentStoreConfiguration bean:

<property name="persistentStoreConfiguration">
    <bean
class="org.apache.ignite.configuration.PersistentStoreConfiguration">
        <property name="persistentStorePath" value="/ssd"/>
    </bean
</property>

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problems-in-test-ignite-PersistentStore-tp16244p16297.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.