点燃现有cassandra上的缓存

wqsoz72f  于 2021-06-14  发布在  Cassandra
关注(0)|答案(0)|浏览(288)

我是ignite的新手,尝试使用ignite作为cassandra缓存。我用我的本地机器点火,想连接我的远程Cassandra。当我给出ignite和cassandra(连接设置和yaml)的127.0.0.1时,cassandra开始嵌入。但是当我试着连接到遥控器的时候。
这是我的连接xml

<bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.TokenAwarePolicy">
    <constructor-arg
        type="com.datastax.driver.core.policies.LoadBalancingPolicy">
        <bean class="com.datastax.driver.core.policies.RoundRobinPolicy" />
    </constructor-arg>
</bean>

<bean id="cassandraAdminDataSource"
    class="org.apache.ignite.cache.store.cassandra.datasource.DataSource">
    <property name="port" value="9049" />
    <property name="contactPoints" value="x.x.x.x" />
    <property name="readConsistency" value="ONE" />
    <property name="writeConsistency" value="ONE" />
    <property name="loadBalancingPolicy" ref="loadBalancingPolicy" />
</bean>

我的持久性连接

<bean id="primitive_csndra_cache" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
    <constructor-arg type="java.lang.String">
        <value><![CDATA[
            <persistence keyspace="hello" table="primitive_xyz">
                <keyPersistence class="java.lang.String" strategy="PRIMITIVE" column="key"/>
                <valuePersistence class="java.lang.String" strategy="PRIMITIVE" column="value"/>
            </persistence>]]>
        </value>
    </constructor-arg>
</bean>

<bean id="blob_csndra_cache" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
    <constructor-arg type="java.lang.String">
        <value><![CDATA[
            <persistence keyspace="hello" table="blob_persons">
                <keyPersistence class="my.apache.ignite.examples.collocation.PersonKey" strategy="BLOB" column="PersonKey"/>
                <valuePersistence class="my.apache.ignite.examples.collocation.Person" strategy="BLOB" column="Person"/>
            </persistence>]]>
        </value>
    </constructor-arg>
</bean>

<bean id="pojo_csndra_cache" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
    <constructor-arg type="java.lang.String">
        <value><![CDATA[
            <persistence keyspace="hello" table="pojo_persons">
                <keyPersistence class="my.apache.ignite.examples.collocation.PersonKey" strategy="POJO">
                    <partitionKey>
                        <field name="companyId" column="key_companyid"/>
                    </partitionKey>

                     <clusterKey>
                        <field name="name" column="key_name" />
                    </clusterKey>
                </keyPersistence>

                <valuePersistence class="my.apache.ignite.examples.collocation.Person" strategy="POJO">
                    <field name="name" column="name" />
                    <field name="age" />
                    <field name="salary" index="true"/>
                    <field name="companyId" />
                </valuePersistence>
            </persistence>]]>
        </value>
    </constructor-arg>
</bean>

我的 Spring Bean

<import resource="classpath:cassandra/connection-settings.xml" />
<import resource="classpath:persistence/primitive/persistence-settings.xml" />

<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">

    <!-- Set to true to enable distributed class loading for examples, default is false. -->
    <property name="peerClassLoadingEnabled" value="true"/>
    <property name="localHost" value="127.0.0.1"/>

    <property name="gridLogger">
        <bean class="org.apache.ignite.logger.slf4j.Slf4jLogger"/>        
    </property>

    <property name="lifecycleBeans">
        <list>
            <bean class="org.apache.ignite.cache.store.cassandra.bean.CassandraLifeCycleBean">
                <property name="jmxPort" value="9981"/>
                <property name="cassandraConfigFile" value="C:\\\ignite-cassandra\\\src\\\main\\\resources\\\cassandra\\\embedded-cassandra.yaml"/>
            </bean>
        </list>
    </property>

    <property name="cacheConfiguration">
        <list>
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name" value="primitive_csndra_cache"/>
                <property name="cacheMode" value="PARTITIONED"/>
                <property name="atomicityMode" value="ATOMIC"/>
                <property name="backups" value="0"/>
                <property name="readThrough" value="true"/>
                <property name="writeThrough" value="true"/>
                <property name="copyOnRead" value="false"/>
                <property name="eagerTtl" value="false"/>
                <property name="memoryMode" value="OFFHEAP_TIERED"/>
                <property name="offHeapMaxMemory" value="#{10 * 1024 * 1024}"/>
                <property name="swapEnabled" value="false"/>
                <property name="affinity">
                    <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
                        <property name="partitions" value="10"/>
                    </bean>
                </property>
                <property name="cacheStoreFactory">
                    <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                        <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                        <property name="persistenceSettingsBean" value="primitive_csndra_cache"/>
                    </bean>
                </property>
                <property name="managementEnabled" value="true"/>
                <property name="readFromBackup" value="true"/>
            </bean>

            <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name" value="blob_csndra_cache"/>
                <property name="cacheMode" value="PARTITIONED"/>
                <property name="atomicityMode" value="ATOMIC"/>
                <property name="backups" value="0"/>
                <property name="readThrough" value="true"/>
                <property name="writeThrough" value="true"/>
                <property name="copyOnRead" value="false"/>
                <property name="eagerTtl" value="false"/>
                <property name="memoryMode" value="OFFHEAP_TIERED"/>
                <property name="offHeapMaxMemory" value="#{10 * 1024 * 1024}"/>
                <property name="swapEnabled" value="false"/>
                <property name="affinity">
                    <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
                        <property name="partitions" value="10"/>
                    </bean>
                </property>
                <property name="cacheStoreFactory">
                    <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                        <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                        <property name="persistenceSettingsBean" value="blob_csndra_cache"/>
                    </bean>
                </property>
                <property name="managementEnabled" value="true"/>
                <property name="readFromBackup" value="true"/>
            </bean>

            <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name" value="pojo_csndra_cache"/>
                <property name="cacheMode" value="PARTITIONED"/>
                <property name="atomicityMode" value="ATOMIC"/>
                <property name="backups" value="0"/>
                <property name="readThrough" value="true"/>
                <property name="writeThrough" value="true"/>
                <property name="copyOnRead" value="false"/>
                <property name="eagerTtl" value="false"/>
                <property name="memoryMode" value="OFFHEAP_TIERED"/>
                <property name="offHeapMaxMemory" value="#{10 * 1024 * 1024}"/>
                <property name="swapEnabled" value="false"/>
                <property name="affinity">
                    <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
                        <property name="partitions" value="10"/>
                    </bean>
                </property>
                <property name="cacheStoreFactory">
                    <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                        <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                        <property name="persistenceSettingsBean" value="pojo_csndra_cache"/>
                    </bean>
                </property>
                <property name="managementEnabled" value="true"/>
                <property name="readFromBackup" value="true"/>
            </bean>
        </list>
    </property>

    <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <property name="ipFinder">
                <!--
                    Ignite provides several options for automatic discovery that can be used
                    instead os static IP based discovery. For information on all options refer
                    to our documentation: http://apacheignite.readme.io/docs/cluster-config
                -->
                <!-- 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..47509</value>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </property>
</bean>

当我试着启动点火器时,它会抛出
org.apache.ignite.ignitecheckedexception:无法启动嵌入式cassandra
然后
java.lang.runtimeexception:致命的配置错误
以及
org.apache.cassandra.exceptions.configurationexception:无法绑定到地址/x.x.x.x:7000。将cassandra.yaml中的listen\u address设置为可以绑定到的接口,例如ec2上的私有ip地址
我已经在yaml中设置了正确的地址。有什么意见吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题