복붙노트

[HADOOP] Hive - Thrift - 이전 클라이언트의 readMessageBegin에 누락 된 버전이 있습니까?

HADOOP

Hive - Thrift - 이전 클라이언트의 readMessageBegin에 누락 된 버전이 있습니까?

안녕하세요, 저기 난리를 사용하여 내 하이브 데이터베이스를 쿼리 nodejs 클라이언트를 만들려고하지만 이상한 문제에 직면하고있어 ... 나는 thrift (thrift -r -gen js : node TCLIService)로 내 nodejs 클라이언트 API를 생성했습니다. TCLIService가 Hive 서비스를 정의하는 중고품 파일입니다.) 이제 하이브에 연결하려고 시도하지만 내 OpenSession은 보류 중입니다 ... 아마도 올바른 호출을 수행하지는 않지만 그물에서 최근의 것을 찾지는 못합니다. 드리프트 / 노드 / 하이브 프로젝트는 4 ~ 5 세입니다.) 내가 잘못했는지 한번 들여다 볼 수 있니? 감사

TCLIService.thrift :

// OpenSession()
//
// Open a session (connection) on the server against
// which operations may be executed.
struct TOpenSessionReq {
    // The version of the HiveServer2 protocol that the client is using.
    1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V8

    // Username and password for authentication.
    // Depending on the authentication scheme being used,
    // this information may instead be provided by a lower
    // protocol layer, in which case these fields may be
    // left unset.
    2: optional string username
    3: optional string password

    // Configuration overlay which is applied when the session is
    // first created.
    4: optional map<string, string> configuration
}

service TCLIService {
    TOpenSessionResp OpenSession(1:TOpenSessionReq req);
}

노드 코드 :     var sessionHandle = '';

function openSession(config) {
    openSessReq = new ttypes.TOpenSessionReq();
    openSessReq.client_protocol = ttypes.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V8;
    openSessReq.username = config.hiveUser;
    openSessReq.password = config.hivePassword;
    console.log("openSessReq = " + JSON.stringify(openSessReq));
    console.log("Before OpenSession : sessionHandle = " + sessionHandle);
    sessionHandle = client.OpenSession(openSessReq, function (err, result){
        console.log('handler fired ... ');
        if (err) {
            console.error("error : " + err);
        } else {
            console.log("result : " + result);
        }
    });
    console.log("After OpenSession : sessionHandle = " + sessionHandle);
}

connection.on('error', function(err) {
    /*Error detected, print the error*/
    console.error(err);
    /*Close the program with error code*/
    process.exit(1)
});

console.log('Error handler registered ...')

connection.on('connect', function(){
    console.log('Connected ...');
    /*Init session*/
    console.log(client);
    openSession(config);
}

내 출력은 다음과 같습니다.

CreateConnection DONE ...
Error handler registered ...
Connect handler registered ...
Connected ...
{ output:
   TBufferedTransport {
     defaultReadBufferSize: 1024,
     writeBufferSize: 512,
     inBuf: <Buffer e8 19 2b 03 00 00 00 00 b0 1a 2b 03 00 00 00 00 e8 18 2b 03 00 00 00 00 f0 18 2b 03 00 00 00 00 b0 19 2b 03 00 00 00 00 78 1a 2b 03 00 00 00 00 70 1d ... >,
     readCursor: 0,
     writeCursor: 0,
     outBuffers: [],
     outCount: 0,
     onFlush: [Function],
     client: [Circular] },
  pClass: [Function: TBinaryProtocol],
  _seqid: 0,
  _reqs: {} }
openSessReq = {"client_protocol":7,"username":"root","password":"root","configuration":null}
Before OpenSession : sessionHandle =
After OpenSession : sessionHandle = undefined
^C

스크립트가 무기한으로 실행 중입니다 ... 포트를 변경하거나 HiveServer를 종료하면 오류가 발생하여 연결이 작동하지만 openSession이 아닌 이유를 찾을 수 없습니다! 당신의 도움을 주셔서 감사합니다

편집하다 : 로그를 확인했는데 NOSASL ID가 문제가되었습니다 ...이 문제가 해결되어 이제 다음 오류가 발생합니다.

고객 :

{ [Error: write EPIPE]
 code: 'EPIPE',
 errno: 'EPIPE',
 syscall: 'write',
 address: undefined }

서버 :

2016-02-17 13:36:37,152 ERROR org.apache.thrift.server.TThreadPoolServer: [HiveServer2-Handler-Pool: Thread-24]: Thrift error occurred during processing of message.
    org.apache.thrift.protocol.TProtocolException: Missing version in readMessageBegin, old client?
        at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:228)
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:27)
        at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

잘못된 프로토콜 계층을 사용하여 문제를 제기해야한다는 것을 읽었습니다 ... TBinaryProtocol을 사용하고 있는데 문제가 있습니까?

해결법

  1. ==============================

    1.나는 다음을 수행하여 내 문제를 해결했습니다 :

    나는 다음을 수행하여 내 문제를 해결했습니다 :

    beewax를 사용하여 내 HiveServer2의 프로토콜 버전을 확인하고 내 HiveServer2 (색조 포함)를 쿼리하고 HiveServer2 로그를 확인합니다 (하이브 0.15.0에 대해 HIVE_CLI_SERVICE_PROTOCOL_V7임을 확인했습니다)

    hive-site.xml을 수정하여 HiveServer2에서 NOSASL 인증 사용

  2. ==============================

    2.환경의 세 부분을 확인해보십시오. 세 부분 모두 기본적으로 동일한 구성 파일 (hive-site.xml)에 있습니다.

    환경의 세 부분을 확인해보십시오. 세 부분 모두 기본적으로 동일한 구성 파일 (hive-site.xml)에 있습니다.

    추신. 콘솔로 hs2에 연결하여 서버에 문제가 없는지 확인할 수 있습니다.

  3. from https://stackoverflow.com/questions/35453288/hive-thrift-missing-version-in-readmessagebegin-old-client by cc-by-sa and MIT license