imjuni / jshs2

jsHS2 is a node.js client driver for hive server 2
http://imjuni.github.io/jshs2/
MIT License
34 stars 12 forks source link

why no response??? #9

Closed xushuo closed 7 years ago

xushuo commented 8 years ago

Port: 10000, Servers: [ '192.168.100.125' ], username: 'hadoop', query: 'show databases' } }

{ auth: 'NOSASL', host: '192.168.100.125', port: 10000, timeout: 10000, username: 'hadoop', hiveVer: '1.2.0', thriftVer: '0.9.2', hiveType: 0, maxRows: 5120, nullStr: 'NULL' } jshs2:configure port, : +0ms 10000 jshs2:configure timeout, : +4ms 10000 jshs2:configure hiveType, : +2ms 0 jshs2:configure hiveVer, : +2ms 1.2.0 jshs2:configure thirftVer, : +3ms 0.9.2 jshs2:configure cdhVer, : +1ms null jshs2:CConnection OpenSession function start, -> +27ms 192.168.100.125 jshs2:CConnection OpenSession function start, -> +2ms 10000 jshs2:CConnection Initialize, username -> +6ms hadoop jshs2:CConnection Initialize, password -> +1ms jshs2:CConnection OpenSession request start, +1ms { client_protocol: 7, username: 'hadoop', password: '', configuration: null } .. . . . no response.....

why?

imjuni commented 8 years ago

Are you run my test case? (use PromiseTest.js)

I estimate two issue. First, Your configuration invalid on hive environment. OR don't set NOSASL option in hive. See in https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2, Authentication/Security Configuration section. After set authentication option SASL -> NOSASL.

xushuo commented 8 years ago

@imjuni this is some error that i run your test:

E:\gitWorkspace\jshs2>mocha test

ThriftDriverTest 1) "before all" hook 2) "after all" hook ThriftDriverTest jshs2:OperationTestSuite Error caused from before task, ... +0ms jshs2:OperationTestSuite Unexpected token / +2ms jshs2:OperationTestSuite SyntaxError: Unexpected token / at Object.parse (native) at E:\gitWorkspace\jshs2\test\PromiseTest.js:26:25 at next (native) at onFulfilled (E:\gitWorkspace\jshs2\node_modules\co\index.js:65:19) at tryCallOne (E:\gitWorkspace\jshs2\node_modules\promise\lib\core.js:37:12) at E:\gitWorkspace\jshs2\node_modules\promise\lib\core.js:123:15 at flush (E:\gitWorkspace\jshs2\node_modules\promise\node_modules\asap\raw.js:50:29) at nextTickCallbackWith0Args (node.js:420:9) at process._tickCallback (node.js:349:13) +1ms 3) "before all" hook jshs2:OperationTestSuite Error caused from after task, ... +2s jshs2:OperationTestSuite Cannot read property 'close' of undefined +0ms jshs2:OperationTestSuite TypeError: Cannot read property 'close' of undefined at E:\gitWorkspace\jshs2\test\PromiseTest.js:79:19 at next (native) at onFulfilled (E:\gitWorkspace\jshs2\node_modules\co\index.js:65:19) at E:\gitWorkspace\jshs2\node_modules\co\index.js:54:5 at co (E:\gitWorkspace\jshs2\node_modules\co\index.js:50:10) at Context. (E:\gitWorkspace\jshs2\test\PromiseTest.js:78:5) at callFnAsync (C:\Users\Administrator\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:357:21) at Hook.Runnable.run (C:\Users\Administrator\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:309:7) at next (C:\Users\Administrator\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:299:10) at Immediate._onImmediate (C:\Users\Administrator\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:327:5) at processImmediate as _immediateCallback +16ms 4) "after all" hook

0 passing (4s) 4 failing

1) ThriftDriverTest "before all" hook: Uncaught SyntaxError: Unexpected token / at Object.parse (native) at E:\gitWorkspace\jshs2\test\CallbackTest.js:134:36 at FSReqWrap.readFileAfterClose as oncomplete

2) ThriftDriverTest "after all" hook: Uncaught TypeError: Cannot read property 'close' of undefined at closeCursor (E:\gitWorkspace\jshs2\test\CallbackTest.js:197:15) at fn (E:\gitWorkspace\jshs2\node_modules\async\lib\async.js:638:34) at Immediate._onImmediate (E:\gitWorkspace\jshs2\node_modules\async\lib\async.js:554:34)

3) ThriftDriverTest "before all" hook: Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test. at null. (C:\Users\Administrator\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:230:19)

4) ThriftDriverTest "after all" hook: Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test. at null. (C:\Users\Administrator\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:230:19)

xushuo commented 8 years ago

@imjuni and this is my cluster.json:

