2017-03-09 3 views
0

우리는 Kundera ORM을 사용하여 REST 서비스에서 Cassandra에 연결합니다. 의 persistence.xml에서 우리는Kundera 및 Cassandra ThriftClient 관련

<property name="kundera.client.lookup.class" 
       value="com.impetus.client.cassandra.thrift.ThriftClientFactory" /> 

아래로 ThriftClientFactory으로 클라이언트 조회 클래스를 지정하는이 카산드라에 연결하는 올바른 방법인가, 아니면 쿤데라을 통해 CQL을 사용하여 우리는 카산드라에 연결할 수있는 방법은 무엇입니까?

답변

0

예, Kundera의 ThriftClient는 Cassandra와 통신하기 위해 CQL을 사용합니다. 또한이 클라이언트를 사용하는 동안 응용 프로그램에서 CQL3을 활성화해야합니다.

CQL3 설정 : 당신의 EntityManagerFactory에서

  • 아래에 주어진 어떤 방법을 선택할 수 있습니다

    HashMap propertyMap = new HashMap(); 
    propertyMap.put(CassandraConstants.CQL_VERSION, CassandraConstants.CQL_VERSION_3_0); 
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("cassandra_pu", propertyMap); 
    
  • 의 EntityManager에서

    EntityManagerFactory emf = Persistence.createEntityManagerFactory("cassandra_pu"); 
    EntityManager em = emf.createEntityManager(); 
    em.setProperty("cql.version", "3.0.0"); 
    
+0

감사 Karth 귀하의 회신에 대해. 현재 com.impetus.client.cassandra.thrift.ThriftClientFactory 클래스를 "kundera.client.lookup.class"로 사용하고 있습니다. 9160 인 절약 보호기를 통해 연결합니다. 그러나 cassandra proded 클러스터에서는 9160 포트가 비활성화되고 9042 인 CQL3 포트를 사용하십시오. 그래서 kundera 클라이언트를 위해 어떤 클래스를 사용해야합니까? "com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory"를 사용하는 것이 좋습니다? – Raj

+0

@Raj 예, DSClientFactory를 사용할 수 있지만이 경우 자동 스키마 생성 기능이 작동하지 않습니다. 이것이 요구 사항이 아니라면'com.impetus.kundera.client.cassandra.dsdriver.DSClientFacto ry'로 진행할 수 있습니다. –