복붙노트

[HADOOP] 호스트 시스템에서 클라이언트로 VM에서 실행중인 HBase에 액세스

HADOOP

호스트 시스템에서 클라이언트로 VM에서 실행중인 HBase에 액세스

클라이언트 프로그램으로 hbase에 데이터를 쓰려고합니다.

HBase @ Hadoop은 Cloudera @ 우분투의 미리 구성된 VM에서 실행됩니다.

클라이언트는 VM을 호스트하는 시스템에서 실행되며 VM에서 클라이언트를 직접 실행합니다.

이제 VM 외부의 클라이언트를 사용하여 VM의 서버에 액세스하려고합니다.

NAT를 사용하고 있습니다. HBase Master, HUE ..와 같은 서버에 액세스하려면 가상 박스에서 포트 포워딩을 구성했습니다.

따라서 HBase Master, HUE ..의 개요 사이트에 접근 할 수 있습니다.

내가 만든 VM의 서버에 대해 클라이언트를 실행하려면 content가있는 hbase-site.xml :

<configuration>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>localhost</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.clientPort</name>
        <value>9997</value>
    </property>
    <property>
        <name>hbase.master</name>
        <value>localhost:9999</value>
    </property>
</configuration>

따라서 포워딩이 작동 할 것으로 예상했습니다.

클라이언트를 실행할 때 로그의 오류 메시지는 다음과 같습니다.

11/09/07 17:48:00 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
11/09/07 17:48:00 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
11/09/07 17:48:01 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
11/09/07 17:48:01 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 17:48:01 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Address family not supported by protocol family: connect
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
    at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1050)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1077)
11/09/07 17:48:03 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
11/09/07 17:48:04 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
11/09/07 17:48:04 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 17:48:04 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Address family not supported by protocol family: connect
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
    at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1050)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1077)
11/09/07 17:48:05 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181

올바른 연결 로그 (클라이언트를 VM에서 직접 실행하는 경우)는 다음과 같습니다.

11/09/07 09:05:29 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x132449d36df0006, negotiated timeout = 40000

그래서 포트가 올바르게 전달되었지만 포트 포워딩 설정에서 IP가 여전히 localhost이고 10.0.2.15가 아니기 때문에 연결 URL이 올바르지 않은 첫 번째 문제가 발생하기 전에 로그 라인에 나타납니다.

Opening socket connection to server localhost/127.0.0.1:2181

호스트 (win7)와 VM (Ubuntu)에서 비활성화 된 IPV6을 비활성화한다는 힌트 만 발견했습니다. 및 포트를 확인 -> 그들이 올바르게 전달됩니다

누구 한테 아이디어 있니?

해결법

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

    1.이를 읽는 사용자에게 부가 가치를 부여하기위한 해결책은 다음과 같습니다.

    이를 읽는 사용자에게 부가 가치를 부여하기위한 해결책은 다음과 같습니다.

    Could not resolve the DNS name of cloudera-vm
    

    C : \ Windows \ System32 \ drivers \ etc \ hosts에 간단하게 추가한다고 수정하자.

    192.168.56.101  cloudera-vm
    

    따라서 cloudera-vm을 사용할 때마다 적절한 IP로 해결됩니다. VM은 현재 호스트 전용 네트워크 모드에서 실행 중이며 192.168.56.101에 할당되었습니다. 따라서 포트 포워딩이 필요하지 않습니다.

    단지 비교를 위해 :

    hbase-site.xml

    <configuration>
      <property>
        <name>hbase.zookeeper.quorum</name>
        <value>cloudera-vm</value>
      </property>
    </configuration>
    

    persistence.xml

    <persistence
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
        version="1.0">
    
        <persistence-unit name="hbase-addressbook"
            transaction-type="RESOURCE_LOCAL">
    
            <properties>
                <property name="datanucleus.ConnectionURL" value="hbase:cloudera-vm" />
                <property name="datanucleus.ConnectionUserName" value="" />
                <property name="datanucleus.ConnectionPassword" value="" />
                <property name="datanucleus.autoCreateSchema" value="true" />
                <property name="datanucleus.validateTables" value="false" />
                <property name="datanucleus.Optimistic" value="false" />
                <property name="datanucleus.validateConstraints" value="false" />
            </properties>
        </persistence-unit>
    </persistence>
    

    그 후 다른 오류 (모든 연결 문자열이 맞았지만 연결이 거부 됨)가 발생하여 그 원인에 대해 수 일간 조사했습니다.

    해결 방법은 파일에 다음을 추가하여 VM에서 실행중인 Ubuntu의 IPV6을 비활성화하는 것입니다. /etc/sysctl.conf

    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
    

    재부팅 후 모든 것이 연결되어 제대로 작동합니다 :)

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

    2.코드에서 설정을 명확하게 지정할 수 있다고 생각합니다. HbaseConfiguration conf = HbaseConfiguration.create (); conf.set ( "hbase.zookeeper.quorum", "ubuntu1, ubuntu2"); ... 어쩌면 당신을 도울 수 있습니다 ..

    코드에서 설정을 명확하게 지정할 수 있다고 생각합니다. HbaseConfiguration conf = HbaseConfiguration.create (); conf.set ( "hbase.zookeeper.quorum", "ubuntu1, ubuntu2"); ... 어쩌면 당신을 도울 수 있습니다 ..

  3. ==============================

    3.간단한 시도 :

    간단한 시도 :

    <property name="connectionURL" value="hbase:master.standalone.hostname:60000"/>
    
  4. from https://stackoverflow.com/questions/7337457/accessing-hbase-running-in-vm-with-a-client-on-host-system by cc-by-sa and MIT license