{ "use": "ApacheHive", // Use Configuration "HiveOnCDH": { "auth": "NOSASL", "host": "my-hive.com", // hive server hostname "port": 13333, // port number "timeout": 10000, // timeout number(important, timeout is must be integer value) "username": "ironman", // username "hiveType": 1, // hive type number, (hive 0, cdh hive 1 see below HS2Util.js) "hiveVer": "0.13.1", // hive version "cdhVer": "5.3.0", // cdh version "thriftVer": "0.9.2", // thrift version "maxRows": 5120, // max row "nullStr": "NULL", // NULL field replace to this string "i64ToString": true // If you use i64 value that set true }, "ApacheHive": { "auth": "NOSASL", "host": "192.168.100.125", "port": 10000, "timeout": 10000, "username": "hadoop", "password": "hadoop", "hiveType": 0, "hiveVer": "1.2.0", "thriftVer": "0.9.2", "maxRows": 5120, "nullStr": "NULL", "i64ToString": true }, "Query": { "query": "show databases" // Enter your query } }

xushuo commented 8 years ago

@imjuni my HiveOnCDH is cdh5.7.1 that is too high

imjuni commented 8 years ago

I think that check your hive configuration. You need hive Authentication/Security Configuration, set NOSASL. Not only jshs2 but also hive configuration.

via: https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2, Authentication mode: hive.server2.authentication – Authentication mode, default NONE. Options are NONE (uses plain SASL), NOSASL, KERBEROS, LDAP, PAM and CUSTOM.

You set NOSASL mode on hive server2 configuration

xushuo commented 8 years ago

@imjuni ok , i will check my hive configuration as soon as possible .

xushuo commented 8 years ago

@imjuni i update my hive configuration .but the above problems will occur again, image

imjuni commented 8 years ago

@xushuo I think your error caused from cluster.json. That is invalid json file, so parsing fail at JSON.parse. Check your cluster.json file using by http://jsonlint.com/.

or change code, PromiseTest.js line 26,

try {
        var config = JSON.parse(yield new Promise(function (resolve, reject) {
          fs.readFile('./cluster.json', function (err, buf) {
            if (err) {
              reject(err);
            } else {
              resolve(buf);
            }
          });
        }));
      } catch (err) {
        console.log(err);
      }

Change code after, you can see parse fail reason. thank, you

xushuo commented 8 years ago

@imjuni oh ~~ there are some Invalid format errors in my cluster.json. but there have been some new error after i correct the error. 【connect refuse】 image

Is my hive configuration causing this error? image

imjuni commented 8 years ago

Your hive-server version is 1.2.0 is valid? If you not install hive 1.2.0, hive server version is 1.1.0 is valid. See it, Cloudera Hive repo.

Also, my hive-server2 version is 1.1.0 and perfectly working. Because hive-server 1.1.0 client_protocol version is 6 but hive-server 1.2.0 client_protocol version is 7. Invalid client_protocol version cause error. Check your hive version.

xushuo commented 8 years ago

yes,my hive-server version is 1.2.0 . image Maybe i need to install hive-server 1.1.0 . but the latest hive has more than 2.0 and cdh 5.7. Do you plan to update the project?

xushuo commented 8 years ago

@imjuni I solved the problem, because of my hive configuration. so funny. Uh, I am looking forward to your update to support the version of hive more than 2.0.****

xushuo commented 8 years ago

@imjuni Uh, sorry.I didn't see you update two days ago.

imjuni commented 8 years ago

@xushuo Sorry for late answer because Korea has a vacations. Can you explain that your problem?

xushuo commented 8 years ago

@imjuni My hive server doesn't start properly.so connect refuse......I reset the hive, and restart,and finished...
I see you have updated the project and add the hive 2.0.

imjuni commented 8 years ago

@xushuo I see, thank you. I was updated idl for hive 2.0.x. And I recommand that use thrift 0.9.3 because 0.9.3 ver more than faster(1 ~ 3%)

xushuo commented 7 years ago

@imjuni I have a question that the "hive.server2.authentication" must be 'NOSASL' ? now , if i add the config,hive doesn`t work well .

imjuni commented 7 years ago

@xushuo Yes must be st NOSASL, because SASL setting require specific protocol handshake process in thrift. But jshs2 don't have a this handshake process. So jshs2 need NOSASL configuration. I will be add this feature in jshs2

xushuo commented 7 years ago

@imjuni OK!My project work well. But i find that if i use lower idl such as hiveVer = 1.1.0 , the project looks work well . I can also get the right result. why? Speed is the difference between them?

imjuni commented 7 years ago

Hive version affect query execution time. Higher version better query performance than lower version. But Thrift version have affect communication time. Fetch result download time decrease, So Higher version mostly cause better performance.

xushuo commented 7 years ago

@imjuni Thank you !I get it . Yahoo!

xushuo commented 7 years ago

@imjuni hi! do you have other example of the jshs2 ? Because I need the parameters in the process of query (such as time-consuming, status, progress).