zookeeper always open and close when do TitanFactory.build().set(***).open()

338 views
Skip to first unread message

liujia...@gmail.com

unread,
Aug 23, 2016, 6:12:18 AM8/23/16
to Aurelius
Firstly thanks for your time.
Titan 1.0.0 with Hadoop 2 can’t be executed through gremlin because of MR error, I downloaded Titan 0.5.4 with Hadoop 2, but run gremlin.sh ( g = TitanFactory.open('conf/titan-hbase-es.properties') command in hbase distributed or single environment, zookeeper will always open and then shut down immediately. 
I am so confused about this, appreciate your help. Thanks.

java version is 1.8.0_65-b17;
hbase version is 0.98
titan version is 1.0.0 with Hadoop 2
zoo.cfg, running client count is 30, smaller than 50. and web is ok.https://cloud.githubusercontent.com/assets/5652299/17795847/639508cc-65ee-11e6-99ac-7d19d1e3eb7e.png

java code

public static void main(String[] args) {
        long timeBegin = System.currentTimeMillis();
        TitanGraph graph = TitanFactory.build()
                .set("storage.backend", "hbase")
                .set("storage.hostname", "172.21.0.74")
                .set("storage.hbase.table", "titan22")
                .open();
        System.out.println("open cost time :" + (System.currentTimeMillis() - timeBegin));
        long time = System.currentTimeMillis();
        GraphTraversalSource g = graph.traversal();
        Vertex fromNode = g.V().has("name", "marko").next();
        Set<Edge> set = g.V(fromNode).bothE().bothV().bothE().toSet();
        System.out.println("list size = " + set.size());
        for (Edge edge : set) {
            System.out.println("inVertex: " + edge.inVertex().property("name"));
            System.out.println("outVertex: " + edge.outVertex().property("name"));
        }
        System.out.println("cost time :" + (System.currentTimeMillis() - time));
        System.out.println("cost whole time :" + (System.currentTimeMillis() - timeBegin));
        System.out.println("----ok-----");
        graph.close();
    }

logs in console
`2016-08-19 09:12:42,705 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=hconnection-0x1e008f36, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:42,706 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=hconnection-0x1e008f36 connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:42,707 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:42,711 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:42,739 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x35655148726197b, negotiated timeout = 60000
2016-08-19 09:12:42,746 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=catalogtracker-on-hconnection-0x1e008f36, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:42,747 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=catalogtracker-on-hconnection-0x1e008f36 connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:42,747 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:42,749 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:42,895 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x35655148726197c, negotiated timeout = 60000
2016-08-19 09:12:42,919 INFO [main] org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.closeZooKeeperWatcher(1856) | Closing zookeeper sessionid=0x35655148726197b
2016-08-19 09:12:42,997 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x35655148726197b closed
2016-08-19 09:12:42,997 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:43,298 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x35655148726197c closed
2016-08-19 09:12:43,298 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:43,307 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=hconnection-0xc6634d, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:43,309 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:43,309 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=hconnection-0xc6634d connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:43,311 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:43,345 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x35655148726197d, negotiated timeout = 60000
2016-08-19 09:12:43,407 INFO [main] org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.closeZooKeeperWatcher(1856) | Closing zookeeper sessionid=0x35655148726197d
2016-08-19 09:12:43,446 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x35655148726197d closed
2016-08-19 09:12:43,446 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:43,551 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=hconnection-0x7ea08277, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:43,552 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=hconnection-0x7ea08277 connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:43,552 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:43,745 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:43,875 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x35655148726197e, negotiated timeout = 60000
2016-08-19 09:12:43,882 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=catalogtracker-on-hconnection-0x7ea08277, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:43,891 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=catalogtracker-on-hconnection-0x7ea08277 connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:43,891 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:43,895 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:43,940 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x35655148726197f, negotiated timeout = 60000
2016-08-19 09:12:43,977 INFO [main] org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.closeZooKeeperWatcher(1856) | Closing zookeeper sessionid=0x35655148726197e
2016-08-19 09:12:44,014 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x35655148726197e closed
2016-08-19 09:12:44,038 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:44,315 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x35655148726197f closed
2016-08-19 09:12:44,318 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:44,356 INFO [main] com.thinkaurelius.titan.graphdb.database.IndexSerializer.(71) | Hashing index keys
2016-08-19 09:12:44,632 INFO [main] com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog$MessagePuller.initializeTimepoint(730) | Loaded unidentified ReadMarker start time 2016-08-19T01:12:44.534Z into com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog$MessagePuller@7ea899a9
open cost time :40902
list size = 6
inVertex: vp[name->lop]
outVertex: vp[name->peter]

inVertex: vp[name->josh]
outVertex: vp[name->marko]

inVertex: vp[name->vadas]
outVertex: vp[name->marko]

inVertex: vp[name->lop]
outVertex: vp[name->marko]

inVertex: vp[name->lop]
outVertex: vp[name->josh]

inVertex: vp[name->ripple]
outVertex: vp[name->josh]

cost time :792
cost whole time :41694
----ok-----
2016-08-19 09:12:45,438 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=hconnection-0x9596ce8, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:45,440 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=hconnection-0x9596ce8 connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:45,440 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:45,443 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:45,590 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x356551487261980, negotiated timeout = 60000
2016-08-19 09:12:45,599 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=catalogtracker-on-hconnection-0x9596ce8, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:45,604 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:45,606 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=catalogtracker-on-hconnection-0x9596ce8 connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:45,608 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:45,842 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x356551487261981, negotiated timeout = 60000
2016-08-19 09:12:45,877 INFO [main] org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.closeZooKeeperWatcher(1856) | Closing zookeeper sessionid=0x356551487261980
2016-08-19 09:12:45,966 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x356551487261980 closed
2016-08-19 09:12:45,966 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:46,097 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x356551487261981 closed
2016-08-19 09:12:46,097 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:46,108 INFO [main] org.apache.zookeeper.ZooKeeper.(438) | Initiating client connection, connectString=172.21.0.74:2181 sessionTimeout=90000 watcher=hconnection-0x7a0e7ecd, quorum=172.21.0.74:2181, baseZNode=/hbase
2016-08-19 09:12:46,109 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.(120) | Process identifier=hconnection-0x7a0e7ecd connecting to ZooKeeper ensemble=172.21.0.74:2181
2016-08-19 09:12:46,110 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.logStartConnect(975) | Opening socket connection to server 172.21.0.74/172.21.0.74:2181. Will not attempt to authenticate using SASL (unknown error)
2016-08-19 09:12:46,113 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(852) | Socket connection established to 172.21.0.74/172.21.0.74:2181, initiating session
2016-08-19 09:12:46,365 INFO [main-SendThread(172.21.0.74:2181)] org.apache.zookeeper.ClientCnxn$SendThread.onConnected(1235) | Session establishment complete on server 172.21.0.74/172.21.0.74:2181, sessionid = 0x356551487261982, negotiated timeout = 60000
2016-08-19 09:12:46,416 INFO [main] org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.closeZooKeeperWatcher(1856) | Closing zookeeper sessionid=0x356551487261982
2016-08-19 09:12:46,507 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x356551487261982 closed
2016-08-19 09:12:46,512 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down
2016-08-19 09:12:46,635 INFO [main] org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.closeMasterService(2193) | Closing master protocol: MasterService
2016-08-19 09:12:46,636 INFO [main] org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.closeZooKeeperWatcher(1856) | Closing zookeeper sessionid=0x356551487261919
2016-08-19 09:12:46,894 INFO [main] org.apache.zookeeper.ZooKeeper.close(684) | Session: 0x356551487261919 closed
2016-08-19 09:12:46,897 INFO [main-EventThread] org.apache.zookeeper.ClientCnxn$EventThread.run(512) | EventThread shut down`

***i don't know the reason. i trace the source code and find org.apache.hadoop.hbase.client.tableExists(final TableName tableName) always run. this will create a new CatalogTracker object which is also a ZooKeeper client , and will cleanup the ZooKeeper client and the session.*

my pom.xml

<packaging>jar</packaging>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <titan.version>1.0.0</titan.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-core</artifactId>
            <version>${titan.version}</version>
        </dependency>
        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-hbase</artifactId>
            <version>${titan.version}</version>
        </dependency>
        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-es</artifactId>
            <version>${titan.version}</version>
        </dependency>
        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-hadoop</artifactId>
            <version>${titan.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.hadoop</groupId>
                    <artifactId>hadoop-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
            <version>2.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>3.4.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-driver</artifactId>
            <version>3.0.1-incubating</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-client</artifactId>
            <version>0.98.6-hadoop2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.12</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <!-- TinkerPop3 requires Java 8 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Jason Plurad

unread,
Aug 24, 2016, 9:27:39 PM8/24/16
to Aurelius
Hi, I'm a bit confused by your post... what precisely is the error? The logs you posted seem to indicate a clean run -- all the log messages are INFO level. Perhaps you just want adjust your log4j settings with something like:

log4j.logger.org.apache.zookeeper=WARN
log4j
.logger.org.apache.hadoop.hbase.client=WARN
log4j
.logger.org.apache.hadoop.hbase.zookeeper=WARN

-- Jason

n...@cerebri.com

unread,
Aug 31, 2016, 3:26:45 AM8/31/16
to Aurelius
I saw this when there was something wrong within HBase/HDFS, try restarting them (slowly per Slave)....

liujia...@gmail.com

unread,
Oct 8, 2016, 4:22:26 AM10/8/16
to Aurelius
thanks, it is my fault.

在 2016年8月25日星期四 UTC+8上午9:27:39,Jason Plurad写道:

liujia...@gmail.com

unread,
Oct 8, 2016, 4:22:56 AM10/8/16
to Aurelius
thanks

在 2016年8月31日星期三 UTC+8下午3:26:45,n...@cerebri.com写道:
Reply all
Reply to author
Forward
0 new messages