kundera icon indicating copy to clipboard operation
kundera copied to clipboard

Cannot change the port number.

Open vargasbo opened this issue 13 years ago • 5 comments

Found in conf/META-INF/persistence.xml

<persistence-unit name="hbaseTest">
    <provider>com.impetus.kundera.KunderaPersistence</provider>
    <properties>
        <property name="kundera.nodes" value="dc1-r1-n6.qwestcolo.local,dc1-r1-n5.qwestcolo.local,dc1-r2-n5.qwestcolo.local" />
        <property name="kundera.port" value="5181" />
        <property name="kundera.keyspace" value="a" />
        <property name="kundera.dialect" value="hbase" />
        <property name="kundera.client.lookup.class" value="com.impetus.client.hbase.HBaseClientFactory" />
        <property name="kundera.cache.provider.class"
                  value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
        <property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
        <property name="kundera.ddl.auto.prepare" value="create" />
    </properties>
</persistence-unit>

This is what I'm seeing in the debug window. [info] o.a.z.ZooKeeper - Initiating client connection, connectString=dc1-r1-n5.qwestcolo.local:2181,dc1-r1-n6.qwestcolo.local:2181,dc1-r2-n5.qwestcolo.local:2181 sessionTimeout=180000 watcher=hconnection [debug] o.a.z.ClientCnxn - zookeeper.disableAutoWatchReset is false [info] o.a.z.ClientCnxn - Opening socket connection to server /10.12.212.10:2181

I'm either missing a configuration somewhere or this is a bug.

An issue with 2.4 & 2.5.

vargasbo avatar Jun 04 '13 22:06 vargasbo

Hi, port in persistence.unit maps with the port of hbase master, use default port(2181) for zookeeper. To provide different port of zookeeper you have to define a xml file with following properties:

<?xml version="1.0" encoding="UTF-8"?>
<clientProperties>
<datastores>
<dataStore>
<name>hbase</name>
<connection>
<properties>
<property name="hbase.zookeeper.quorum" value="localhost"></property>
<property name="hbase.zookeeper.property.clientPort"
value="2181"></property>
</properties>
</connection>
</dataStore>
</datastores>
</clientProperties>

and add a property under persistence-unit property tag

<property name="kundera.client.property" value="propertyFileName" />

for reference you can refer following link: https://github.com/impetus-opensource/Kundera/blob/trunk/kundera-core/src/test/resources/kunderaTest.xml

Thanks Kuldeep

kkmishra avatar Jun 05 '13 09:06 kkmishra

I still think this is a bug. One has to define the nodes and port in two different location. If I remove the

property name="kundera.nodes" value="dc1-r1-n6.qwestcolo.local,dc1-r1-n5.qwestcolo.local,dc1-r2-n5.qwestcolo.local"

property name="kundera.port" value="5181"

in the persistence.xml file you get this error. c.i.c.h.s.HBaseSchemaManager - Host or port should not be null / port should be numeric.

If I place the correct nodes and port number, it ignores my port number. It only works when I place it in both location. Having to place configuration in two different location is error prone and my DevOps team will complain.

vargasbo avatar Jun 05 '13 16:06 vargasbo

Persistence.xml is a place for common set of properties across database supported by Kundera(e.g. Cassandra, HBase etc). "kundera.port" property maps to HMaster port, not to zookeeper. By default zookeeper runs on 2181(this is why Kundera keeps it as default zookeeper port) and such configurations are specific to HBase. That's the reason behind configuring it with external configuration file rather than exploiting persistence.xml.

HBaseSchemaManager error will only be reported if you opted for "kundera.ddl.auto.prepare" option in persistence.xml.

Changing configurations such zookeeper port, or "hbase.zookeeper.quorum"{ running zookeeper on different host}, "TTL" etc are specific to HBase. And such configurations should always to "Data store specific configuration.

You don't need to duplicate any configuration between two files. Generic ones can be defined within persistence.xml, and rest db specific must be go with xml configuration files.

Hope it helps.

-Vivek

mevivs avatar Jun 05 '13 16:06 mevivs

Yes!! That makes sense. Where can I find documentation? I'm trying to do a simple CRUD with an class that has two column families. I'm finding tons of code samples, but nothing which explains the logic as you just did.

vargasbo avatar Jun 05 '13 16:06 vargasbo

Basic junit can be referred from given below link: https://github.com/impetus-opensource/Kundera/blob/trunk/kundera-hbase/src/test/java/com/impetus/client/hbase/crud/PersonHBaseTest.java

Support on different data types can be found at: https://github.com/impetus-opensource/Kundera/tree/trunk/kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes

About providing a db specific configuration file, please refer to Kuldeep's comment on previous post.

Single entity definition will belong to a single column family only!

Hope it helps. -Vivek

mevivs avatar Jun 05 '13 16:06 mevivs