在Cassandra中同步02节点 [英] Sync 02 nodes in Cassandra

查看:109
本文介绍了在Cassandra中同步02节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有02个节点,一个运行在127.0.0.1,另一个运行在127.0.0.2
\\我将添加到我的集群的数据将出现在两个节点上?作为当前,当我停止节点1,在第二个节点没有类似的数据,它也抛出一些异常,当我使用list命令:

I have 02 nodes, one runs on 127.0.0.1 and another runs on 127.0.0.2
Will data that I add to my cluster will appear both on two nodes? As current, when I stop node 1, there is no similar data in the second node, it also throws some exceptions when I use list command:

Using default limit of 100                                      
Using default column limit of 100
null
UnavailableException()
    at org.apache.cassandra.thrift.Cassandra$get_range_slices_result.read(Cassandra.java:12346)
    at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
    at org.apache.cassandra.thrift.Cassandra$Client.recv_get_range_slices(Cassandra.java:692)
    at org.apache.cassandra.thrift.Cassandra$Client.get_range_slices(Cassandra.java:676)
    at org.apache.cassandra.cli.CliClient.executeList(CliClient.java:1425)
    at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:273)
    at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:219)
    at org.apache.cassandra.cli.CliMain.main(CliMain.java:346)

事情是我使用kundera连接到cassandra db在我的java应用程序(Built on Play FW 2.0.4),我的持久性文件如下:

One more thing is I use kundera to connect to cassandra db in my java application (Built on Play FW 2.0.4), my persistence file is as below:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">
    <persistence-unit name="cassandra_pu">
        <provider>com.impetus.kundera.KunderaPersistence</provider>     
        <properties>            
            <property name="kundera.nodes" value="localhost"/>
            <property name="kundera.port" value="9160"/>
            <property name="kundera.keyspace" value="LSYCS"/>
            <property name="kundera.dialect" value="cassandra"/>
            <property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
            <property name="kundera.cache.provider.class" value="com.impetus.kundera.cache.ehcache.EhCacheProvider"/>
            <property name="kundera.cache.config.resource" value="/ehcache-test.xml"/>                  
        </properties>       
    </persistence-unit>
</persistence>

我假设当节点1关闭时,应用程序仍然能够连接到第二个节点,它不能这样做。这里真的是真的错了吗?我想要的是当127.0.0.1离线时,127.0.0.2将能够处理这些作业,还是需要一个顶层应用程序来管理它们?

I assumed that when node 1 is down, the application will still able to connect to second node, but it wasnot able to do that. Is something really really wrong here ? What I expects is when 127.0.0.1 is offline, 127.0.0.2 will able to handle the jobs, or do they need a top application to manage them?


P / S:我在我的计算机上设置,因此127.0.0.1和127.0.0.2都指向localhost


P/S: I setup on my computer thus both 127.0.0.1 and 127.0.0.2 point to localhost

推荐答案

Cassandra复制: http://www.datastax.com/docs/1.1/cluster_architecture/replication

You should read about Cassandra replication here: http://www.datastax.com/docs/1.1/cluster_architecture/replication

这篇关于在Cassandra中同步02节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